[racket] How to reduce my Racket web server's memory usage?
On 2/2/2015 12:58 PM, Jay McCarthy wrote:
> I think 80MB is pretty typical. If you convert to "#lang web-server",
> you should be able to trade RAM for disk space, but I doubt you could
> get less than 40MB and 80MB out of 512M is pretty decent.
>
> Jay
Would that difference all be from not caching continuations, or is there
something else?
On a related note, does sharing a file through *#:servlet-namespace*
actually save memory, or is it just about putting names into the
custodian environment? I'm a bit unclear as to whether custodians
really manage code (ala Java loaders) or just namespaces. I have a
couple of large utility files shared this way, but since I still have to
require them everywhere and you have mentioned previously (IIUC) that
servlet instances run under separate custodians, I am wondering just how
it works.
Thus far I've been using #lang racket. I haven't bumped into memory
limitations, but the executable footprint (resident+swap) is ~260MB and
growing. Currently I have no continuation servlets - all are run to
completion - and so right now I have *#:stateless? #t* and *#:manager
(create-none-manager #f) * in the call to serve/servlet, but there are
43 servlets and counting, plus several auxiliary threads and a
large(ish) dbms connection pool. Probably the number of servlets will
double before I'm done. I have managed to avoid using continuations via
SQL wizardry, but I don't know how far I can push that - the web
designer keeps wanting to shift more session management responsibility
onto the server side.
I haven't played with #lang web-server at all, so forgive me if these
are stupid questions:
Where I have servlets that share auxiliary functions I have grouped them
together in a single source file. From the docs it appears that the
(provide version stuffer start) 3 argument form is special vs the
normal n-argument module provide. Can there be multiple web language
servlets with different specs provided from a single source file?
Does switching to the web language impact using serve/servlet and
dispatch-rules?
Can web language and racket language servlets be mixed in the same
application (gradual transition) or is it all or nothing?
Thanks,
George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150202/94a3ab47/attachment.html>