Re: proxy server in lisp
- From: "Alex Mizrahi" <udodenko@xxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 16 Apr 2007 14:09:22 +0300
(message (Hello 'Rainer)
(you :wrote :on '(Sun, 15 Apr 2007 22:20:29 +0200))
(
??>> almost all garbage collectors do full GC from time to time, having
??>> potentially large delay.
RJ> How long do you think a full GC of a GB real memory takes
RJ> on a current system?
it depends on patterns of trees in memory and lots other values.
if we'd like to test web server workloads, let's do a benchmarking of UCW.
1. i've got latest ucw-dev. i'd be testing all default settings, examples
head page. only modification i've made is shutting down loggers.
2. free say that i have used 20 MB of total memory 512 MB
3. i've loaded ucw, 82 MB are used now.
(time (gc :full t)) 0.35 seconds of real time
4. to stretch it
ab -n 30 -c 10 http://localhost:8080/
Percentage of the requests served within a certain time (ms)
50% 89
66% 220
75% 1060
80% 1082
90% 1131
95% 1151
98% 1162
99% 1162
100% 1162 (longest request)
free says that 88 MB is used now.
5.
ab -n 5000 -c 10 http://localhost:8080/
50% 20
66% 25
75% 29
80% 33
90% 48
95% 78
98% 267
99% 3029
100% 11754 (longest request)
as you can see, most requests take 20 mseconds, but longest takes 12 -- i
bet connected with full GC. and there are some 50 requests that last for 3
seconds.
cheking (time (gc :full t)) repors 2.1 seconds real time in repl.
memory allocated will grow as we test it, since UCW creates a dozen of
continuations for each request it serves.
but currently we are only using 156 MB of 512.
6. next 5000 requests give us similar picture:
50% 21
66% 28
75% 33
80% 37
90% 58
95% 87
98% 728
99% 3017
100% 10837 (longest request)
so it appears to be quite repeateable result.
we're using 255 MB RAM now -- starting approaching point when swapping will
happen.
again, i'll do a full gc in repl, it takes 4.3 seconds now.
7. next 15000 requests killed the server -- SBCL said "Heap exhausted, game
over".
unfortunately i don't have enough time to tune it and test more, but i think
that GC time will scale aprox linearly, so for GB it can be as long as one
minute. it gets especially problematic on an OS with VM -- it can swap out
parts for memory that is not used -- for example, web server doesn't get
much attention on weekend, but mailserver has some, so OS will swap web
servers memory on disk. but on Monday people will come to see their web
server, and once it will do full GC it will be totally disruptive -- it will
need ALL it's 1 GB of RAM, and that would make lots of random accesses to
disk, which are not fast.. so, people will see web server down for a few
minutes..
RJ> Why do you think an incremental
incremental never does full GC by it's definition.
RJ> generational GC should do a full GC when there is no need to do so? I
RJ> think you
RJ> haven't read the references I gave you on resources
RJ> and areas. What one does is to identify the larger
RJ> and longer living data structures (connections, threads,
RJ> buffers, headers, ...) and manage them as resource pools. There
RJ> is no garbage generated for them. With some care it is
RJ> possible to run with very little consing and what
RJ> you cons can be garbage collected with an ephemeral
RJ> collector.
it's certainly possible to do so, but i think it's very hard for
sufficiently complex application, and it will undermines whole idea of
building web application in Common Lisp -- it will have too much
restrictions, so it will be lots easier to build just some CGI-style
application in PHP, that doesn't have such problems at all.
and how are you going to make framework like UCW consingless? as i've noted
above, on each request UCW allocates a dozen of continuations and some
object instances, that is quite a complex structure. this continuations will
expire in some hours, so it's not possible to deallocate them with anything
less than full GC.
??>> as far as i know, there is no incremental GC (that has deterministic
??>> pauses) implemented for Common Lisp.
RJ> What is a deterministic pause exactly
you can find info about how deterministic GC is desired thing for some kinds
of dynamic application is BEA JRockit white paper (it's for Java):
http://www.bea.com/content/news_events/white_papers/BEA_JRockit_Deterministic_GC_wp.pdf
they say they can limit garbage collection pause to 45 mseconds, while
typical parallel GC typically takes more that 0.5 seconds, and even with
Sun's incremental GC some requests can be paused for 0.5 seconds and more.
RJ> and why do you need it for a proxy?
i don't want my clients wait for undefined period of time
RJ> What is the reason you can't write a proxy for Lisp?
it's possible, but there's really very little sense for it.
??>> if we speak about HTTP proxy, the best way to avoid consing (and also
??>> save some time) is to use one of ready proxies written in C.
RJ> You'll never get a piece of Lisp code written with this attitude.
RJ> Plus you will never get Lisp systems advancing the state of the
RJ> art with this attitude.
i'm using Lisp for relatively complex and new tasks, which it is good for.
and if i can find a ready tool that does it task well -- like Apache serving
static pages and doing proxying -- i'll be glad to use it.
)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"I am everything you want and I am everything you need")
.
- Follow-Ups:
- Re: proxy server in lisp
- From: Rainer Joswig
- Re: proxy server in lisp
- From: Espen Vestre
- Re: proxy server in lisp
- References:
- proxy server in lisp
- From: JeremiaThomas
- Re: proxy server in lisp
- From: Alex Mizrahi
- Re: proxy server in lisp
- From: Rainer Joswig
- Re: proxy server in lisp
- From: Alex Mizrahi
- Re: proxy server in lisp
- From: Rainer Joswig
- proxy server in lisp
- Prev by Date: Re: memory functions in lisp similar to sizeof, malloc etc. of C
- Next by Date: Re: proxy server in lisp
- Previous by thread: Re: proxy server in lisp
- Next by thread: Re: proxy server in lisp
- Index(es):
Relevant Pages
|