What are Elasticsearch hardware tuning best practices?

Answer

Key hardware and JVM tuning rules for Elasticsearch: Heap size — set the JVM heap to 50% of available RAM, with a maximum of 30–31 GB (above this, the JVM switches from compressed object pointers to full 64-bit pointers, wasting memory). The remaining 50% is used by the OS for the Lucene file system cache, which is critical for performance. Storage — use SSDs for hot data; spinning disks cause severe latency for random I/O. Disable swap — swapping Elasticsearch heap to disk causes extreme latency; use bootstrap.memory_lock: true and set ulimit -l unlimited. File descriptors — set to at least 65536. Virtual memory — set vm.max_map_count=262144 for Lucene's use of memory-mapped files.