Please nominate your Qt Champions for 2021!

Going from tens of tcp socket connections to 500 maybe more

  • Seeking advise for supporting large amounts of sockets with QT.

    I have a very nice server app that uses QtCore, QNetwork and QSql, its been rock solid with say 10 to 20 simultanious tcp connections but I want to scale it up to handle ten to hundred times more. Currently each socket is writtent to using a giant for loop that iterates though the whole list of sockets. Now I heard writting to a socket is fast, but was wondering what kind of delay will be from writing a buffer to socket number one to socket number 1000 in the list. I have no way of testing this out across 1000 real simultanious connections so wanted to seek advise here.

    Any advise, should I move away from Qt and go down to Linux sockets (these are tcp).

    Thank you very much for any feedback


  • I did remember the "c10k problem": :)

    Do you want to send the same packet to all sockets (broadcast)? I guess removing Qt will not solve your problem.

    Maybe "QtConcurrent": can help you.

  • Thanks for the url, the infomration is a bit dated but still worth reading. I am sending the same data to every socket by the way

  • I have done a test with such a setup. IIRC I did a stress test with up to 500 sockets to be served. The CPU gets a bit busy. But it seemed to have nothing special up to this range.
    The server sends real-time data of less than one 1k per socket with an update rate of 1 Hz.

Log in to reply