Tookmund / Swapspace

A fork of Jeroen T. Vermeulen's excellent dynamic swap space manager
GNU General Public License v2.0
128 stars 12 forks source link

Feature request - total max swapfile size #17

Closed gobonja closed 4 years ago

gobonja commented 4 years ago

Hi, Could you add option for total maximum swapfile size?

I am also using Early OOM and since swapspace doesn't have limit for creating swapfiles Early OOM never gets triggered. This behavior is fine in most cases but so it happens that nodejs apps can have memory leaks so potentially swapspace could create 30+ GB swaps which is unnecessary.

Thanks in advance!

Tookmund commented 4 years ago

If you have an idea of the maximum amount of swap you want and don’t want your disk filled with swapfiles, you’re using the wrong tool. Swapspace tries really hard to avoid OOM at all costs so actually triggering it after a threshold is kinda counterproductive.

You’re probably better off just allocating a static swapfile or a swap partition of whatever you think the max size should be.

Jacob

On Jan 10, 2020, at 04:43, gobonja notifications@github.com wrote:

 Hi, Could you add option for total maximum swapfile size?

I am also using Early OOM and since swapspace doesn't have limit for creating swapfiles Early OOM never gets triggered. This behavior is fine in most cases but so it happens that nodejs apps can have memory leaks so potentially swapspace could create 30+ GB swaps which is unnecessary.

Thanks in advance!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

gobonja commented 4 years ago

You are right. I didn't think of it that way. I always thought that if some process takes more than 10gb of memory on desktop that something is wrong with that process and it should be stopped.

Thanks for the quick reply.

Best regards

Tookmund commented 4 years ago

I mean you’re probably correct, Swapspace is just the wrong tool to be enforcing those limits.

I would recommend setting some reasonable max value with ulimit -m instead

Jacob

On Jan 10, 2020, at 14:11, gobonja notifications@github.com wrote:

 You are right. I didn't think of it that way. I always thought that if some process takes more than 10gb of memory on desktop that something is wrong with that process and it should be stopped.

Thanks for the quick reply.

Best regards

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

gobonja commented 4 years ago

Great idea with ulimit. I didn't think of that. Thank you! btw. Great job with swapspace!