[plt-scheme] Web server consuming much memory and slowing down with use -- some benchmarks.

From: Ethan Herdrick (info at reatlas.com)
Date: Wed Apr 25 01:20:38 EDT 2007

Hi folks:

On my windows machine, with version 360, the web server eats a ton of
memory and steadily slows down when repeatedly running a servlet of
any kind, or even serving static files.  For example, when I use this
very simple servlet:

(module max-static mzscheme

  (require (lib "servlet.ss" "web-server"))
  (require (lib "response.ss" "web-server"))
  (provide interface-version timeout start)

  (define interface-version 'v1)

  (define timeout +inf.0)

  (define (start initial-request)
      (make-response/full 200 "OK" (current-seconds) #"text/html"
`((Pragma . "no-cache"))
                          (list "just some text"))))


...and load test for 30 seconds with ApacheBench like this:
$ ./ab2.exe -c 4 -t 30 "http://myhost/servlets/max-static.ss"

...then ApacheBench reports a successful request rate of 60 / second,
which isn't bad.  However,  memory consumption has risen from around
30 meg to 150 meg and does not come back down after the test.  Another
30 second run like that and the thoroughput has dropped to only about
30 requests / second and memory consumption is at 180 meg (and
holding).  A third run shows the throughput down to 21 / second and
memory consumption up to 205 meg.  Running refresh-servlets doesn't
have any effect on memory consumption.

Why is such a simple servlet causing so much memory consumption?  If I
understand the situation correctly, since we aren't using send/suspend
and the start function is running to completion, we aren't causing
hordes of continuations to be held on the server.  We're also seeing a
similar pattern (but topping out at 100 meg of memory) just from
serving static files from the /htdocs directory.

We are looking to launch a high-traffic web application (we hope) and
this really wouldn't work for us.  Does this not happen on Linux?  If
the list opinion is no, then I can get a Linux box going and report
back.

Any help is appreciated.

Thank you.

-Ethan Herdrick


Posted on the users mailing list.