1

I am using Apache tomcat 7.02 as a server.I created an application using sphinx4 and deployed it on apache tomcat server.Since this Sphinx4 application requires a lot of memory to execute.So for that purpose i alloted lot of memory as java Heap space(export CATALINA_OPTS="-Xms1536m -Xmx1536m"). The Server on which i have deployed the server is a 64bit System with Debian Lenny on it,along with 2Gb of RAM. I created a Servlet,post data to it,get the results... When i run it for 10 users it takes about 8 minutes to process but if i run it for 100 users simultaneously,thn it shows this on tomcat status

Free memory: 37.0 MB Total memory: 1484.81 MB Max memory: 1484.81 MB

I also tried using System.gc(),but it did no gud.So is there any way through which i can check the memory status of JVM and free it when needed?

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
coderslay
  • 13,960
  • 31
  • 73
  • 121

1 Answers1

4

You need to determine where resources are being using. I suggest you use a memory profiler and change the program to consume less memory.

If you are using a 64-bit JVM you can use the -XX:+UseCompressedOops to reduce memory consumption (it uses 32-bit references instead of 64-bit references)

EDIT: If you cannot tune your application it may be worth considering upgrading your server. A 24 GB server can cost around £1,800 and might allow you to scale to 1000 users without a code change. ;)

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • Hey Peter, Can you suggest me any Good Memory Profiler?... And will -XX:+UseCompressedOops do any good?? – coderslay Feb 09 '11 at 09:14
  • I have used -XX:+UseConcMarkSweepGC...will this have any effect?... I used this parameter to improve concurrency issues... – coderslay Feb 09 '11 at 09:29
  • I suggest you try the option and see. (Only makes a difference on the 64-bit JVM, which one do you have?) VisualVM is a free memory profiler which come with the JDK. I prefer YourKit. – Peter Lawrey Feb 09 '11 at 11:59
  • Concurrent mark sweep doesn't defragment the tenured space so it can decrease you available memory. However changing the options will not make anywhere near as much difference as tuning your application. – Peter Lawrey Feb 09 '11 at 12:03
  • Thanks Pete... YourKit was a Nice Suggestion to find out all the flaws in the App... And Upgrading the Server is also not a bad Option...:) – coderslay Feb 10 '11 at 06:06
  • You can get an 8 GB server for about £850. :P I recently looked at a 1 TB server which cost £55K. lol. – Peter Lawrey Feb 10 '11 at 09:18
  • Dell PowerEdge R910 takes up to 1 TB of memory. 8-) – Peter Lawrey Feb 11 '11 at 07:20