[Zope] Zope's performance on xBSD

Giorgos Verigakis verigak@algol.vtrip-ltd.com
Fri, 17 Aug 2001 17:25:16 +0300 (EEST)


Hello, I'm using Zope on FreeBSD and OpenBSD and I've noticed some
serious performance issues. Since I hadn't experienced any problems
at the past with Linux, I did some benchmarks.

I've written a small program that connects to Zope and tries to
retrieve a non-existant URL (source code appended). While Linux
performed almost linearly depending on the number of hits/sec,
FreeBSD and OpenBSD performed exponential.

I did the following experiment:
I installed a binary distribution of python-1.5.2 (pkg_add or apt-get)
and I compiled Zope-2.3.3+HotFix from sources (with wo_pcgi.py).
I entered Zope's management screen and expanded all folders. I ran
the previous program and after about 1000 hits I reloaded the page
and measured the time it gets to finish. The results are below:

|---------------------+------------+---------------+-------------+
|        OS           | Hit Rate*  | Real hit rate | Reload time |
|                     | (hits/sec) | (hits/sec)    | (sec)       |
|---------------------+------------+---------------+-------------+
|                     |     30     |      20       |      13     |
| Linux debian 2.2.19 |     50     |      33       |      16     |
|                     |    100     |      38       |      16     |
|---------------------+------------+---------------+-------------+
|                     |     30     |      20       |      10     |
| FreeBSD 4.3-Release |     50     |      33       |      23     |
|                     |    100     |      40       |     100     |
|---------------------+------------+---------------+-------------+
|                     |     30     |      20       |      10     |
| OpenBSD 2.9-Release |     50     |      33       |      15     |
|                     |    100     |      50       |     285     |
|---------------------+------------+---------------+-------------+
*The hit rate is the one passed as an argument to the program, while
real hit rate was calculated according to Zope's log file.

All tests were ran on the same computer, a 600MHz Celeron with
192MB RAM

These tests were ran using the default Data.fs. When I use a real
Data.fs + my products I even get time outs when I try to access
the content.
Why is there such a difference between the OSs? Do the BSD users of
this list experience similar problems?

Giorgos Verigakis


------------------ 8< ------------------
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

int main(int argc, char *argv[])
{
        struct sockaddr_in sa;
        struct hostent *hp;
        int s;
        int i, t, len;
        unsigned long sleeptime;
        char request[128];
        char *url="/foo";

        if (argc != 4) {
                printf("Usage: %s <host> <port> <rate>\n", argv[0]);
                printf("rate in hits/sec\n");
                exit(1);
        }

        if ((hp = gethostbyname(argv[1])) == NULL) {
                printf("error looking up host\n");
                exit(1);
        }

        sprintf(request, "GET %s HTTP/1.0\015\012\015\012", url);
        len = strlen(request);
        sleeptime = (1 / atof(argv[3])) * 1000000;

        bzero(&sa, sizeof(sa));
        bcopy(hp->h_addr, (char *)&sa.sin_addr, hp->h_length);
        sa.sin_family = hp->h_addrtype;
        sa.sin_port = htons(atoi(argv[2]));

        for (i = 0;; i++) {
                if (( s= socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) {
                        printf("Socket error\n");
                        continue;
                }

                if (connect(s, (struct sockaddr *) &sa, sizeof sa) < 0) {
                        printf("Connection error\n");
                        close(s);
                        continue;
                }

                t = write(s, request, len);
                printf("i=%d: %d bytes\n", i, t);

                usleep(sleeptime);

                close(s);
        }
}
------------------ 8< ------------------