• Post Reply Bookmark Topic Watch Topic
  • New Topic

How directly count of classes in the app affect memory allocation ?

 
Sagar Veeram
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just wanted to get an quick insight into how number of classes will affect memory settings. Point in question switching to another framework and the no of classes has increased by 6 folds. So just wanted to know how should we adjust memory settings ? Any help is greatly appreciated.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12342
39
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The number of classes has gone up, or the number of objects? a program can use a single class, but if you create a billion objects, it's gonna use a lot of memory.

Have you used a memory profiler to see what's going on? Have you seen performance issues with the new framework? Do you have documented performance requirements?

 
Sagar Veeram
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is little more background. I am in initial process of evaluating the performance overhead with the new framework.

Memory configuration -Xms128m -Xmx512m -XX:MaxPermSize=256m . I understand I have to change the memory settings accordingly which I will once I know the right numbers.

The changes are part of web mvc migration effort. JConsole shows number of classes has increased by over 500% ( all of it are new framework classes including all the dependencies ). The heap memory usage and CPU usage has gone up considerably but nothing alarming. The server start up time also have increased by about 60-80 seconds. The garbage collection happens at least 15 times before I get the server is ready message and also quite a few times when the app is running. Is this something I should be worried about for now ?

All the increase in number of objects should all be from new framework classes. I would like to understand on how to evaluate the performance better meaning what all things I should be looking for. I understand its a big area to cover but some pointers will definitely help me.

Appreciate the earlier reply.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12342
39
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Always start with your requirements. How many requests should it be able to handle per minute? Does it?
How quickly should it respond to each request? Does it?
etc...

you can tweak settings all day long, but unless you have a specific goal to achieve, how will you know when you are done?
 
Sagar Veeram
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I couldn't agree more with you there, but the fact of the matter is the application under load has acceptable response time. It is the server start up time that is of little concern here. How do I sped up the server start -up time based on the JConsole findings mentioned in the last post ? Also, I would like to know why the garbage collection happening at all during the start up. Please advise.
 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
General

i) Turn on trace class loading from the java command line to see which classes are loaded.
ii) turn on gc logging and look at the results in gc viewer.
iii) Get a hprof using jmap or jcmd (in your jdk) and examine the results in visualvm (in your jdk) or EclipseMat (free). In Eclipse mat run the leak suspects report.


For performance always set Xmx to same value as Xms.

If you have a huge number of classes (and have to have) set -XX:PermSize also (same value as max) each resize of permgen will full GC, you should be able to see this in your GC logs.

After that you are really into tuning the collector but its very dependent on what collector you are using ;-)

Good Luck.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12342
39
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is server start-up time an issue? How often does that happen? I mean, generally, don't you start the server once, then walk away for weeks or months at a time?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!