MeiliSearch/benchmarks
bors[bot] 941af58239
Merge #561
561: Enriched documents batch reader r=curquiza a=Kerollmops

~This PR is based on #555 and must be rebased on main after it has been merged to ease the review.~
This PR contains the work in #555 and can be merged on main as soon as reviewed and approved.

- [x] Create an `EnrichedDocumentsBatchReader` that contains the external documents id.
- [x] Extract the primary key name and make it accessible in the `EnrichedDocumentsBatchReader`.
- [x] Use the external id from the `EnrichedDocumentsBatchReader` in the `Transform::read_documents`.
- [x] Remove the `update_primary_key` from the _transform.rs_ file.
- [x] Really generate the auto-generated documents ids.
- [x] Insert the (auto-generated) document ids in the document while processing it in `Transform::read_documents`.

Co-authored-by: Kerollmops <clement@meilisearch.com>
2022-07-21 07:08:50 +00:00
..
benches Merge #561 2022-07-21 07:08:50 +00:00
scripts Get rid of the threshold when comparing benchmarks 2022-04-19 15:39:58 +02:00
src move the benchmarks to another crate so we can download the datasets automatically without adding overhead to the build of milli 2021-06-02 11:11:50 +02:00
.gitignore add a gitignore to avoid pushing the autogenerated file 2021-06-02 17:03:30 +02:00
build.rs add one nested benchmark 2022-05-02 19:35:57 +02:00
Cargo.toml Bump the milli version to 0.31.1 2022-06-22 17:05:51 +02:00
README.md Merge #357 2021-09-21 16:08:06 +00:00

Benchmarks

TOC

Run the benchmarks

On our private server

The Meili team has self-hosted his own GitHub runner to run benchmarks on our dedicated bare metal server.

To trigger the benchmark workflow:

  • Go to the Actions tab of this repository.
  • Select the Benchmarks workflow on the left.
  • Click on Run workflow in the blue banner.
  • Select the branch on which you want to run the benchmarks and select the dataset you want (default: songs).
  • Finally, click on Run workflow.

This GitHub workflow will run the benchmarks and push the critcmp report to a DigitalOcean Space (= S3).

The name of the uploaded file is displayed in the workflow.

More about critcmp.

💡 To compare the just-uploaded benchmark with another one, check out the next section.

On your machine

To run all the benchmarks (~5h):

cargo bench

To run only the search_songs (~1h), search_wiki (~3h), search_geo (~20m) or indexing (~2h) benchmark:

cargo bench --bench <dataset name>

By default, the benchmarks will be downloaded and uncompressed automatically in the target directory.
If you don't want to download the datasets every time you update something on the code, you can specify a custom directory with the environment variable MILLI_BENCH_DATASETS_PATH:

mkdir ~/datasets
MILLI_BENCH_DATASETS_PATH=~/datasets cargo bench --bench search_songs # the four datasets are downloaded
touch build.rs
MILLI_BENCH_DATASETS_PATH=~/datasets cargo bench --bench songs # the code is compiled again but the datasets are not downloaded

Comparison between benchmarks

The benchmark reports we push are generated with critcmp. Thus, we use critcmp to show the result of a benchmark, or compare results between multiple benchmarks.

We provide a script to download and display the comparison report.

Requirements:

List the available file in the DO Space:

./benchmarks/script/list.sh
songs_main_09a4321.json
songs_geosearch_24ec456.json
search_songs_main_cb45a10b.json

Run the comparison script:

# we get the result of ONE benchmark, this give you an idea of how much time an operation took
./benchmarks/scripts/compare.sh son songs_geosearch_24ec456.json
# we compare two benchmarks
./benchmarks/scripts/compare.sh songs_main_09a4321.json songs_geosearch_24ec456.json
# we compare three benchmarks
./benchmarks/scripts/compare.sh songs_main_09a4321.json songs_geosearch_24ec456.json search_songs_main_cb45a10b.json

Datasets

The benchmarks uses the following datasets:

  • smol-songs
  • smol-wiki
  • movies
  • smol-all-countries

Songs

smol-songs is a subset of the songs.csv dataset.

It was generated with this command:

xsv sample --seed 42 1000000 songs.csv -o smol-songs.csv

Download the generated smol-songs dataset.

Wiki

smol-wiki is a subset of the wikipedia-articles.csv dataset.

It was generated with the following command:

xsv sample --seed 42 500000 wiki-articles.csv -o smol-wiki-articles.csv

Download the smol-wiki dataset.

Movies

movies is a really small dataset we uses as our example in the getting started

Download the movies dataset.

All Countries

smol-all-countries is a subset of the all-countries.csv dataset It has been converted to jsonlines and then edited so it matches our format for the _geo field.

It was generated with the following command:

bat all-countries.csv.gz | gunzip | xsv sample --seed 42 1000000 | csv2json-lite | sd '"latitude":"(.*?)","longitude":"(.*?)"' '"_geo": { "lat": $1, "lng": $2 }' | sd '\[|\]|,$' '' | gzip > smol-all-countries.jsonl.gz

Download the smol-all-countries dataset.