CockroachDB - research #1996
Replies: 4 comments 1 reply
-
@PiotrKozimor awesome work! i was thinking about this, too, while reading about several cloud providers including cockroachdb to their portfolio. operating (postgres || a relational database) is still hard and i'd love to see the dendrite guys pushing for optimizations here. |
Beta Was this translation helpful? Give feedback.
-
CockroachDB would be great! I wonder if anyone has tried AWS Aurora Serverless as a backend? |
Beta Was this translation helpful? Give feedback.
-
I wonder if switching to a embedded db such as pebbledb would be beneficial? From my perspective it seems like it would reduce stress on servers running dendrite which would allocate more resources to services that would need it. |
Beta Was this translation helpful? Give feedback.
-
+1 for cockroachdb. Has anyone tried it ? it might just work. Just have to change minor things i expect |
Beta Was this translation helpful? Give feedback.
-
Recently I researched cockroachDB as a database for dendrite. Theoretically it is wire-compatible with postgres. The benefit is better scalability and data resilience.
Experiment setup
I use k8s cluster with local SSDs, 3 cockroach instances are run by operator on
n2d-standard-2
machines. Postgres is run in cluster too. I switch between databases by applying different configmaps (which are consumed by dendrite deployment) and then restarting deployment. Postgres and dendrite were assigned to different nodes by k8s scheduler. Tracing is configured as follows:Latency between k8s nodes is as follows:
Compatibility
Dendrite uses some SQL extensions specific to postgres that are not implemented in cockroach. Required changes were introduced in commits
37a6463
...73d0963
in https://github.com/globekeeper/dendrite/commits/feature/cockroachdb-support. These are rather small changes that don't impact implementation.Performance
I have modified dendrite so that individual SQL statements are traced (commits
8f97a62
to9fb8b2a
in the branch above).Performance is severely degraded with cockroach. Please compare these two traces:
postgres.pdf
cockroach.pdf
Sending message takes around 30 ms for postgres. For cockroach it is about 370 ms (!). Here are my conclusions so far:
StoreEvent
takes three times more on cockroach which is acceptable to me.InsertEvent
is the statement that takes the most time to execute. For postgres it's 1.46 ms and for cockroach it's 59.3 ms.INSERT INTO roomserver_events
takes about 23 ms:SetState
takes way too much time.UPDATE roomserver_events
statement takes 1 ms to execute (looking at the cockroach console)GetLatestEventsForUpdate
span might be wrong or misleading.Beta Was this translation helpful? Give feedback.
All reactions