[CONJS-210] multi-row result-set performance improvement Created: 2022-07-05  Updated: 2022-07-12  Resolved: 2022-07-12

Status: Closed
Project: MariaDB Connector/node.js
Component/s: performance
Affects Version/s: None
Fix Version/s: 3.0.1

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


 Description   

Multi rows resultset parsing object is ported by column object, resulting in bad javascript compilation, functions beeing created for each resultset.
Benchmarks show that results are the only one less performant than mysql2 driver (ok for mysql driver).
mysql2 does some impacting choice with client side metadata caching + precompilation, which are not options put on the table

improvement :

  • avoiding buffer copy when receiving socket buffer when not in multi-part
  • metadata parsing improvement
  • removing parsing function from column, setting them in dedicated function, permitting javascript compilation improvement


 Comments   
Comment by Diego Dupin [ 2022-07-06 ]

so far : for a query with 1000 rows of int + varchar(32) :

mariadb 3.0.0 : 1,909 ops/sec ±0.81%
mariadb 3.0.1 : 1,990 ops/sec ±0.44%
mysql         : 1,167 ops/sec ±0.51%
mysql2        : 2,091 ops/sec ±0.51%

Comment by Diego Dupin [ 2022-07-07 ]

same results with new implementation :

mariadb 3.0.1 : 2,130 ops/sec ±0.45%

Comment by Diego Dupin [ 2022-07-12 ]

final result, with a slighly changed benchmarks :

            mysql :    915.3 ops/s ± 0.4%
           mysql2 :  1,138.5 ops/s ± 1.8%  (  +24.4% )
          mariadb :  1,424.9 ops/s ± 0.2%  (  +55.7% )

difference is that comparison wasn't accurate, mysql2 use some client metadata caching.
In order to be accurate, cache is now filled, as expected in production.
(that's fair, cache miss reduced by half mysql2 performance)

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