Event driven server that wastes CPU when threaded doesn't

Carl Banks pavlovevidence at gmail.com
Sun Oct 29 17:16:47 EST 2006


Snor wrote:
> As this occurs, there is a
> small amount of lag while the communication with the mySQL server takes
> place, and there could be another 100 clients waiting to make a request
> at this point, meanwhile the server is idling while waiting for a
> response from the mySQL server - obviously not a good server model.

Isn't it possible to use asynchronous communication to talk to the SQL
server as well?

I don't know a lot about Twisted, but I'd think you could create some
sort of connection with the SQL server and have TwistedMatrix manage
and react to the SQL server events the same as it does with your
clients.  Being that SQL is so common, I bet someone's already written
higher-level protocol handlers.


Carl Banks




More information about the Python-list mailing list