Elasticsearch Understanding and Optimizing Elasticsearch node.processors

By Opster Team

Updated: Nov 5, 2023

| 2 min read

Quick Links

Overview

What are node.processors in Elasticsearch?

Elasticsearch node.processors is a critical configuration parameter that plays a significant role in the performance and efficiency of your Elasticsearch cluster. This parameter determines the number of processor cores that Elasticsearch will utilize for processing search and indexing requests.

By default, Elasticsearch will use all available cores, but this can be manually adjusted to better suit your specific use case.

The Role of node.processors

The node.processors setting is used by Elasticsearch to manage its internal thread pools. These thread pools are responsible for handling various types of tasks such as search, indexing, and bulk operations. By adjusting the node.processors setting, you can control the number of threads that Elasticsearch will allocate for these tasks.

For example, if you have a machine with 8 cores and you set node.processors to 4, Elasticsearch will only use 4 cores for processing. This can be beneficial in scenarios where you want to reserve some of your machine’s processing power for other tasks.

Adjusting node.processors

To adjust the node.processors setting, you can add the following line to your elasticsearch.yml configuration file:

node.processors: <number_of_processors>

Replace `<number_of_processors>` with the number of processor cores you want Elasticsearch to use. After making this change, you will need to restart your Elasticsearch node for the new setting to take effect.

Considerations When Adjusting node.processors

While it might be tempting to simply set node.processors to the maximum number of available cores, this is not always the best approach. There are several factors you should consider when deciding on the optimal setting for node.processors:

1. Other Processes: If your machine is running other resource-intensive processes alongside Elasticsearch, you might want to limit the number of cores that Elasticsearch can use to prevent it from monopolizing your machine’s resources.

2. Type of Workload: The optimal setting for node.processors can also depend on the type of workload your Elasticsearch cluster is handling. For example, if your cluster is primarily handling search requests, you might benefit from allocating more cores to Elasticsearch. On the other hand, if your cluster is primarily handling indexing or bulk operations, you might want to limit the number of cores that Elasticsearch can use to prevent it from overloading your machine’s I/O capacity.

3. Hardware Limitations: The number of cores that you can allocate to Elasticsearch is also limited by your machine’s hardware. If your machine only has a few cores, setting node.processors to a high value will not improve performance and might even degrade it due to context switching overhead. Also setting node.processors to a value higher than the effective number of processors (i.e., as reported by `Runtime.getRuntime().availableProcessors()` when Elasticsearch is launched) will result in an exception being thrown.

Conclusion

In conclusion, the node.processors setting is a powerful tool for optimizing the performance of your Elasticsearch cluster. However, it should be used with care and consideration for your specific use case and hardware limitations. By understanding how this setting works and how to adjust it, you can ensure that your Elasticsearch cluster is running as efficiently as possible.

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?