[MDEV-6150] Speed up connection speed by moving creation of THD to new thread Created: 2014-04-22  Updated: 2019-05-17  Resolved: 2016-02-20

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.2.0

Type: Task Priority: Major
Reporter: Michael Widenius Assignee: Axel Schwenke
Resolution: Fixed Votes: 3
Labels: connection, thread

Attachments: File MDEV-6150.ods     File bb-connect.zip     File bb_fast_connect.ods     File my.cnf    
Issue Links:
Relates
relates to MDEV-19515 Improve connect speed Open
Sprint: 10.1.6-2

 Description   

One major bottleneck for creating a new connection is that THD is created in the thread that is handing all connections.

The fix for this is to move THD creation from the connection thread to the new thread that will handle queries.



 Comments   
Comment by Axel Schwenke [ 2014-08-20 ]

<montywi> XL: I update the bb-fast-connect tree in git; This is after serg's review
<montywi> so I only need you to verify that things are same or better than normal 10.1 for connect tests and I can push
<XL> montywi: I see
<montywi> on my machine, having all threads in the thread cache gives a 5% speed increase; Having no thread cache was about the same
<montywi> this was when running 32 perl processes on the same machine to connect, do a query and disconnect
<montywi> doing this with a threaded benchmark should hopefully show a bigger speed increase

Comment by Michael Widenius [ 2014-09-02 ]

Pushed to bb-fast-connect tree for testing.

Comment by Axel Schwenke [ 2014-09-02 ]

Results from a short benchmark. I tested 3 scenarios

  1. standard sysbench OLTP readonly (1 connection per client thread that is reused)
  2. sysbench OLTP readonly, reconnection for each transaction
  3. simple workload: connect; select 1 from dual; disconnect

The last scenario shows advantages for the bb_fast_connect tree. The other however give better results with vanilla 10.1.

Benchmark was run on lizard2 (Intel, 32 cores, 64 threads). Huge thread pool was configured.

Comment by Michael Widenius [ 2016-02-07 ]

Pushed to 10.2.
Speed up for connections are up to 40% when there is a lot of connections threads and the thread pool is 16 or higher.

Comment by Axel Schwenke [ 2016-02-19 ]

Re-opened for benchmarking the effects of the change

Generated at Thu Feb 08 07:09:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.