Multi threaded server with separate database connection for every users
-
Hello everyone,
I have several questions.
Here is such structure
There is created own thread for each user, with its connection to database. The question is whether is there some limits of simultaneous connections with database in Qt?
And also as backend located behind the proxy that's why during time when user connects, his IP is always 127.0.0.1. But the nginx is setuped with forwarding settings, the settings of forwarding were taken from manual
the config file of proxy is belowlocation / { proxy_pass http://127.0.0.1:1555; proxy_http_version 1.1; proxy_read_timeout 15m; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; }
-
Hi
Each database (driver) might have a limit on concurrent users or
use a locking method that makes concurrent users less optimal.But other than that, it should work
https://stackoverflow.com/questions/5365235/qt-sql-threaded-database-queries -
Also to add to @mrjj, each driver may be reentrant, thread-safe, a combination of the two or neither. So special care may be needed when having concurrent access to databases.