본문 바로가기

IT-Consultant

How to improve elasticsearch performance

However, if any of your Java heap is sitting in swap, it can really 
affect performance, and it is worth doing some work to make sure that 
you never touch the swap. 

Linux can put some data into swap even when there is plenty of free 
memory. 

You may already be doing this, but just in case, here is how I would set 
things up: 

1) If you have eg 8GB of memory available on your box to run ES, I would 
   use 50-60% of that for ES itself, and leave the rest for kernel 
   filesystem caches etc 

2) Set your ES_MIN_MEM and ES_MAX_MEM to the same value (eg 4GB) 

3) Set "ulimit -l unlimited" before starting ES - this gives the ES 
   process permission to lock memory.   

   I run ES as user 'elasticsearch' and I have this line in 
   '/etc/security/limits.conf': 

       elasticsearch     -    memlock    unlimited 

4) Add "boostrap.mlockall: 1" to your config file, to tell ES to lock 
   the memory 

If ES is the only service you have running on the box, you may just want 
to set swapoff -a