-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
performances vs PgSQL #23061
Comments
Hi @Fale! Thanks for your interest in CockroachDB. Meanwhile, you are doing two 'something that make the test "wrong"':
Finally, note the following:
|
Thanks :). I've done more benchmarks, using version 2.0-alpha.20180212: The first one still with the three nodes on the same machine:
Speed is very similar to version 1.1.5, at least in those tests. Then I moved to a single node cluster and I got:
Performances are better, but stil 2.5~3x PgSQL. |
Hi @Fale, one thing you might want to try is parallelizing your requests over multiple client connections. One thing that we do know is that we have worse latencies that PG, but are able to keep up in throughput. In this setup, the higher latencies are causing a throughput decrease as well. |
Those results are not surprising... Your comparing a database ( PostgreSQL) that has had 21 years of development and is highly optimized for single system performance. If you go back 8 years in time, PostgreSQL lost hard to even MySql in every benchmark. They did a great job at fixing postgresql its performance issues. Compare this to CockroachDB that is barely 3 year old. And has a totally different design philosophy. CockroachDB is power is not speed. Its the ability to get a replicating, sharding database up and running with minimal effort. CockroachDB has lots of nifty features. Its the same reason why a lot of people started using PostgreSQL in the past. Because PostgreSQL was able to do things, that Mysql did not do ( or did not follow the standards ). I doubt that CockroachDB will ever get the same performance in single system performance compared to PostgreSQL / Mysql. The real gain is again the ability to easily scale with more databases horizontally and still have a secure system for your data. Try clustering on PostgreSQL vs CockroachDB and your results will be much more interesting. That is after you spend a few hours setting up clustering on PostgreSQL. Watch what happens when a PostgreSQL master or a slave drops. Or try having Master - Master on PostgreSQL. 👎 Think of it like this: What is more valuable. The money you spend on a extra server or the money you spend on a database engineer. The extra server is maybe 100 a 200$ per month, where as the database engineer is going to be way more. If your planning on running a single server website, then stick with MySQL / PostgreSQL / ... as they are heavily optimized the last 20 years for that task. If your goal is to expand your hosting horizontally, then MySQL / PostgreSQL / ... are really not the best choice. |
@Fale, thanks for bringing this to our attention, and thanks to @wuflklaue for the context and recommendation! @Fale, there are some recommendations above that could be used to improve the test case:
If you have access to AWS, you could also follow our example of deploying a test cluster (https://www.cockroachlabs.com/docs/stable/deploy-a-test-cluster.html). This is closer to a true deployment of CRDB, with multiple nodes running on multiple machines. Wulfklaue's summary of the relative benefits of CRDB vs. Postgres is on the money. That said, we're continuously looking to improve performance on specific queries, so if you have some real life examples where CRDB is not performant, feel free to let us know. In the meantime, I'll mark this as "closed - will not fix". |
PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit run test 1000 iterations
|
I've written the following code snippet:
I installed PgSQL from my distro (Fedora 27).
I installed cockroach following https://www.cockroachlabs.com/docs/stable/start-a-local-cluster.html (v1.1.5) and I tried to perform some benchmarks.
I then tried to change the cockroach execution by adding
--cache=25% --max-sql-memory=25%
to every instance but the results are better but still very far from pgsql ones:Surely my test is not a perfect match with a real workload (I write first, read second, delete third without mixed ops, for instance), also I would expect some kind of performance differences (since cockroach is distributed/multinode) mainly on inserts/deletes, but I was not expecting such performance gap. I wonder if I did something that makes the test "wrong" or if this performance gap is known and is probably the same I could expect on a real workload.
The text was updated successfully, but these errors were encountered: