Hi there,

We're trying to apply some memory limitations to apps that may contain a variable number of workers.

We know we can set

  cgroup = /mnt/cgroups/memory/domains/vassal-domain-name
  cgroup-opt = memory.limit_in_bytes=1800M
  cgroup-opt = memory.memsw.limit_in_bytes=1800M

And that's fine for limiting a user with one worker to 1.8GB of RAM, but the problem is that if a user has 10 workers, the cgroup limits the *total* memory usage to 1.8GB, which is now down to less than 200Mb per worker, and that's too little. We also don't want to just bump that user up to an 18GB limit, since that's potentially higher than the system ram, and besides, this is mainly about catching accidental memory leaks in individual processes rather than limiting total consumption. So the question is:

* Is there any way to put each worker in its own cgroup? *

I could imagine it working if uwsgi had some magical template variable syntax, a bit like nginx? eg:

  cgroup = /mnt/cgroups/memory/domains/vassal-domain-name/worker-$WORKER_ID

Is there any such thing?

Or perhaps there would be a way of running a script, pre-jail put post-fork, that ran as root/privileged user, that would be able to identify the spawned worker processes and manually put them into their own cgroups? Could exec-post-jail or exec-pre-app work for this? Would there be any way for such a job to identify the worker process ids?

thanks,
Harry

--
Harry Percival
Developer
[email protected]

PythonAnywhere - a fully browser-based Python development and hosting 
environment
<http://www.pythonanywhere.com/>

PythonAnywhere LLP
17a Clerkenwell Road, London EC1M 5RD, UK
VAT No.: GB 893 5643 79
Registered in England and Wales as company number OC378414.
Registered address: 28 Ely Place, 3rd Floor, London EC1N 6TD, UK

_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to