Skip to content

Add OS-level performance tuning for Elasticsearch #60

@Oddly

Description

@Oddly

Description

The Elasticsearch role should optionally configure OS-level settings required for production deployments. Currently these must be handled externally (e.g. in the playbook or a separate OS role).

Settings to consider

Critical (bootstrap checks)

  • vm.max_map_count = 262144 — required for mmapfs, ES refuses to start without it
  • vm.swappiness = 1 — prevent JVM heap from being swapped to disk
  • File descriptors (LimitNOFILE >= 65535) — already in RPM systemd unit
  • Thread count (LimitNPROC >= 4096) — already in RPM systemd unit
  • LimitMEMLOCK=infinity — already handled by the role when elasticsearch_memory_lock: true

Strongly recommended

  • Disable Transparent Huge Pages (/sys/kernel/mm/transparent_hugepage/enabled = never)
  • net.ipv4.tcp_retries2 = 5 — faster TCP timeout for cluster fault detection (~13s instead of ~15min)

Nice-to-have

  • tuned profile throughput-performance — CPU governor, readahead, network buffers
  • I/O scheduler: none for SSD, mq-deadline for HDD
  • Network buffer tuning (somaxconn, rmem/wmem_max)

Suggested approach

Add an optional boolean (e.g. elasticsearch_os_tuning: false) that, when enabled, applies the critical and recommended sysctl settings via ansible.posix.sysctl and disables THP. This keeps the role self-contained for users who don't have a separate OS tuning role.

The tuned profile and I/O scheduler could be separate opt-in variables.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions