diff --git a/drivers/elastic4.py b/drivers/elastic4.py index bb0b703..9e74c9d 100644 --- a/drivers/elastic4.py +++ b/drivers/elastic4.py @@ -6,7 +6,7 @@ import json INDEX = "threads" -class Elastic_4_Shards_Testing(DB_Testing): +class Elastic_2_Shards_Testing(DB_Testing): driver_name = "ES (4-Shards)" def __init__(self) -> None: super().__init__() @@ -31,7 +31,7 @@ class Elastic_4_Shards_Testing(DB_Testing): 'settings': { 'index': { 'number_of_replicas': 0, - 'number_of_shards': 4 + 'number_of_shards': 2 } } }) diff --git a/main.py b/main.py index 4c4bc59..f048065 100644 --- a/main.py +++ b/main.py @@ -2,7 +2,7 @@ from elasticsearch import Elasticsearch from psycopg2 import connect from drivers.psql import PSQL_Testing from drivers.elastic import Elastic_Testing -from drivers.elastic4 import Elastic_4_Shards_Testing +from drivers.elastic4 import Elastic_2_Shards_Testing from sshtunnel import SSHTunnelForwarder from utils.utils import preprocess_json from typing_extensions import Dict @@ -23,22 +23,22 @@ def test_psql(): def test_elasticsearch(): es = Elasticsearch( - 'http://elastic-tma.docker.tma.coe.int:80', - api_key='VGxhTnhJOEJGM3NDbkpWLVBzUkg6eHE4c3FuclhTWW1sRm9YN0FkWmRMdw==', + 'https://127.0.0.1:9200', + api_key='RVAzeHpvOEJXTnUzZ2RiTkdWX2Q6TksySHBfaEFSWktoQmNPOFFSbm1DUQ==', verify_certs=False, # just to not create certificates ssl_show_warn=False ) return Elastic_Testing().do_tests(es) -def test_elasticsearch_4_shards(): +def test_elasticsearch_2_shards(): es = Elasticsearch( - 'http://elastic-tma.docker.tma.coe.int:80', - api_key='VGxhTnhJOEJGM3NDbkpWLVBzUkg6eHE4c3FuclhTWW1sRm9YN0FkWmRMdw==', + 'https://127.0.0.1:9200', + api_key='RVAzeHpvOEJXTnUzZ2RiTkdWX2Q6TksySHBfaEFSWktoQmNPOFFSbm1DUQ==', verify_certs=False, # just to not create certificates ssl_show_warn=False ) - return Elastic_4_Shards_Testing().do_tests(es) + return Elastic_2_Shards_Testing().do_tests(es) def plot(timings: Dict[str, Dict[str, float]]): @@ -77,7 +77,7 @@ def plot(timings: Dict[str, Dict[str, float]]): plt.text(j + (i * bar_width), v + 0.02, str(round(v, 2)), fontsize=8, ha='center', va='bottom') fig.tight_layout() - plt.savefig("plot-tma-opti.png") + plt.savefig("plot-orodruin-opti.png") plt.show() @@ -91,7 +91,7 @@ if __name__ == "__main__": timings['PSQL'] = test_psql() timings['ES'] = test_elasticsearch() - timings['ES4shards'] = test_elasticsearch_4_shards() + timings['ES2shards'] = test_elasticsearch_2_shards() plot(timings) diff --git a/plot-orodruin-opti.png b/plot-orodruin-opti.png new file mode 100644 index 0000000..6742eb1 Binary files /dev/null and b/plot-orodruin-opti.png differ