What are the scaling characteristics as the number of shapes and the number of transactions increases? #2146
Replies: 3 comments 6 replies
-
We create an index for common where clauses so it's very fast to do shape checks.
The graph is the time for the client to get the write (5-6ms) but the actual check is a lot faster — around 0.5 μs for checking each transaction. So 2000 transactions takes around ~1ms to match against however many shapes you have. There's more work to do of course if there's a matching shape but a 2000 transactions / second scenario should fit very comfortably in Electric. @robacourt's just barely landed the optimization last week (#2076) I'm not sure if he's tried yet to max out the tx/sec rate with the new code path. |
Beta Was this translation helpful? Give feedback.
-
Our general goal is to be able to go as fast as Postgres can go which of course depends on a ton of stuff but can be upwards of 20k tx / second. |
Beta Was this translation helpful? Give feedback.
-
The situation you are talking about @scottmessinger, with 1000 clients, each with 10 shapes and writing 1 transaction a second would indeed lead to Electric having to make 10,000 checks per second but only if the where clauses are not optimised. If the where clauses are optimised then Electric can check all 10,000 shapes at once in 0.2 milliseconds. What are optimised where clauses? Well,
The simple answer is yes, but it depends on your where clause. What I would say is if you are noticing poor write throughput with electric let us know what your where clause is and we might be able to optimise it or give you suggestions on how to change it to be more optimal. Thanks for these questions @scottmessinger . It's prompted me to add our write throughput benchmarks and an explanation of optimised where clauses to our benchmarking page . |
Beta Was this translation helpful? Give feedback.
-
Apologies in advance if the subject is unclear -- I'm trying to understand how Electric checks if a shape is invalid and the implications of that approach.
If I'm following the code correctly, it appears like each shape is compared against each transaction. So, if we have 1000 clients and each has 10 shape subscriptions, each transaction would be checked against 10,000 shapes. If 1000 clients send 1 txn/sec, that would be 1,000 txn/sec * 10,000 shapes = 10,000,000 shape checks/sec. If we get 1000 additional clients (each with 10 shape subscriptions) and sending 1 txn/sec, we'd have 2,000 txn/sec * 20,000 shapes = 40,000,000 shape checks/second.
Is that correct? If not, it seems like shape checking scales exponentially.
If that's wrong, could you clarify how it works? I've looked at your benchmarks page, but it doesn't seem to speak to this question (or, I'm completely misreading the appropriate graph)
Beta Was this translation helpful? Give feedback.
All reactions