Multiple shards on single machine performance

2019-09-07 17:51发布

问题:

Does it make sense to have multiple shards in Elasticsearch if I am going to use only single machine? Will it improve performance in any way?

Same question for Apache Solr - does it make sense to use Solr Cloud with ZooKeeper for single server instance or just create one core without any sharding?

Let's assume I am not going to use other machines in future, so the main point is how sharding on single machine influence search engines performance?

回答1:

There are certain parts of Lucene that's singlethreaded, having multiple nodes or shards, even on a single computer, might give better performance under certain conditions. Caches will also be for each instance, which would increase memory requirements (exactly how much depends on how you structure your instances).

This will probably not be relevant for your use case, and it'll be easier to reindex when you get into a situation where that might be an issue anyway, instead of adding complexity to a non-complex situation.

It's (almost) always better to have a strategy for easy reindexing of data, so that you can experiment and change core properties later when you find out that the assumptions you made are wrong.