> On Thu, 2011-11-17 at 11:40 +0100, Roberto De Ioris wrote: >> Hi everyone, the support for Linux KSM has been added in current >> mercurial tip >> >> http://projects.unbit.it/uwsgi/wiki/KSM >> >> If you host a good amount of uWSGi instances/processes on a recent >> (>=2.6.32) linux kernel, try it. > > This is GREAT. I tried out some time ago with a friend (who wrote the > code) a different approach to the problem (using LD_PRELOAD dlsym to > replace malloc/realloc to madvise pages), and it was working but savings > were very low (it was probably the wrong approach). But it was just a > Saturday afternoon hack (well, code for ~1h, then tests :P) > I'll try KSM with uwsgi very soon, thanks again for your work :) >
I tried something similar, some month ago, but there are so many ways to allocate memory (in uWSGI for example we use 5 different ways) that managing the thing asynchronously is the only way to go. Luckily enough, linux exports process mappings via proc file, so it has been only a matter of parsing that file when needed and calling madvise() Each "virgin"+python uWSGI worker, can "share" about 200 pages on a 32 bit system (1 meg of about 4, so it is 25% less memory per worker) -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list uWSGI@lists.unbit.it http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi