[CONJ-652] faster results buffering socket available data Created: 2018-10-03  Updated: 2019-02-08  Resolved: 2018-10-03

Status: Closed
Project: MariaDB Connector/J
Component/s: performance
Affects Version/s: None
Fix Version/s: 1.8.0, 2.4.0

Type: Task Priority: Major
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

Current implementation buffer socket data.
Faster implementation would get socket available data in the buffer (limited to 16k) to permit to the socket to retrieve new data.

This corresponds to the option "useReadAheadInput" in MySQL connector.

benchmarks show huge improvement when having data, and neglectable slow the query without resultset (update / insert).



 Comments   
Comment by Diego Dupin [ 2018-10-04 ]

A quick benchmark results (average time for execution):

 
test = Select 10 000 rows with 10 columns
 
Benchmark    Mode  Cnt     Score
cdata        avgt   30  3801.067 ± 205.842  ms/op
mariadb      avgt   30  3510.291 ±  83.382  ms/op
mariadb_old  avgt   30  4119.216 ± 173.522  ms/op
mysql        avgt   30  3696.746 ±  94.048  ms/op
 
 
test = Select * from mysql.user LIMIT 1
 
Benchmark    Mode  Cnt     Score
cdata        avgt   30  1070.429 ± 70.021  μs/op
mariadb      avgt   30   167.911 ±  4.434  μs/op
mariadb_old  avgt   30   168.994 ±  3.208  μs/op
mysql        avgt   30   175.660 ±  2.307  μs/op
 
 
test = DO 1
 
Benchmark    Mode  Cnt    Score
cdata        avgt   30  451.108 ± 29.724  μs/op
mariadb      avgt   30  109.408 ±  3.105  μs/op
mariadb_old  avgt   30  108.920 ±  2.746  μs/op
mysql        avgt   30  207.637 ±  1.262  μs/op

This show a small perf decrease for query without results (<1%) as expected, since driver now call available() on socket without need for those queries.
Query with small resultset have a small perf increase (<1%).
Big resultset have a real perf increase.

Generated at Thu Feb 08 03:17:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.