I have a task receiving daemon that runs on many machines. Arbitrary tasks get sent by clients that are then executed on the server, sometimes taking a little memory and sometimes pushing up to the limit that I set in the daemon's config (tasks will never exceed the limit, even with linux's overcommit behavior). I want to keep the limit as high as possible, so as to allow tasks to run and complete, but not so high that pressing up against the limit the box becomes entirely unresponsive, and not so high that the tasks are actually slowing themselves down by bogging down the box. I want to always be able to ssh in.

Is there a formula or technique that I could use to determine how big to set the limit? The best idea I have now is to do a fresh boot of the box without any tasks running and check memory usage (not counting cache/buffers) and assume that's what's needed to keep things running. Then I would subtract that from how much physical memory the box has to get the limit.

closed as too broad by ChrisInEdmonton, fixer1234, DavidPostill, mdpc, Hennes Nov 17 '15 at 14:02

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • It is not possible to answer this question. It would depend on the tasks being run. – ChrisInEdmonton Nov 11 '15 at 14:24
  • @ChrisInEdmonton how is it an impossible question? what kinds of other details would you need to know about the tasks? I think this may be a perfect is the enemy of good sort of situation. I understand there is no perfect solution to this sort of problem, but surely a rough approximation is possible? For example, what is wrong with my proposed method? – Joseph Garvin Nov 11 '15 at 14:49
  • Just turn off swap and let the oom killer handle things. – gogators Nov 11 '15 at 17:46
  • An exact and complete profile of the tasks which will be run. This must include a complete description of the memory profile for those tasks. Without that, the question is unanswerable. – ChrisInEdmonton Nov 11 '15 at 22:01

First of the Answer: There is no easy way to do this.

While it can be done, what you want to do is figure out how much memory your program can use before the system becomes unresponsive. However, this is not just a memory problem, It is a CPU and bandwidth problem as well. Because, even with only a few clients, a super computer would be "unresponsive" to ssh if you were using only a dial-up connection.

The best way to do this is by trial and error. Chose a decent starting point, and add until you start seeing some longer then normal responses.

So if you want a general answer, the system will become unresponsive when it runs completely out of memory and crashes...

Hope this Helps!

Not the answer you're looking for? Browse other questions tagged or ask your own question.