Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Consider a system with limited memory, like a smallish VPS. Suppose there are a handful of processes that need to stay alive, and one process "P" that would be nice to have around, but is not strictly necessary. What I'd like do is keep P around under times of low activity, but when activity picks up beyond a certain threshold, kill off P until activity lowers again, at which time I want P to come back. I'm not sure yet what I'd like "activity" to mean, but it could be any of: memory usage, swap usage, server load values.

I'm already using Monit, so it would be good if this could be accomplished with Monit. Bear in mind that I don't mean process memory usage, I mean overall system load. I don't have to use Monit for this, though, if something else will do the job.

share|improve this question
2  
Can't you just provide enough swap, renice process P to have a lower priority, and just the kernel take care of all this? –  cjc Jan 31 '12 at 18:44
    
I'll give that a try. –  Pistos Jan 31 '12 at 18:56
add comment

1 Answer

Like cjc said, the best way around this would be to provide enough swap to keep all processes running.

If you have many services you want to keep available (but not necessarily alive/running) you might think about inetd-ing them. Then they will be started only when somebody actually connects to a specific port on server. The downside: not all protocols have inetd implementations.

share|improve this answer
    
Thanks for your answer. Not many, just one. –  Pistos Jan 31 '12 at 19:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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