At 10:25 PM 3/9/99 -0500, Skip Montanaro wrote:
Here's a slightly different question. I'm running Apache, ZopeHTTPServer and a backend database server. Apache (pre)forks, ZHS is multi-threaded and the database server is single-threaded. If a long-running query is being processed by the database server is the multi-threaded ZHS blocked or can other threads run concurrently?
If you run ZHS in multi-threaded mode it does not block. It will continue to accept new connections. If all those connections need to wait for a single-threaded database server, then you don't gain much by running in multi-threaded mode.
Even if ZHS doesn't block completely, more and more queries can pile up.
Right.
ZHS has no capability to limit the number of simultaneous threads,
Yes, but ZServer does. You can set ZServer's thread pool size.
and Apache's process limit is normally pretty high, so you can get a very bad failure mode. While it would appear at first that running a multi-threaded ZHS would be a win (allows short-running stuff that can be handled completely by the published module to complete), I think the bad (nay, catastrophic) failure mode suggests otherwise.
I'm not sure how things would work out in real life. I suggest you do some tests to see how things perform under a heavy load. If ZHS is creating too many threads, you might want to switch to ZServer. If you don't like running alpha software, you might want to change ZHS to use a thread pool, which wouldn't be very hard. (Not that I'm volunteering ;-) Otherwise, you might want to start caching results of your database queries, this could potentially help you quite a bit, no matter what server mix you end up using. Finally, I have no idea what your database server is like, but if there are any easy ways to make it multi-threaded or simply faster, go for it ;-) It sounds like this is where your performance bottleneck lies. Good luck. -Amos