ClickHouse / ClickHouse/clickhouse-java

Potential performance issue with SQL parsing in jdbc-v2

未关闭
#2,585 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
jdbc-v2 performance v2-feedback
主要语言
Java
星标
1.6k
派生
637
平均合并
2 天 23 小时
30 天内合并 PR
29

描述

Reporting against v.0.9.1. We are using ClickHouse JDBC via Hibernate - our code is calling createNativeQuery a lot - which means creating (and throwing away) a great number of PreparedStatements. As a result we're seeing in close to 6% of CPU time being spent in the driver's statement parsing with production loads (as evaluated with asprof), more specifically in the method org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState.

While I'm aware that this is partly a problem of our usage pattern (PreparedStatements should be cached, which is what we're going to address next at our end), we did not have this issue with the old version (0.2.6) of the driver. In short, the SQL parsing has become slow(er).

I'm writing this to alert you in case no performance benchmarks were performed for that area of code.

I'm also wondering why ANTLR is at all necessary in the driver - I'd assume the actual 'heavyweight' parsing to detect syntax errors and the like is done on the server anyhow, so why have such overheads in the client? But this is likely a deeper design issue not fixable by profiling...

贡献指南

打开贡献指南

调研方向

报告指出 org.antlr.v4.runtime.atn.ParserATNSimulator.closureCheckingStopState 是 jdbc-v2 中的热点方法;首先针对驱动版本 0.9.1 和 0.2.6,复现或基准测试重复解析 createNativeQuery 和 PreparedStatement 的情况。要视为完成,需要确认存在回归,并就解析或设计变更达成一致,但 issue 没有指出源文件或测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
clickhouse, java
领域
databases, performance
Issue 类型
缺陷
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。