• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

What is Java using all that RAM for?

Big Dan

Active member
#1
Before installing elastic search and Java, my forum was running fine on a VPS with 1 GB RAM. Today, I noticed RAM utilization was around 90% so I had my host double the RAM. I'm now running 2 GB of RAM and Java is still eating up 50% of RAM and I'm swapping. What gives? There is no way this site needs anywhere near 2GB of RAM to run.

java.PNG

Code:
 free -m
             total       used       free     shared    buffers     cached
Mem:          1869       1802         66          0        111        534
-/+ buffers/cache:       1157        712
Swap:          511         44        467
 

MattW

Well-known member
#5
Also, you have
-/+ buffers/cache: 1157 712

That's 712MB of actual RAM free on the VPS, so it shouldn't be swapping with that.
 

Big Dan

Active member
#6
What did you allocate in the ES config?
I didn't do the install myself. I hired it out. Is /elasticsearch/config/elasticsearch.yml the proper file? If so everything reguarding memory is commented out.

Code:
################################### Memory ####################################

# ElasticSearch performs poorly when JVM starts swapping: you should ensure that
# it _never_ swaps.
#
# Set this property to true to lock the memory:
#
# bootstrap.mlockall: true

# Make sure that the ES_MIN_MEM and ES_MAX_MEM environment variables are set
# to the same value, and that the machine has enough memory to allocate
# for ElasticSearch, leaving enough memory for the operating system itself.
#
# You should also make sure that the ElasticSearch process is allowed to lock
# the memory, eg. by using `ulimit -l unlimited`.
 

Big Dan

Active member
#7
Also, you have
-/+ buffers/cache: 1157 712

That's 712MB of actual RAM free on the VPS, so it shouldn't be swapping with that.
I'm not very familiar with how to read that - Why is it telling my I only have 66 free then in the line above.
 

MattW

Well-known member
#8
free -m will tell you how much ram is being used. The first thing with Linux is that it will use as much ram as possible, but you have things cached. You have 712MB free to use by other applications is required.

http://www.linuxatemyram.com/

This is the file where you set how much ram to use

/elasticsearch/bin/service/elasticsearch.conf
 

Big Dan

Active member
#9
free -m will tell you how much ram is being used. The first thing with Linux is that it will use as much ram as possible, but you have things cached. You have 712MB free to use by other applications is required.

http://www.linuxatemyram.com/

This is the file where you set how much ram to use

/elasticsearch/bin/service/elasticsearch.conf
Thanks Matt. I ran Ubuntu on my desktop for quite a while and never realized how Linux handled RAM. Neat site BTW. :)

set.default.ES_HEAP_SIZE=1024 is waht's there - I guess that's 1GB which is more than enough - is it wise to lower it or just leave it alone?
 

MattW

Well-known member
#10
I've lowered mine down to 256MB based on 250,000 posts, which with the figures previously mentioned by @Slavik should be good to 500,000 now with the new mapping.

You'd be fine lowering it down to 512mb and restarting ElasticSearch.
 

Luke F

Well-known member
#11
Also, you have
-/+ buffers/cache: 1157 712

That's 712MB of actual RAM free on the VPS, so it shouldn't be swapping with that.
Unless configured otherwise, linux will swap underused/leaked pages way before it runs out of physical ram