[Zope] ZSERVER, THREADS, PERFORMANCE & FUTURE PERFORMANCE

Pavlos Christoforou pavlos@gaaros.msrc.sunysb.edu
Thu, 11 Nov 1999 17:55:23 -0500 (EST)


On Thu, 11 Nov 1999, Sam Gendler wrote:

> 
> If even going to 2 threads on the client side causes a 20% degradation in
> performance, there has got to be something wrong with the threading model in the
> server.  I will look at it as I get a chance, but I am in the midst of building a

I think the issue is with ZServer's architecture. Threads were introduced
to guard against requests that blocked or took too long to complete, which
placed medusa on hold. I do not expect to see any increase in performance
by increasing threads unless you have requests that take a long time to
execute.

But before we worry about fine tuning Zope, we can easily put some upper
limits to it by running a simple object through ZPublisher.

Here is a test:

from Globals import HTML

class Test:
    'test class'
    index_html=HTML('''
<html><head></head><body>
This is test
<dtml-var a>
<dtml-var b>
<dtml-in c>
<dtml-var sequence-item>
</dtml-in>
</body>
</html>''')

test=Test()
test.a='a'
test.b='b'
test.c=range(20)
bobo_application=test

and the rendered text has saved as straight HTML to be served from apache
as well.

On a heavily loaded server (in terms of network access) I got using apache
benchmark:

Document Path:          /test.html
Document Length:        154 bytes

Concurrency Level:      20
Time taken for tests:   2.420 seconds
Complete requests:      300
Failed requests:        0
Total transferred:      137846 bytes
HTML transferred:       48356 bytes
Requests per second:    123.97
Transfer rate:          56.96 kb/s received

Connnection Times (ms)
              min   avg   max
Connect:        9    13    21
Processing:    14   141   215
Total:         23   154   236


and ZServer did:

Document Path:          /index_html
Document Length:        109 bytes

Concurrency Level:      20
Time taken for tests:   6.786 seconds
Complete requests:      300
Failed requests:        0
Total transferred:      83700 bytes
HTML transferred:       32700 bytes
Requests per second:    44.21
Transfer rate:          12.33 kb/s received

Connnection Times (ms)
              min   avg   max
Connect:        9    13    60
Processing:    88   422   544
Total:         97   435   604


Looks like running a simple DTML method through ZPublisher with some
dynamic content, reduces performance to about a third/fourth of apache
serving straight html. Not bad, even blazingly fast in my opinion (no
wonder I still use bobo). At least now I know where the lid is. I hope
with good caching Zope should approach such performance.

> packet, or else they send the headers as one packet and the body as another.  In
> either case, you will usually trigger this behaviour.  Simply buffering the output
> is enough to prevent the problem.

If I remember correctly, each channel in medusa buffers all output
including headers etc.


Pavlos