Server Memory Optimization
Memory Leak issue in Linux servers:
SEVERE: NoShardAvailableActionException[No shard available for... EngineClosedException[CurrentState[CLOSED] Closed]; nested: OutOfMemoryError[unable to create new native thread]
One recurrent issue in host machines when running EnterMedia is an Out of Memory error that could be fixed increasing the open files and processes limits for the entermedia user in the host machine and inside the Docker instance.
1. Increse Security limits in host server:
sudo echo "fs.file-max = 10000000" >> /etc/sysctl.conf sudo echo "entermedia soft nofile 409600" >> /etc/security/limits.conf sudo echo "entermedia hard nofile 1024000" >> /etc/security/limits.conf sudo echo "entermedia soft nproc 100000" >> /etc/security/limits.conf sudo echo "entermedia hard nproc 100000" >> /etc/security/limits.conf sudo sysctl -p
2. Open Files and Processes limits inside Docker Instance:
Current EnterMedia docker-build script (curl -o entermedia-docker.sh -jL docker.entermediadb.org) includes necesary settings to increase open files and processes limits inside Docker. You can verify if your instance already includes the setting in the path: /media/instance/100/tomcat/bin/catalina.sh and search for command:
ulimit -u 20000;ulimit -n 1024000
If you are not ready to rebuild your instance with new EnterMedia docker-deploy script you can manually patch your Instance inside Docker at: /user/share/entermediadb/tomcat/bin/catalina.sh
3. Restart
After applying the changes you need to restart the host machine, restarting Docker only does not help.