-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add Open Distro for Elasticsearch K-NN #6
Merged
jobergum
merged 2 commits into
jobergum:master
from
mnagaya:mnagaya/opendistroforelasticsearch
May 18, 2020
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM amazon/opendistro-for-elasticsearch:1.6.0 | ||
|
||
WORKDIR /usr/share/elasticsearch/ | ||
|
||
COPY config/opendistroforelasticsearch /usr/share/elasticsearch/config | ||
COPY bin/opendistroforelasticsearch/create-index.sh /usr/share/elasticsearch/create-index.sh | ||
|
||
ENV http.port=19200 | ||
ENV opendistro_security.disabled=true | ||
ENV knn.algo_param.index_thread_qty=4 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/bin/sh | ||
docker build . -f Dockerfile.elastic --tag es_benchmark:1.1 --rm | ||
docker build . -f Dockerfile.opendistroforelasticsearch --tag oes_benchmark:1.1 --rm | ||
docker build . -f Dockerfile.vespa --tag vespa_benchmark:1.1 --rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
curl -s -X PUT "localhost:19200/doc?pretty" -H "Content-Type:application/json" -d @config/index.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import requests | ||
import gzip | ||
import os | ||
import concurrent.futures | ||
|
||
def postES(data): | ||
docid,line = data | ||
line = line.strip() | ||
response = requests.post('http://localhost:19200/doc/_doc/%i' %docid, data=line,headers={"Content-Type":"application/json"}) | ||
return response.status_code | ||
|
||
feed_files = [f for f in os.listdir(".") if f.endswith("json.gz")] | ||
feed_files.sort() | ||
docid=0 | ||
nthreads=8 | ||
|
||
ok=0 | ||
notok=0 | ||
with concurrent.futures.ThreadPoolExecutor(max_workers=nthreads) as executor: | ||
for file in feed_files: | ||
with gzip.open(file, 'rb') as f: | ||
futures = [executor.submit(postES,data) for data in enumerate(f)] | ||
for result in concurrent.futures.as_completed(futures): | ||
if result.result() == 200: | ||
ok+=1 | ||
else: | ||
notok+=1 | ||
|
||
print("Feed documents %i - ok %i - not ok %i" %(ok+notok,ok,notok)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/bin/sh | ||
docker run --privileged --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms8g -Xmx8g" -d es_benchmark:1.1 | ||
docker run --privileged --name oes -p 19200:19200 -p 19300:19300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms16g -Xmx16g" -d oes_benchmark:1.1 | ||
docker run --privileged --name vespa -p 8080:8080 -d vespa_benchmark:1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"settings": { | ||
"number_of_shards": 1, | ||
"number_of_replicas": 0, | ||
"index.knn": true | ||
}, | ||
"mappings": { | ||
"dynamic": "false", | ||
"_source": { | ||
"enabled": "false" | ||
}, | ||
"properties": { | ||
"id": { | ||
"type": "integer" | ||
}, | ||
"vector": { | ||
"type": "knn_vector", | ||
"dimension":960 | ||
} | ||
} | ||
} | ||
} |
Empty file.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this only control indexing or also searches? I would rather see this set to 1, especially if it's multi-threaded query execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that knn.algo_param.index_thread_qty parameter is only for indexing.
Ref: https://github.com/nmslib/nmslib/blob/master/manual/latex/methods.tex#L1198-L1205
If we would like to improve write performance then we increase it.