Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add insert benchmarks comparing myxql/postgrex/exqlite #111

Merged
merged 1 commit into from Mar 17, 2021
Merged

Conversation

kevinlang
Copy link
Member

@kevinlang kevinlang commented Mar 17, 2021

These benchmarks are forked from ecto_sql.

I only ran the Insert benchmarks, so will need to update the other benchmarks at some point and run them too. Was interested in Insert since SQLite can only have one active writer. I knew that SQLite in WAL mode was faster than most know, but the results nevertheless surprised me.

Results from running:

MIX_ENV=bench mix run bench/scripts/macro/insert_bench.exs 
##### With input Changeset #####
Name                     ips        average  deviation         median         99th %
Exqlite Insert       7759.47       0.129 ms    ±33.34%       0.118 ms        0.24 ms
Pg Insert             486.46        2.06 ms     ±9.79%        2.03 ms        2.61 ms
MyXQL Insert          266.38        3.75 ms    ±10.71%        3.72 ms        5.32 ms

Comparison: 
Exqlite Insert       7759.47
Pg Insert             486.46 - 15.95x slower
MyXQL Insert          266.38 - 29.13x slower

##### With input Struct #####
Name                     ips        average  deviation         median         99th %
Exqlite Insert       8710.79       0.115 ms    ±30.08%       0.104 ms        0.23 ms
Pg Insert             485.47        2.06 ms     ±9.74%        2.04 ms        2.64 ms
MyXQL Insert          264.55        3.78 ms    ±37.33%        3.70 ms        5.58 ms

Comparison: 
Exqlite Insert       8710.79
Pg Insert             485.47 - 17.94x slower
MyXQL Insert          264.55 - 32.93x slower

Wow!

@kevinlang
Copy link
Member Author

Specs:

Operating System: Linux
CPU Information: AMD Ryzen 7 PRO 4750U with Radeon Graphics
Number of Available Cores: 16
Available memory: 14.92 GB
Elixir 1.11.3
Erlang 23.2.6

Disk is a 1TB Sabrent Rocket Q SSD.

@warmwaffles
Copy link
Member

That is amazing.

Did you try it without WAL?

@kevinlang
Copy link
Member Author

kevinlang commented Mar 17, 2021

Nope, I'd be curious to see that too, just for comparison, even if I can't think of situations I wouldn't use WAL.

I hope to fix up the rest of the benchmark tests and run each test suite for comparison, probably once the rest of the main "1.0" functional issues are done. The "micro" ones they have around testing how long the adapter takes to build up the query is pretty interesting, too.

The main reason I wanted this driver was for use in moderate size applications, but was quite worried about the insert speed. It's good to know that this little database can truly handle 99% of load profiles :)

@warmwaffles
Copy link
Member

Yea I'm excited for it.

Wondering if we should pull together a docker compose file to benchmark the library repeatedly.

@warmwaffles warmwaffles merged commit e67d395 into main Mar 17, 2021
@warmwaffles warmwaffles deleted the kcl-bench branch March 17, 2021 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants