Skip to content

Instantly share code, notes, and snippets.

@otoolep
Created November 8, 2021 17:27

Revisions

  1. otoolep created this gist Nov 8, 2021.
    51 changes: 51 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    Start node:

    $ rqlited data

    Create and insert some data:

    $ curl -XPOST 'localhost:4001/db/execute?pretty&timings' -H "Content-Type: application/json" -d '[
    > "CREATE TABLE foo (id INTEGER NOT NULL PRIMARY KEY, name TEXT, age INTEGER)"
    > ]'
    {
    "results": [
    {
    "time": 0.000154929
    }
    ],
    "time": 0.010213863
    }
    $ curl -XPOST 'localhost:4001/db/execute?pretty&timings' -H "Content-Type: application/json" -d '[
    > "INSERT INTO foo(name, age) VALUES(\"fiona\", 20)"
    > ]'
    {
    "results": [
    {
    "last_insert_id": 1,
    "rows_affected": 1,
    "time": 0.000072691
    }
    ],
    "time": 0.016080437
    }

    (do the above a few time)

    Then run two instances of rqbench *in parallel*:

    $ ./rqbench -n 100000 -p "/db/query" 'SELECT COUNT(*) FROM foo'
    Test target: http://localhost:4001/db/query
    Total duration: 23.965082044s
    Requests/sec: 4172.74
    Statements/sec: 4172.74

    ./rqbench -n 100000 -p "/db/query" 'SELECT COUNT(*) FROM foo'
    Test target: http://localhost:4001/db/query

    Total duration: 24.019902206s
    Requests/sec: 4163.21
    Statements/sec: 4163.21

    I see thousands of queries serviced per second. Check out the source of rqbench.

    https://github.com/rqlite/rqlite/tree/master/cmd/rqbench