The JDK 9+ provided incubator to support non-blocking jdbc. The idea is trying to process data when reading or updating the database. The code support most existing jdbc driver and just need minimal change of incubator code.
With the non-blocking jdbc code, the performance increased significantly for updating operations. But just hit slightly change on selection. It make sense since updating will cost on database side and our code will wait longer time to database IO response.
With the non-blocking jdbc code, the performance increased significantly for updating operations. But just hit slightly change on selection. It make sense since updating will cost on database side and our code will wait longer time to database IO response.
The chart clearly show performance comparison between block jdbc and non-block jdbc.
Overview, all of them hit the similar query time by access 10000 rows simple data.
When using just one thread, the non-block api just took half time of block api to update the database.
However, multiple thread increase the performance block api a lot. It should be like it since multiple thread used more system resources to process services. See the table before for detail data:
Although multiple thead hit the more efficient way to update the database, it took more resources comparing with non-block jdbc
See detail code for non-block jdbc
Query:
Update:
See my github for full implementation:
https://github.com/LeiZheng/sqlperformance
Comments
Post a Comment