SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Generate fake data for further analysis

Open mamcx opened this issue 11 months ago • 1 comments

Description of Changes

Create a reducer in modules/benchmarks/src/synthetic.rs that executes loading of rows for several variations:

NOTE TO REVIEWER: Wanna confirm if the ones in this pr are enough or wanna more variations.

Examples:

❯ ./run_standalone_temp.sh

# In other terminal...

❯ cargo run --bin spacetimedb-cli publish quickstart -c -p modules/benchmarks

❯ cargo run --bin spacetimedb-cli  call quickstart load 'Large, Many, 100'

The input is a string with the following format:

`load_type`: [`Load`], `index_type`: [`Index`], `row_count`: `u32`

pub enum Load {
    Tiny,
    Small,
    Medium,
    Large,
}

pub enum Index {
    One,
    Many,
}

There is now a simple load tool in SpacetimeDB/crates/bench/load.py:

❯ python3 load.py -d quickstart -f 2 -s 10 -i "insert_bulk_small_rows 100" -l "queries 'small, inserts:10,queries:10,deletes:10';"
Running load testing for database: quickstart
    Frequency: 2.0 calls/second, Duration: 10.0 seconds

Init reducers for database: quickstart ████████████████████ 1/1  insert_bulk_small_rows 100
Load reducers for database: quickstart █████████........... 9/20  queries 'small, inserts:10,queries:10,deletes:10'

The -i 'initialize' / -l 'load' allows to call arbitrary reducers separated by ;

API and ABI breaking changes

None

Expected complexity level and risk

1

Testing

  • [x] Run manually the new bin and inspect the generated .spacetime database
  • [x] Run load.py with benchmarks (Rust)
  • [x] Run load.py with benchmarks-cs (C#)

mamcx avatar Jan 22 '25 21:01 mamcx

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 03 '25 18:05 CLAassistant