I am using sbcl for a web-server application (http://github.com/bvds/andes)
for an intelligent tutor homework system. Each instance of a student
solving a problem has a user session associated with it. Each session
lasts for roughly 15 minutes (but could vary quite a bit) and uses
roughly 1MByte of memory (on a 32 bit machine). When the
server is fully loaded, it can handle about 300 concurrent sessions
without maxing out the cpu.
However, I am having lots of trouble with garbage collection, since
the behaviour of the server badly violates the basic assumption of
the generational garbage collector: in my case, it is more likely that
old data (after a session has closed) can be garbage collected
than newer data.
For simultaneous 300 sessions, the memory usages looks like this:
Breakdown for dynamic space:
274,297,608 bytes for 34,287,201 cons objects.
95,976,736 bytes for 1,372,664 simple-character-string objects.
37,470,400 bytes for 1,170,950 symbol objects.
45,860,504 bytes for 1,064,281 other objects.
453,605,248 bytes for 37,895,096 dynamic objects (space total.)
Any advice for what to do? Two ideas:
1. Modify the garbage collector so that it gcs the older data first.
(that is, do generation 0, 1, 2 in the usual way, but do generations
3, 4, 5 backwards).
2. Is there any way to garbage collect for a specific object
and its descendents?
(For the purposes of discussion, I am running sbcl-1.0.35 on 32 bit
linux, although I see the same issues in 64 bit linux, and 32 bit x86 OS X.)
Brett van de Sande