Changing java heap size Ubuntu 12.04

For help and support with issues specific to Linux/Unix
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply.

Changing java heap size Ubuntu 12.04

Postby ssjwizard » Fri Jul 26, 2013 12:47 am

So I am testing PMS under Ubuntu 12.04 right now and while for the most part its working well I will need to increase the heap size once I put this into full operation. Currently my main media server is my personal desktop and to allow streaming to 3 devices at once I needed to increase the heap size to 1500MB under windows 7, so I know that I will need to do the same with ubuntu when I fully deploy my new standalone server.

So how does one change the java heap size for PMS under ubuntu?
ssjwizard
 
Posts: 14
Joined: Sat Jun 01, 2013 2:27 am

Re: Changing java heap size Ubuntu 12.04

Postby ExSport » Fri Jul 26, 2013 10:03 am

On Windows I am using:
Code: Select all
javaw -XX:-UseLargePages -Xshare:on -Xmx2048M -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -classpath update.jar;pms.jar net.pms.PMS

Just try to start (or similar command on Linux):
Code: Select all
javaw -XX:-UseLargePages -Xshare:on -Xmx2768M -version

XMX defines heap size. If it is too high, you will see info about it so lower it.
Also UseLargePages and xshare:0n is optional. I am just testing it right now for better performance 8-)
Anyway on Windows with Java 7 these combination of params generates warning that it can't be used together so one of them is disabled.
It is fixed in new version of Java v8: http://bugs.sun.com/view_bug.do?bug_id=8007018
EDIT:
Sometimes I spotted that when Xshare:on was used and app was started many times in short time it generated error message "Unable to use shared archive".
Changing xshare:on to xshare:dump freed the lock/memory again so xshare:on started to work again...
ExSport
 
Posts: 2167
Joined: Mon Jan 19, 2009 5:40 pm

Re: Changing java heap size Ubuntu 12.04

Postby gtg732w » Fri Aug 23, 2013 3:17 am

One trick we use a lot for larger applications is to set the max and min heap sizes to the same amount. If you set only the max heap size, Java will periodically grow as necessary, but when it is allocating heap Java has a difficult time serving users. Setting the min and max heap sizes to the same value forces Java to allocate the heap up front so you don't see this delay while the app is serving your media.

If you use
Code: Select all
 -Xms 2048m -Xmx 2048m


with all of your other options it should work.
gtg732w
 
Posts: 1
Joined: Fri Aug 23, 2013 3:04 am


Return to Linux/Unix Support

Who is online

Users browsing this forum: Bing [Bot] and 4 guests