I use ElasticSearch to store some datetime based data. Data of each day is stored as a index. The total storage of 75 is about 600GB.
when ElasticSearch startup, the proccess's VIRT is up to 145GB. Then when I do lots of aggregation, the proccess's RES and SHR continue growing up quickly. After RES reach 40GB, it will cause the sy CPU growing upto 90% and stay at this level.
At that time, the server become very slow and need a long time to respone any command. All I can do is to kill the proccess and restart it.
What can I do to solve this problem? anybody have had the same problem?
Detail as below:
One server, 64GB RAM
config as one node, Heap size Max 16GB, Direct Memory Max 16GB
This Problem has solved after I use niofs instead of mmapfs.
I have too much data , so the total storage of index files is very big. And my search/aggregation requests will use much of these data. In another word , the working set or the hot data for read is too big.
So if I use mmapfs, it will load many pages of index files into mem.
And after the mem usage exceed a threshold, if you need more file into mem, but mem is not enough, it will cause sys to do swap.
This kind of swap seems not to be controled by the mlock. It use lots of sys cpu, so the system can't respene for anything.
If your working set or hot data is bigger than the capacity of mem, I suggest you use niofs intstead of mmapfs.
You do not need to store all your data in memory, if you do(or think you do, then perhaps you should consider an in-memory data store.
ES will work perfectly fine with more data than memory.
In fact, mmapfs use mmap to enhance reading speed of index file. But after mapping the file, whether to load the file into mem, it is decided by the OS, not es. Once you access the file for the first time, it will be loaded into mem.
so after more and more cold data for the first time, the usage of mem is growing and finnally cause swap. I think you can try this situation.
I use memory_lock setting to lock the mem use by JVM, but the mem used by mmap seems to be one kind of share memory, and it is not controlled by this setting.
I didn't try the swapoff command. I don't what will happend when the growing mem usage meet the swapoff.
mongodb also use mmap. it also have this problem when hot data it is bigger than memory