How are you running XP? Are you running it from the docker image? This documentation page says that a good rule of thumb is to set heap size to 30% of available memory and never above 26GB:
I’ve set environment variable to 15G (XP_OPTS=-Xms15G -Xmx15G)
Then reloaded xp service.
But still I’m getting Elastic (Timeout waiting for task) errors such flllowing:
Caused by: org.elasticsearch.ElasticsearchTimeoutException: Timeout waiting for task.
Apr 05 14:38:35 nginx-2 server.sh[388389]: at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:70)
Apr 05 14:38:35 nginx-2 server.sh[388389]: at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:62)
Apr 05 14:38:35 nginx-2 server.sh[388389]: at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:52)
Apr 05 14:38:35 nginx-2 server.sh[388389]: at com.enonic.xp.repo.impl.elasticsearch.storage.StorageDaoImpl.getById(StorageDaoImpl.java:181)
Apr 05 14:38:35 nginx-2 server.sh[388389]: at com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl.doGetById(BranchServiceImpl.java:172)
Apr 05 14:38:35 nginx-2 server.sh[388389]: at com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl.getFromCache(BranchServiceImpl.java:277)
Apr 05 14:38:35 nginx-2 server.sh[388389]: at com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl.doGetByPath(BranchServiceImpl.java:241)
Apr 05 14:38:35 nginx-2 server.sh[388389]: at com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl.get(BranchServiceImpl.java:196)
Apr 05 14:38:35 nginx-2 server.sh[388389]: at com.enonic.xp.repo.impl.storage.NodeStorageServiceImpl.get(NodeStorageServiceImpl.java:300)
Although now I have enough free RAM on server (about free 13G), but application become unavailable time-to time and I’m getting Timeout waiting for task exceptions.
What can be the reason of ElasticsearchTimeoutException and how to fix that ?
Can it be because of large data?
This is most likely related to your application, possibly you have created unbounded queries or similar that fill up memory. Ensure you have strict count limits for hits etc.