This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

How much is too much memory (heap)  RSS feed

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have Tomcat 6 installed on a dedicated server with 16GB of memory. Tomcat is running an application that could potentially have a couple thousand concurrent users. I was considering allocating up to half of the servers memory to the heap. Is there such a thing as too big of a max heap size. 8GB seems like a lot, but I have no metrics to gauge this. Are there any dangers or performance hits that could result in having too much memory allocated?

thanks
 
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you've got it.. use it! ;)

You did not say which OS you are using though, and that could have impact since other processes will fight for the RAM tooth and claw.

You should definitely profile and run some test cases with different amount of users, 10, 100, 500 etc.
JMeter is good for this, then extrapolate the memory usage. This will give you an idea for capacity planning.


WP
 
Sheriff
Posts: 24369
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

William P O'Sullivan wrote:that could have impact since other processes will fight for the RAM tooth and claw.



Indeed that could be a problem. But if you're running a server of this magnitude it would be prudent to avoid running other processes on it which will compete for resources.
 
David Sheltby
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its a Window Server 2008 environment, so somehow I think a few resource fights will be inevitable. There will not be many other third party services installed on this server though. 8GB to the OS and its buddies seems like a decent amount.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you'll be wanting to utilize 8 GBs of heap space in your application. Unless you don't mind waiting on the garbage collector.
 
David Sheltby
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jelle Klap wrote:I don't think you'll be wanting to utilize 8 GBs of heap space in your application. Unless you don't mind waiting on the garbage collector.


Max recommendation?
 
Saloon Keeper
Posts: 20643
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know that a bigger heap necessarily means a slower garbage collector. YMMV, but last I saw, GCs were being more targeted towards incremental cleanup than the old "freeze-while-I-free-memory" approach.

Too much memory is, quite simply, more memory than you need. If you allocate excess memory and it doesn't get used, you're stealing it from the rest of the system and leaving it idle, which not only reduces what other processes can do, it's a flat waste of the electricity needed to run the memory chips. And/or paging space, depending on your VM configuration.

If you allocate memory and it gets used, but the system will run nearly as efficiently without the extra memory, then you should consider tuning memory settings so that you get the most efficient performance benefits for your JVM while minimizing the impact on the rest of the system.
 
David Sheltby
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:I don't know that a bigger heap necessarily means a slower garbage collector. YMMV, but last I saw, GCs were being more targeted towards incremental cleanup than the old "freeze-while-I-free-memory" approach.

Too much memory is, quite simply, more memory than you need. If you allocate excess memory and it doesn't get used, you're stealing it from the rest of the system and leaving it idle, which not only reduces what other processes can do, it's a flat waste of the electricity needed to run the memory chips. And/or paging space, depending on your VM configuration.

If you allocate memory and it gets used, but the system will run nearly as efficiently without the extra memory, then you should consider tuning memory settings so that you get the most efficient performance benefits for your JVM while minimizing the impact on the rest of the system.


Yes, I think some resource monitoring is in order.

thanks
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim is right, the newer GC processing is quite performant at freeing incrementally unlike the earlier ones, which would freeze everything.

However, depending on the OS (Not sure about Win2008), even though the JVM says "I'm done with this clock", the OS may still lock it for a time.

Do some metric testing, generate reports and you'll do fine. I read some where on Windoze that the rule of thumb was to allocate 1/2 the physical memory,
but that may not be valid now.

WP
 
Tim Holloway
Saloon Keeper
Posts: 20643
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

William P O'Sullivan wrote:

Do some metric testing, generate reports and you'll do fine. I read some where on Windoze that the rule of thumb was to allocate 1/2 the physical memory,
but that may not be valid now.

WP



I think that applies to how much swap space, not how much JVM memory. Somewhere between 50-100% of the physical memory is generally advised for swap memory on modern desktop systems. Back when I worked with batch processes on mainframes, when RAM was much more expensive and interactivity was limited to things like CICS and entire address spaces would swap in and out, the guideline used to be more like 8-to-1 on VM-versus-Real Memory. But you don't see much of that anymore.
 
Squanch that. And squanch this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!