Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play server memory usage

I have installed Play on OSX 10.6 and wanted to test the baseline memory usage. I read the deployment documentation and noticed that running Play behind a reverse proxy server is suggested. What I have seen when I run play run myApp which basically prints hello world is this:

Initial memory usage when started is:
10345    java   user    0.1 22  71.5 MB Intel (64 bit)

after a few several thousand hits, it grows substantially to:
10345    java   user    0.1 26  123.7 MB    Intel (64 bit)  

Which is fine and all, but it slowly creeps up to 140MB after few thousand more
test requests.

My question is targeted at the above amount of memory and if these numbers are normal. I was looking at the amount of java memory playapps.com offers and going by my findings suggests that my HelloWorld app will not fit in 64MB base plan.

How can that be ? Is there a production version of play run MyApp that doesn't enable development related features ?

like image 947
Arek B. Avatar asked Dec 21 '22 14:12

Arek B.


2 Answers

Have you tried running you app using the -Xmx64m switch (set "jvm.memory= -Xmx64m" in application.conf). I have been doing a lot of memory analysis of Java recently, and it is often lazy about garbage collection. If the max memory size is not restricted, it does not always fight to keep the memory size low.

Running in prod mode will help, as it does not have the compiler overhead.

Play website does run on the smallest playapps server, which is 64Mb, and that is far more complex than hello world example you give. So smallest playapps should be fine!

like image 173
Codemwnci Avatar answered Feb 16 '23 01:02

Codemwnci


yes, you can run play in production mode via config setting:

%production.application.mode=prod

or via command line:

play run --%production <project>

I know (it's in some post in the Play Framework Google group) that the official page of the project is running in the small instance of Playapps.net and averages 100k visits per day (something like that, my memory can be faulty!) and it works fine as you can appreciate.

like image 21
Pere Villega Avatar answered Feb 16 '23 00:02

Pere Villega