Just a quick question on the memory usage of the play framework.
I have a production instance, which appears to use 680768 kB of memory. Most of it is located in the swap.
The (virtual) server has about 750 MB, but also runs the MySQL server and 12 Apache virtual servers. Sometimes becomes temporary unrespondent (or very slow) for short periods.
I guess it is because of the swapping (it is not the CPU).
Does the framework need that much memory?
I could limit the memory usage with a JVM parameter -Xmx256m or so, but what value to put in, and what is the reason it uses so much memory?
This is the usage by Play! before and after start:
Java: ~~~~~ Version: 1.6.0_26 Home:
/usr/lib/jvm/java-6-sun-1.6.0.26/jre
Max memory: 194641920 Free
memory: 11813896
Total memory: 30588928
Available processors: 2After restart: Java: ~~~~~ Version: 1.6.0_26 Home:
/usr/lib/jvm/java-6-sun-1.6.0.26/jre
Max memory: 194641920 Free
memory: 9893688
Total memory: 21946368
Available processors: 2
It depends on a lot of things but yes java need some memory for native allocation, the heap and the non heap memory space.
Play status says that your heap consumes only 30588928 bytes but at startup java allocates 194641920 for the heap. You can try to start with -Xmx64M to limit heap allocation.
You can then save about 128 Mo of RAM but, java also allocates memory for the jvm, so the footprint of the process will be more than 64 Mo, it depends on your platform but it will be at least 200/250 Mo.
Try with limiting your heap to 64Mo but 750 Mo may not be enough to run the jvm and mysql.
Have in mind that you must not use swap with java because memory is allocated in one block so you swap in/swap out the entire heap.