Monitoring memory usage of an external component

51 views
Skip to first unread message

Marcin Tustin

unread,
Jun 20, 2012, 12:00:07 PM6/20/12
to django...@googlegroups.com
Not strictly a django question, but one I hope someone else here might have faced.

I have an a site which depends on a java web service (of my own creation). This seems to leak memory like a sieve, because of the various libraries involved. This is a problem because my host sets a limit on the total usage of memory by all of my processes.

Does anyone here use a tool to monitor memory usage by individual processes (or groups thereof), and run commands when certain levels are met? I'd like to kill and restart my java service (through supervisor) when it gets above a certain size.

(I know about JVM memory options. These are not really effective for my needs).

--
Marcin Tustin
Tel: 07773 787 105

Cal Leeming [Simplicity Media Ltd]

unread,
Jun 21, 2012, 7:00:42 PM6/21/12
to django...@googlegroups.com
Depending on the web application server you use, this can usually restrict the memory limit for you - uWSGI is a fine example of this.

You can also use the 'poor mans' memory checks by checking the resident memory usage (not sure what that func is in Java), and checking if its over a certain limit.. if it is, then you execute some code. This is a pretty ghetto approach though ;/

You can also do it externally with a process checker, but again that's really designed for shared hosting providers to stop abuse and run away threads.

Hope this helps

Cal

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Eugene Gavrish

unread,
Jun 22, 2012, 3:56:55 AM6/22/12
to Django users
> *Does anyone here use a tool to monitor memory usage by individual
> processes (or groups thereof), and run commands when certain levels are met?
> * I'd like to kill and restart my java service (through supervisor) when it
> gets above a certain size.

simple bash-script with ps aux | grep java lists all your java-
processes. You need VSZ column

So you can write a simple cron-based solution
Reply all
Reply to author
Forward
0 new messages