-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Slow index creation on MacOS #4649
Comments
@diachedelic is this performance degradation only limited to the index creation API ? or you are facing same issue with other APIs? |
I have only noticed it with the index creation API. Populating and querying the index appear to be fast. |
This might result from MacOS's excruciatingly slow implementation of the If so, these would be the hot lines:
|
From the ElasticSearch folks:
I am not using a modern Mac, but it seems plausible that this also affects older Macs. |
@diachedelic You can test it by commenting out that line. Obviously don't do this in production ;) |
I'm afraid I can't get OpenSearch to build:
|
You need a newer JDK, see https://github.com/opensearch-project/OpenSearch/blob/main/DEVELOPER_GUIDE.md |
The hot paths might as well be outside IOUtils.java as well. OpenSearch/server/src/main/java/org/opensearch/index/translog/TranslogWriter.java Line 510 in d8e7d87
|
@dblock What version are you using? I am using JDK 18. |
That would be JDK 8 in your output (1.8 is JDK8, 18 would be 18.0....). Set
|
Thank you, that was silly of me. I commented out Edit: also TranslogWriter.java |
Thanks @diachedelic, sounds like we'll need more profiling! @andrross or @mch2 do you have any suggestions of how to properly construct a benchmark or an existing benchmark that can be run to narrow this down? |
@diachedelic I'd recommend using Java Flight Recorder to profile the VM running OpenSearch. Then just use a simple script calling create index in a loop, something like:
The profiling data generated by Java Flight Recorder will hopefully show what is being slow. |
I have had a go with the Java Flight Recorder. My benchmark was to create 10 indexes concurrently - and it took about 20 seconds! Even so, nothing jumps out at me when I view the log in JDK Mission Control. There is this:
But it can't be right - throughout the benchmark, Activity Monitor.app showed 8GB free. The OpenSearch process never went above 23% CPU or 1.25GB memory. I've attached the Flight Recorder data if somebody else would like to take a look. |
I also noticed this in OpenSearch's output:
I mean, I have 13GB free disk space so it's not like OpenSearch is actually running out of space. But maybe it has something to do with it? |
@diachedelic Can you try this again where you're below that 95% threshold? It is possible that it is related. |
I reduced my disk space usage to 81% (below both the high and low watermarks) but I did not see any improvement. |
Here are some benchmark results. Each run consists of creating MacOS build:
Linux build, running inside the Docker VM:
|
Describe the bug
It takes ten times longer to create an index (
PUT /my_index
) using the MacOS build of OpenSearch than in Docker.Attempting to create several indexes at once ends up taking several times as long as creating a single index, yet OpenSearch's process does not seem to be CPU or memory bound. There do not appear to be any errors or warnings in the log.
This is not a problem in production, but it is slowing down our automated tests in development.
To Reproduce
Steps to reproduce the behavior:
brew install opensearch
time curl -XPUT localhost:9200/my_index
Output:
docker pull opensearchproject/opensearch:latest
docker run -p 9200:9200 -e "discovery.type=single-node" -e "plugins.security.disabled=true" opensearchproject/opensearch:latest
time curl -XPUT localhost:9200/my_index
Output:
Expected behavior
I would expect the MacOS build to create indexes much faster than the Docker container, seeing as the container is running in the Docker Desktop VM.
Plugins
I used the default installation.
Host/Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: