Nominate our 2022 Qt Champions!

Multi threaded server with separate database connection for every users

  • 0_1505808902739_Server.jpg

    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 But the nginx is setuped with forwarding settings, the settings of forwarding were taken from manual
    the config file of proxy is below

            location / {
                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;

  • Lifetime Qt Champion

    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

  • Moderators

    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.

Log in to reply