Link to home
Start Free TrialLog in
Avatar of sasha_kv
sasha_kv

asked on

Large JVM memory size.

The application that we are working on requires very fast response times and we are thinking of implementing some caching mechanisms using singleton.

The scary thing is that cache size may be quite large -- approximately 500MB - 1GB.

Question that I have consists of two issues:

1) How JVM would handle such large amount of memory dedicated to it ? Is there any limitations on memory size ?
2) In terms of the speed, shall we expect any performance degradation when JVM deals with such large objects ?

Thank you for your help.
Avatar of kiranhk
kiranhk


1) How JVM would handle such large amount of memory dedicated to it ? Is there any limitations on memory size ?
You can increase the memory size for the JVM using the following
java -Xms256m -Xmx512m


2) In terms of the speed, shall we expect any performance degradation when JVM deals with such large objects ?
If indeed you have so much of data cache the performance really depends on how you actually use the cache. Basically like you might be loading the whole data into memory and for navigating to the required data from the clients perspective depends on how u program to retrieve the data.
Avatar of sasha_kv

ASKER

1) I am familiar how to  increase memory size for JVM. The question here is more conceptual on limitations of memory size.

I've found this quote on the internet and not sure about validity of the this statement:

-- On 32-bit processor machines, the largest contiguous memory address space the operating system can allocate to a process is 1.8GB. Because of this, the maximum heap size can only be set up to 1.8GB. On 64-bit processor machines, the 1.8 GB limit does not apply, as 64-bit processor machines have a larger memory address space."
--

2) Cache mechanism will be implemented using HashMap, where userID (int) would represent a key, and UserVO that contains all the necessary data about a user would represent a value. If desiralized version of UserVO takes up let's say 10kb, then caching 50,000 users would require 500mb of memory. (if my math is correct :)

SOLUTION
Avatar of Tommy Braas
Tommy Braas
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks very much for everyone's input !!!