Files
opensearch-pyd/benchmarks
Daniel (dB.) Doubrovkine 56c96d7c4f Expanded type coverage to benchmarks, samples and tests. (#566)
* Renamed json samples to fix duplicate module name.

Signed-off-by: dblock <dblock@amazon.com>

* Enabled mypy on all source files.

Signed-off-by: dblock <dblock@amazon.com>

* Added missing types.

Signed-off-by: dblock <dblock@amazon.com>

* Added CHANGELOG.

Signed-off-by: dblock <dblock@amazon.com>

* Move type: ignore to fix untyped decorator makes function untyped.

Signed-off-by: dblock <dblock@amazon.com>

* Fix nox -rs lint-3.7.

Signed-off-by: dblock <dblock@amazon.com>

* Fixed incorrect import.

Signed-off-by: dblock <dblock@amazon.com>

* Fix broken test.

Signed-off-by: dblock <dblock@amazon.com>

* Fixed TestBulk::test_bulk_works_with_bytestring_body.

Signed-off-by: dblock <dblock@amazon.com>

---------

Signed-off-by: dblock <dblock@amazon.com>
2023-11-09 10:51:20 -05:00
..
2023-10-13 11:29:54 -07:00
2023-10-13 11:29:54 -07:00
2023-10-13 11:29:54 -07:00
2023-10-13 11:29:54 -07:00

Benchmarks

Python client benchmarks using richbench.

Start OpenSearch

docker run -p 9200:9200 -e "discovery.type=single-node" opensearchproject/opensearch:latest

Install Prerequisites

Install poetry, then install package dependencies.

poetry install

Benchmarks use the code in this repository by specifying the dependency as opensearch-py = { path = "..", develop=true, extras=["async"] } in pyproject.toml.

Run Benchmarks

Run all benchmarks available as follows.

poetry run richbench . --repeat 1 --times 1

Outputs results from all the runs.

                                             Benchmarks, repeat=1, number=1                                              
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃                         Benchmark ┃ Min     ┃ Max     ┃ Mean    ┃ Min (+)         ┃ Max (+)         ┃ Mean (+)        ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ 1 client vs. more clients (async) │ 1.640   │ 1.640   │ 1.640   │ 1.102 (1.5x)    │ 1.102 (1.5x)    │ 1.102 (1.5x)    │
│    1 thread vs. 32 threads (sync) │ 5.526   │ 5.526   │ 5.526   │ 1.626 (3.4x)    │ 1.626 (3.4x)    │ 1.626 (3.4x)    │
│    1 thread vs. 32 threads (sync) │ 4.639   │ 4.639   │ 4.639   │ 3.363 (1.4x)    │ 3.363 (1.4x)    │ 3.363 (1.4x)    │
│                sync vs. async (8) │ 3.198   │ 3.198   │ 3.198   │ 0.966 (3.3x)    │ 0.966 (3.3x)    │ 0.966 (3.3x)    │
└───────────────────────────────────┴─────────┴─────────┴─────────┴─────────────────┴─────────────────┴─────────────────┘

Run a specific benchmark, e.g. bench_sync.py by specifying --benchmark [name].

poetry run richbench . --repeat 1 --times 1 --benchmark sync

Outputs results from one benchmark.

                                            Benchmarks, repeat=1, number=1                                            
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃                      Benchmark ┃ Min     ┃ Max     ┃ Mean    ┃ Min (+)         ┃ Max (+)         ┃ Mean (+)        ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ 1 thread vs. 32 threads (sync) │ 6.804   │ 6.804   │ 6.804   │ 3.409 (2.0x)    │ 3.409 (2.0x)    │ 3.409 (2.0x)    │
└────────────────────────────────┴─────────┴─────────┴─────────┴─────────────────┴─────────────────┴─────────────────┘