Is QtCore too 'heavy' for server-side use?
I am looking into writing a self contained http server using Qt libraries, although many people have the view that QtCore is too bloated and that the overhead would be too large. Would a QtCore http server manage a load of about 50 concurrent connections, using a thread pool.
The QtCore library is dynamically linked on arch Linux compiled for release with opti开发者_如何转开发mization o2
There is no reason that one could not write a server with Qt, however, there is really no way to tell beforehand whether the performance will be what you want (depends on what your server does). Note that the optimal number of concurrent threads is typically dependent on the number of hardware cores, as well as the level of parallelism in your program. My suggestion would be to implement whatever you can in the least amount of time, and then tune the performance as needed afterwards. Even if the server cannot handle that many concurrent connections, you can use process-level parallelism (running multiple instances of your multithreaded server), until you have improved the performance.
Your question is very broad and the answer depends on how you want to design your http server. You could design it as a "single threaded reactor" or "multi-threaded proactor" or "half-synch half asynch" server.
QT mostly uses little wrapper classes over native or posix APIs and brings its own overweight for sure and 50 connections does not sound too many but again the answer depends on what will these connections do ? Serve simple pages or perform heavy calculations ?
I think the difficulty of the project lies in implementing a full http server that is secure ,reliable and scalable. You will have to do a lot of coding just to provide the life cycle of a simple Java servlet model. Many interfaces/abstractions are required.
You can find open source http servers already tested. I would not even bother writing my own for production software.
50 connections isn't much.
But I hope you will add the QtNetwork module :-)
精彩评论