memsql / dbbench

Database Benchmark Tool
Apache License 2.0
155 stars 30 forks source link

Can dbbench use a connection pool? #12

Open krishmanoh opened 4 years ago

krishmanoh commented 4 years ago

Running a workload that needs a connection pool. Can dbbench be modified to use a pool?

awreece commented 4 years ago

Take a look at the concurrency parameter (https://github.com/memsql/dbbench/blob/master/TUTORIAL.md#using-multiple-connections) -- would you please explain how a connection pool differs from that?

krishmanoh commented 4 years ago

Testing an ultra low latency workload. We need to discount the connection setup time from query execution time. The request is that a connection pool will first be opened and the queries run in that pool.

awreece commented 4 years ago

Ah, then here are a couple of workarounds:

[warm 10 connections]
query=select sleep(0.5)
concurrency=10

[actual workload]
concurrency=10
start=2s
krishmanoh commented 4 years ago

Looks like option 2 does work as expected

` [warm 10 connections] query=select sleep(0.5) concurrency=10 stop=1s

[actual workload] query=select count(1) from test.test_date concurrency=5 start=2s

I see the same LWPID being used

+-----+-----------------+-----------+--------+----------------------+ | id | host | state | lwpid | substr(info,1,20) | +-----+-----------------+-----------+--------+----------------------+ | 362 | :64201 | executing | 17898 | select sleep(0.5) | | 354 | :60105 | executing | 199307 | select sleep(0.5) | | 360 | :63177 | executing | 199310 | select sleep(0.5) | | 117 | localhost:21654 | executing | 199318 | select id, host, sta | | 363 | :64713 | executing | 353150 | select sleep(0.5) | | 358 | :62153 | executing | 353151 | select sleep(0.5) | | 359 | :62665 | executing | 353153 | select sleep(0.5) | | 361 | :63689 | executing | 353154 | select sleep(0.5) | | 356 | :61129 | executing | 353155 | select sleep(0.5) | | 355 | :60617 | executing | 353157 | select sleep(0.5) | | 357 | :61641 | executing | 377956 | select sleep(0.5) | +-----+-----------------+-----------+--------+----------------------+

+-----+-----------------+-----------+--------+----------------------+ | id | host | state | lwpid | substr(info,1,20) | +-----+-----------------+-----------+--------+----------------------+ | 354 | :60105 | executing | 199307 | select count(1) from | | 117 | localhost:21654 | executing | 199318 | select id, host, sta | | 363 | :64713 | executing | 353150 | select count(1) from | | 359 | :62665 | executing | 353153 | select count(1) from | | 355 | :60617 | executing | 353157 | select count(1) from | | 357 | :61641 | executing | 377956 | select count(1) from | +-----+-----------------+-----------+--------+----------------------+ 6 rows in set (0.00 sec)

The other connections are open until dbbench exits.

`