[Zope] Multithreading in zope and python

Martijn Pieters mj@digicool.com
Sat, 10 Jun 2000 12:01:55 +0200


[Let's keep zope@zope.org in the loop. Don't just rely on me]

On Sat, Jun 10, 2000 at 03:28:21AM -0400, sudhir@earthling.net wrote:
> > How do you know it isn't using multithreading? If you are using ZServer
> > (standalone or behind anotger webserver), you are using multithreaded Zope.
> > And if you start Zope with z2.py unaltered, you are using ZServer, and only
> > took out -d from the start script, you are definetly running ZServer, and
> > therefor multithreaded.
> >
> > Do you maybe mean that Zope doesn't fork off into the background, but instead
> > is still attached to the terminal?
> 
> I sure am using ZServer, without any other webserver.
> Maybe I posed the wrong question. Here is what I am coming from.
> 
> To test the performance of my webserver, I wrote a client using python's
> httplib, that accesses my site 100 times.  First I ran one instance of the
> the client.  Then I ran 10 concurrent instances of client. To my surprise,
> time taken was absolutely linear, i.e. time taken for 10 concurrent
> instances was 10 times more than that with 1 instance.
> 
> Now it sure is possible to get this kind of behavior even with
> multithreading, but I was not expecting this and suspected that
> multithreading is not on.
> 
> I am using RedHat 6.1 on a Pentium II 400 MHz. What all can I do to increase
> the performance of my webserver?
> 
> Currently, I am using MySQL and all the database accesses is done inside
> external methods, using MySQLDA. Do you thing using ZSQL is going to boost
> the performance?

There are two things that may have gone wrong here:

- You testing program isn't concurrent, even though you think it is.

- I don't know much about the MySQL db, but maybe your approach of accessing
  it causes requests to be serialized, thus your whole app to be serialized.

You should probably test your client with a part of Zope that doesn't access
the MySQL database first, to make sure that the problem doesn't lie with your
client. You could also get 'ab' the Apache Benchmark program that comes with
Apache to do your testing for you, as it is known to work.

Accessing MySQL direct from your External Methods introduces a variable
I cannot comment upon. Apart from that, using the MySQLDA would at least give
you the advantage of being able to use the SQL Methods' caching mechanism. I
understand that the CodeCatalog.com site gets much of it's speed because it
leans heavily on this feature. The case study on Catalog.com can be found at:

  http://www.zope.org/Resources/CaseStudies/CodeCatalog/

-- 
Martijn Pieters
| Software Engineer    mailto:mj@digicool.com
| Digital Creations  http://www.digicool.com/
| Creators of Zope       http://www.zope.org/
|   The Open Source Web Application Server
---------------------------------------------