Skip to content

Simply Watch Memory of any process or group of process and do something with them.

License

Notifications You must be signed in to change notification settings

robotarmy/weasel

Repository files navigation

Weasel

Simple memory monitor - used in production with passenger to limit uptime of a service using excessive memory - as happens with ruby-1.8.7 on non ree projects

see ./bin/weasel for all the arguments that it takes

Example

weasel –callback “%x{kill -USR1 #{pid.to_s}}” –watch “Rails:” – num_cycles 3 –num_over_marks 2 –callback_message ‘sending SIGUSR1’ –high_water_mb 440 –delay 1

the above will send sigusr1 (graceful exit) to all the processes matching 'Rails' that run over 440MB 2 out of 3

samples.

Samples are taken a total of 3 times with a delay of 1 second between them.

Put this in a cronjob to run every minute and you have a very simple, robust way to reap overmemory processes.

You can also combine this nicely with services that use daemontools if you don't want to write complex restart / shutdown code.

Contributor

Ben Somers - 1.9 support and production friendly test support

Fin

Copyright © 2010 Curtis Schofield. See LICENSE for details.

About

Simply Watch Memory of any process or group of process and do something with them.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages