Use many connections on the benchmarks server#7852
Use many connections on the benchmarks server#7852connortsui20 wants to merge 1 commit intodevelopfrom
Conversation
| } | ||
|
|
||
| fn connection(&self) -> Result<Connection> { | ||
| let root = self.root.lock(); |
There was a problem hiding this comment.
i don't love that this still requires locking, even though the criticial section is pretty short lived...guess it's fine 🤷
There was a problem hiding this comment.
I think that we cant really get around this? Also it is unlikely that this would have contention anyways
There was a problem hiding this comment.
this method is called on every request right?
There was a problem hiding this comment.
at this point, why do we even need the lock? can't we just clone here?
There was a problem hiding this comment.
the type isn't send so it needs to be wrapped in something with interior mut
There was a problem hiding this comment.
Oh I guess it might have some contention, but duckdb is going to have a lot of overhead in creating txns for all of these requests (which is further dominated by the actual queries) so I don't think it's a problem
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
3ad0f97 to
c00f12f
Compare
Merging this PR will improve performance by 14.84%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | encode_varbin[(1000, 2)] |
167.8 µs | 146.1 µs | +14.84% |
| ⚡ | Simulation | encode_varbin[(1000, 32)] |
169.7 µs | 153.2 µs | +10.75% |
| ⚡ | Simulation | encode_varbin[(1000, 4)] |
163.8 µs | 147.1 µs | +11.38% |
| ⚡ | Simulation | encode_varbin[(1000, 8)] |
164.7 µs | 147.8 µs | +11.42% |
| ⚡ | Simulation | take_map[(0.1, 0.5)] |
1,111.5 µs | 985.3 µs | +12.8% |
| ⚡ | Simulation | take_map[(0.1, 1.0)] |
1.8 ms | 1.7 ms | +11.11% |
Comparing ct/many-connections (c00f12f) with develop (ff12040)
Summary
Turns out we can just clone the connection and have each of them write (with retry). Now all threads can read and write concurrently instead of being serialized through a lock.
Testing
What's that?!