This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push: new 55b95a2a657 [fix](jdbc) fix jdbc url session variables (#2239) 55b95a2a657 is described below commit 55b95a2a65769c2ba6890309fdf384b6a792e33a Author: Mingyu Chen (Rayner) <morning...@163.com> AuthorDate: Fri Mar 28 18:02:46 2025 +0800 [fix](jdbc) fix jdbc url session variables (#2239) ## Versions - [x] dev - [x] 3.0 - [x] 2.1 - [ ] 2.0 ## Languages - [x] Chinese - [x] English ## Docs Checklist - [ ] Checked by AI - [ ] Test Cases Built --- docs/data-operate/import/group-commit-manual.md | 63 ++++++++++++--------- docs/db-connect/database-connect.md | 8 ++- .../data-operate/import/group-commit-manual.md | 11 +++- .../current/db-connect/database-connect.md | 10 +++- .../data-operate/import/group-commit-manual.md | 6 +- .../version-2.1/db-connect/database-connect.md | 10 +++- .../data-operate/import/group-commit-manual.md | 66 ++++++++++++---------- .../version-3.0/db-connect/database-connect.md | 10 +++- .../data-operate/import/group-commit-manual.md | 4 +- .../version-2.1/db-connect/database-connect.md | 8 ++- .../data-operate/import/group-commit-manual.md | 64 ++++++++++++--------- .../version-3.0/db-connect/database-connect.md | 8 ++- 12 files changed, 165 insertions(+), 103 deletions(-) diff --git a/docs/data-operate/import/group-commit-manual.md b/docs/data-operate/import/group-commit-manual.md index d6286190b93..d87ec074069 100644 --- a/docs/data-operate/import/group-commit-manual.md +++ b/docs/data-operate/import/group-commit-manual.md @@ -85,7 +85,7 @@ url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionStat * Through JDBC url by adding `sessionVariables=group_commit=async_mode` ``` -url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=500&sessionVariables=group_commit=async_mode&sessionVariables=enable_nereids_planner=false +url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=500&sessionVariables=group_commit=async_mode,enable_nereids_planner=false ``` * Through SQL execution @@ -100,7 +100,7 @@ try (Statement statement = conn.createStatement()) { ```java private static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; -private static final String URL_PATTERN = "jdbc:mysql://%s:%d/%s?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50$sessionVariables=group_commit=async_mode"; +private static final String URL_PATTERN = "jdbc:mysql://%s:%d/%s?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode"; private static final String HOST = "127.0.0.1"; private static final int PORT = 9087; private static final String DB = "db"; @@ -613,18 +613,27 @@ JMeter Parameter Settings as Shown in the Images  1. Set the Init Statement Before Testing: -set group_commit=async_mode and set enable_nereids_planner=false. + + ``` + set group_commit=async_mode; + set enable_nereids_planner=false; + ``` 2. Enable JDBC Prepared Statement: -Complete URL: -jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode&sessionVariables=enable_nereids_planner=false. + Complete URL: + + ``` + jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode,enable_nereids_planner=false. + ``` + 3. Set the Import Type to Prepared Update Statement. 4. Set the Import Statement. 5. Set the Values to Be Imported: -Ensure that the imported values match the data types one by one. + + Ensure that the imported values match the data types one by one. **Testing Methodology** @@ -636,26 +645,26 @@ Ensure that the imported values match the data types one by one. * The following tests are divided into 30, 100, and 500 concurrency. -**Performance Test with 30 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** - -| Group commit internal | 10ms | 20ms | 50ms | 100ms | -|-----------------------|---------------|---------------|---------------|---------------| -|enable_nereids_planner=true| 891.8 | 701.1 | 400.0 | 237.5 | -|enable_nereids_planner=false| 885.8 | 688.1 | 398.7 | 232.9 | - -**Performance Test with 100 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** - -| Group commit internal | 10ms | 20ms | 50ms | 100ms | -|-----------------------|---------------|---------------|---------------|---------------| -|enable_nereids_planner=true| 2427.8 | 2068.9 | 1259.4 | 764.9 | -|enable_nereids_planner=false| 2320.4 | 1899.3 | 1206.2 |749.7| - -**Performance Test with 500 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** - -| Group commit internal | 10ms | 20ms | 50ms | 100ms | -|-----------------------|---------------|---------------|---------------|---------------| -|enable_nereids_planner=true| 5567.5 | 5713.2 | 4681.0 | 3131.2 | -|enable_nereids_planner=false| 4471.6 | 5042.5 | 4932.2 | 3641.1 | + **Performance Test with 30 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** + + | Group commit internal | 10ms | 20ms | 50ms | 100ms | + |-----------------------|---------------|---------------|---------------|---------------| + |enable_nereids_planner=true| 891.8 | 701.1 | 400.0 | 237.5 | + |enable_nereids_planner=false| 885.8 | 688.1 | 398.7 | 232.9 | + + **Performance Test with 100 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** + + | Group commit internal | 10ms | 20ms | 50ms | 100ms | + |-----------------------|---------------|---------------|---------------|---------------| + |enable_nereids_planner=true| 2427.8 | 2068.9 | 1259.4 | 764.9 | + |enable_nereids_planner=false| 2320.4 | 1899.3 | 1206.2 |749.7| + + **Performance Test with 500 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** + + | Group commit internal | 10ms | 20ms | 50ms | 100ms | + |-----------------------|---------------|---------------|---------------|---------------| + |enable_nereids_planner=true| 5567.5 | 5713.2 | 4681.0 | 3131.2 | + |enable_nereids_planner=false| 4471.6 | 5042.5 | 4932.2 | 3641.1 | ### Insert into Sync Mode Large Batch Data @@ -706,4 +715,4 @@ Ensure that the imported values match the data types one by one. | Group commit internal | 10ms | 20ms | 50ms | 100ms | |-----------------------|---------------|---------------|---------------|---------------| |enable_nereids_planner=true| 2.5K | 2.5K | 2.3K | 2.1K | -|enable_nereids_planner=false| 94.2K | 95.1K | 94.4K | 94.8K | \ No newline at end of file +|enable_nereids_planner=false| 94.2K | 95.1K | 94.4K | 94.8K | diff --git a/docs/db-connect/database-connect.md b/docs/db-connect/database-connect.md index bd01e8a68d7..7032e6ac787 100644 --- a/docs/db-connect/database-connect.md +++ b/docs/db-connect/database-connect.md @@ -56,7 +56,7 @@ Example of connection code: ```Java String user = "user_name"; String password = "user_password"; -String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; +String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; try { Connection myCon = DriverManager.getConnection(newUrl, user, password); Statement stmt = myCon.createStatement(); @@ -73,6 +73,12 @@ try { } ``` +If you need to initially change session variables when connecting, you can use the following format: + +``` +jdbc:mysql://FE_IP:FE_PORT/demo?sessionVariables=key1=val1,key2=val2 +``` + ## DBeaver Create a MySQL connection to Apache Doris: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/import/group-commit-manual.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/import/group-commit-manual.md index 5fc677b965e..4ddae61a832 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/import/group-commit-manual.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/import/group-commit-manual.md @@ -85,7 +85,7 @@ url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionStat * 通过 JDBC url 设置,增加`sessionVariables=group_commit=async_mode` ``` -url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=500&sessionVariables=group_commit=async_mode&sessionVariables=enable_nereids_planner=false +url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=500&sessionVariables=group_commit=async_mode,enable_nereids_planner=false ``` * 通过执行 SQL 设置 @@ -100,7 +100,7 @@ try (Statement statement = conn.createStatement()) { ```java private static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; -private static final String URL_PATTERN = "jdbc:mysql://%s:%d/%s?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50$sessionVariables=group_commit=async_mode"; +private static final String URL_PATTERN = "jdbc:mysql://%s:%d/%s?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode"; private static final String HOST = "127.0.0.1"; private static final int PORT = 9087; private static final String DB = "db"; @@ -619,7 +619,12 @@ PROPERTIES (  1. 设置测试前的 init 语句,`set group_commit=async_mode`以及`set enable_nereids_planner=false`。 -2. 开启 jdbc 的 prepared statement,完整的 url 为`jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode&sessionVariables=enable_nereids_planner=false`。 +2. 开启 jdbc 的 prepared statement,完整的 url 为: + + ``` + jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode,enable_nereids_planner=false`。 + ``` + 3. 设置导入类型为 prepared update statement。 4. 设置导入语句。 5. 设置每次需要导入的值,注意,导入的值与导入值的类型要一一匹配。 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/db-connect/database-connect.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/db-connect/database-connect.md index d9450e39881..b922b22fbf5 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/db-connect/database-connect.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/db-connect/database-connect.md @@ -65,7 +65,7 @@ mysql> ```Java String user = "user_name"; String password = "user_password"; -String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; +String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; try { Connection myCon = DriverManager.getConnection(newUrl, user, password); Statement stmt = myCon.createStatement(); @@ -82,6 +82,12 @@ try { } ``` +如果需要在连接时初始换会话变量(Session Variables),可以使用下列格式: + +``` +jdbc:mysql://FE_IP:FE_PORT/demo?sessionVariables=key1=val1,key2=val2 +``` + ## DBeaver 创建一个到 Apache Doris 的 MySQL 连接: @@ -115,4 +121,4 @@ ALTER SYSTEM ADD BACKEND "be_host_ip:heartbeat_service_port"; Playground 中执行这种和具体数据库/表没有关系的语句,务必在左侧库栏里随意选择一个数据库,才能执行成功,这个限制,稍后会去掉。 当前内置的 Web 控制台,还不能执行 SET 类型的 SQL 语句,所以,在 Web 控制台,当前还不能通过执行 SET PASSWORD FOR 'user' = PASSWORD('user_password') `类似语句。 -::: \ No newline at end of file +::: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/data-operate/import/group-commit-manual.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/data-operate/import/group-commit-manual.md index d2051ef64e6..b23fee4725c 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/data-operate/import/group-commit-manual.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/data-operate/import/group-commit-manual.md @@ -100,7 +100,7 @@ try (Statement statement = conn.createStatement()) { ```java private static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; -private static final String URL_PATTERN = "jdbc:mysql://%s:%d/%s?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50$sessionVariables=group_commit=async_mode"; +private static final String URL_PATTERN = "jdbc:mysql://%s:%d/%s?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode"; private static final String HOST = "127.0.0.1"; private static final int PORT = 9087; private static final String DB = "db"; @@ -618,7 +618,7 @@ PROPERTIES (  1. 设置测试前的 init 语句,`set group_commit=async_mode`以及`set enable_nereids_planner=false`。 -2. 开启 jdbc 的 prepared statement,完整的 url 为`jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode&sessionVariables=enable_nereids_planner=false`。 +2. 开启 jdbc 的 prepared statement,完整的 url 为`jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode,enable_nereids_planner=false`。 3. 设置导入类型为 prepared update statement。 4. 设置导入语句。 5. 设置每次需要导入的值,注意,导入的值与导入值的类型要一一匹配。 @@ -725,4 +725,4 @@ PROPERTIES ( | Group commit internal | 10ms | 20ms | 50ms | 100ms | |-----------------------|---------------|---------------|---------------|---------------| -| | 46.3K | 47.7K | 47.4K | 46.5K | \ No newline at end of file +| | 46.3K | 47.7K | 47.4K | 46.5K | diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/db-connect/database-connect.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/db-connect/database-connect.md index d9450e39881..b922b22fbf5 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/db-connect/database-connect.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/db-connect/database-connect.md @@ -65,7 +65,7 @@ mysql> ```Java String user = "user_name"; String password = "user_password"; -String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; +String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; try { Connection myCon = DriverManager.getConnection(newUrl, user, password); Statement stmt = myCon.createStatement(); @@ -82,6 +82,12 @@ try { } ``` +如果需要在连接时初始换会话变量(Session Variables),可以使用下列格式: + +``` +jdbc:mysql://FE_IP:FE_PORT/demo?sessionVariables=key1=val1,key2=val2 +``` + ## DBeaver 创建一个到 Apache Doris 的 MySQL 连接: @@ -115,4 +121,4 @@ ALTER SYSTEM ADD BACKEND "be_host_ip:heartbeat_service_port"; Playground 中执行这种和具体数据库/表没有关系的语句,务必在左侧库栏里随意选择一个数据库,才能执行成功,这个限制,稍后会去掉。 当前内置的 Web 控制台,还不能执行 SET 类型的 SQL 语句,所以,在 Web 控制台,当前还不能通过执行 SET PASSWORD FOR 'user' = PASSWORD('user_password') `类似语句。 -::: \ No newline at end of file +::: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/data-operate/import/group-commit-manual.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/data-operate/import/group-commit-manual.md index 1cd20682a78..4ddae61a832 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/data-operate/import/group-commit-manual.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/data-operate/import/group-commit-manual.md @@ -85,7 +85,7 @@ url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionStat * 通过 JDBC url 设置,增加`sessionVariables=group_commit=async_mode` ``` -url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=500&sessionVariables=group_commit=async_mode&sessionVariables=enable_nereids_planner=false +url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=500&sessionVariables=group_commit=async_mode,enable_nereids_planner=false ``` * 通过执行 SQL 设置 @@ -100,7 +100,7 @@ try (Statement statement = conn.createStatement()) { ```java private static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; -private static final String URL_PATTERN = "jdbc:mysql://%s:%d/%s?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50$sessionVariables=group_commit=async_mode"; +private static final String URL_PATTERN = "jdbc:mysql://%s:%d/%s?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode"; private static final String HOST = "127.0.0.1"; private static final int PORT = 9087; private static final String DB = "db"; @@ -289,7 +289,7 @@ mysql> select * from dt; # 配置 session 变量开启 group commit (默认为 off_mode),开启同步模式 mysql> set group_commit = sync_mode; -# 这里返回的 label 是 group_commit 开头的,可以区分出是否谁用了 group commit,导入耗时至少是表属性 group_commit_interval。 +# 这里返回的 label 是 group_commit 开头的,可以区分出是否使用了 group commit,导入耗时至少是表属性 group_commit_interval。 mysql> insert into dt values(4, 'Bob', 90), (5, 'Alice', 99); Query OK, 2 rows affected (10.06 sec) {'label':'group_commit_d84ab96c09b60587_ec455a33cb0e9e87', 'status':'PREPARE', 'txnId':'3007', 'query_id':'fc6b94085d704a94-a69bfc9a202e66e2'} @@ -487,7 +487,7 @@ ALTER TABLE dt SET ("group_commit_data_bytes" = "134217728"); ### Stream Load 日志场景测试 -**机器配置** +#### 机器配置 * 1 台 FE:阿里云 8 核 CPU、16GB 内存、1 块 100GB ESSD PL1 云磁盘 @@ -497,19 +497,19 @@ ALTER TABLE dt SET ("group_commit_data_bytes" = "134217728"); * 测试版本为 Doris-3.0.1 -**数据集** +#### 数据集 * `httplogs` 数据集,总共 31GB、2.47 亿条 -**测试工具** +#### 测试工具 * [doris-streamloader](/ecosystem/doris-streamloader.md) -**测试方法** +#### 测试方法 * 对比 `非 group_commit` 和 `group_commit `的 `async_mode` 模式下,设置不同的单并发数据量和并发数,导入 `247249096` 行数据 -**测试结果** +#### 测试结果 | 导入方式 | 单并发数据量 | 并发数 | 耗时 (秒) | 导入速率 (行/秒) | 导入吞吐 (MB/秒) | |----------------|---------|------|-----------|----------|-----------| @@ -532,7 +532,7 @@ ALTER TABLE dt SET ("group_commit_data_bytes" = "134217728"); ### JDBC -**机器配置** +#### 机器配置 * 1 台 FE:阿里云 8 核 CPU、16GB 内存、1 块 100GB ESSD PL1 云磁盘 @@ -544,19 +544,19 @@ ALTER TABLE dt SET ("group_commit_data_bytes" = "134217728"); * 关闭打印 parpared 语句的 audit log 以提高性能 -**数据集** +#### 数据集 * tpch sf10 `lineitem` 表数据集,30 个文件,总共约 22 GB,1.8 亿行 -**测试工具** +#### 测试工具 * [DataX](https://github.com/alibaba/DataX) -**测试方法** +#### 测试方法 * 通过 `txtfilereader` 向 `mysqlwriter` 写入数据,配置不同并发数和单个 `INSERT` 的行数 -**测试结果** +#### 测试结果 | 单个 insert 的行数 | 并发数 | 导入速率 (行/秒) | 导入吞吐 (MB/秒) | |-------------|-----|-----------|----------| @@ -568,7 +568,7 @@ ALTER TABLE dt SET ("group_commit_data_bytes" = "134217728"); ### Insert into sync 模式小批量数据 -**机器配置** +#### 机器配置 * 1 台 FE:阿里云 16 核 CPU、64GB 内存、1 块 500GB ESSD PL1 云磁盘 @@ -578,7 +578,7 @@ ALTER TABLE dt SET ("group_commit_data_bytes" = "134217728"); * 测试版本为 Doris-3.0.1 -**数据集** +#### 数据集 * tpch sf10 `lineitem` 表数据集。 @@ -609,7 +609,7 @@ PROPERTIES ( ); ``` -**测试工具** +#### 测试工具 * [Jmeter](https://jmeter.apache.org/) @@ -619,37 +619,41 @@ PROPERTIES (  1. 设置测试前的 init 语句,`set group_commit=async_mode`以及`set enable_nereids_planner=false`。 -2. 开启 jdbc 的 prepared statement,完整的 url 为`jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode&sessionVariables=enable_nereids_planner=false`。 +2. 开启 jdbc 的 prepared statement,完整的 url 为: + + ``` + jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode,enable_nereids_planner=false`。 + ``` + 3. 设置导入类型为 prepared update statement。 4. 设置导入语句。 5. 设置每次需要导入的值,注意,导入的值与导入值的类型要一一匹配。 -**测试方法** +#### 测试方法 * 通过 `Jmeter` 向`Doris`写数据。每个并发每次通过 insert into 写入 1 行数据。 -**测试结果** +#### 测试结果 * 数据单位为行每秒。 * 以下测试分为 30,100,500 并发。 -**30 并发 sync 模式 5 个 BE3 副本性能测试** +#### 30 并发 sync 模式 5 个 BE3 副本性能测试 | Group commit internal | 10ms | 20ms | 50ms | 100ms | |-----------------------|---------------|---------------|---------------|---------------| |enable_nereids_planner=true| 891.8 | 701.1 | 400.0 | 237.5 | |enable_nereids_planner=false| 885.8 | 688.1 | 398.7 | 232.9 | - -**100 并发 sync 模式 5 个 BE3 副本性能测试** +#### 100 并发 sync 模式 5 个 BE3 副本性能测试 | Group commit internal | 10ms | 20ms | 50ms | 100ms | |-----------------------|---------------|---------------|---------------|---------------| |enable_nereids_planner=true| 2427.8 | 2068.9 | 1259.4 | 764.9 | |enable_nereids_planner=false| 2320.4 | 1899.3 | 1206.2 |749.7| -**500 并发 sync 模式 5 个 BE3 副本性能测试** +#### 500 并发 sync 模式 5 个 BE3 副本性能测试 | Group commit internal | 10ms | 20ms | 50ms | 100ms | |-----------------------|---------------|---------------|---------------|---------------| @@ -658,7 +662,7 @@ PROPERTIES ( ### Insert into sync 模式大批量数据 -**机器配置** +#### 机器配置 * 1 台 FE:阿里云 16 核 CPU、64GB 内存、1 块 500GB ESSD PL1 云磁盘 @@ -668,7 +672,7 @@ PROPERTIES ( * 测试版本为 Doris-3.0.1 -**数据集** +#### 数据集 * tpch sf10 `lineitem` 表数据集。 @@ -699,35 +703,35 @@ PROPERTIES ( ); ``` -**测试工具** +#### 测试工具 * [Jmeter](https://jmeter.apache.org/) -**测试方法** +#### 测试方法 * 通过 `Jmeter` 向`Doris`写数据。每个并发每次通过 insert into 写入 1000 行数据。 -**测试结果** +#### 测试结果 * 数据单位为行每秒。 * 以下测试分为 30,100,500 并发。 -**30 并发 sync 模式 5 个 BE3 副本性能测试** +#### 30 并发 sync 模式 5 个 BE3 副本性能测试 | Group commit internal | 10ms | 20ms | 50ms | 100ms | |-----------------------|---------------|---------------|---------------|---------------| |enable_nereids_planner=true| 9.1K | 11.1K | 11.4K | 11.1K | |enable_nereids_planner=false| 157.8K | 159.9K | 154.1K | 120.4K | -**100 并发 sync 模式 5 个 BE3 副本性能测试** +#### 100 并发 sync 模式 5 个 BE3 副本性能测试 | Group commit internal | 10ms | 20ms | 50ms | 100ms | |-----------------------|---------------|---------------|---------------|---------------| |enable_nereids_planner=true| 10.0K |9.2K | 8.9K | 8.9K | |enable_nereids_planner=false| 130.4k | 131.0K | 130.4K | 124.1K | -**500 并发 sync 模式 5 个 BE3 副本性能测试** +#### 500 并发 sync 模式 5 个 BE3 副本性能测试 | Group commit internal | 10ms | 20ms | 50ms | 100ms | |-----------------------|---------------|---------------|---------------|---------------| diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/db-connect/database-connect.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/db-connect/database-connect.md index d9450e39881..b922b22fbf5 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/db-connect/database-connect.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/db-connect/database-connect.md @@ -65,7 +65,7 @@ mysql> ```Java String user = "user_name"; String password = "user_password"; -String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; +String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; try { Connection myCon = DriverManager.getConnection(newUrl, user, password); Statement stmt = myCon.createStatement(); @@ -82,6 +82,12 @@ try { } ``` +如果需要在连接时初始换会话变量(Session Variables),可以使用下列格式: + +``` +jdbc:mysql://FE_IP:FE_PORT/demo?sessionVariables=key1=val1,key2=val2 +``` + ## DBeaver 创建一个到 Apache Doris 的 MySQL 连接: @@ -115,4 +121,4 @@ ALTER SYSTEM ADD BACKEND "be_host_ip:heartbeat_service_port"; Playground 中执行这种和具体数据库/表没有关系的语句,务必在左侧库栏里随意选择一个数据库,才能执行成功,这个限制,稍后会去掉。 当前内置的 Web 控制台,还不能执行 SET 类型的 SQL 语句,所以,在 Web 控制台,当前还不能通过执行 SET PASSWORD FOR 'user' = PASSWORD('user_password') `类似语句。 -::: \ No newline at end of file +::: diff --git a/versioned_docs/version-2.1/data-operate/import/group-commit-manual.md b/versioned_docs/version-2.1/data-operate/import/group-commit-manual.md index 2402be2cd37..a24fccecd71 100644 --- a/versioned_docs/version-2.1/data-operate/import/group-commit-manual.md +++ b/versioned_docs/version-2.1/data-operate/import/group-commit-manual.md @@ -618,7 +618,7 @@ set group_commit=async_mode and set enable_nereids_planner=false. 2. Enable JDBC Prepared Statement: Complete URL: -jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode&sessionVariables=enable_nereids_planner=false. +jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode,enable_nereids_planner=false. 3. Set the Import Type to Prepared Update Statement. @@ -701,4 +701,4 @@ Ensure that the imported values match the data types one by one. | Group commit internal | 10ms | 20ms | 50ms | 100ms | |-----------------------|---------------|---------------|---------------|---------------| -| | 46.3K | 47.7K | 47.4K | 46.5K | \ No newline at end of file +| | 46.3K | 47.7K | 47.4K | 46.5K | diff --git a/versioned_docs/version-2.1/db-connect/database-connect.md b/versioned_docs/version-2.1/db-connect/database-connect.md index bd01e8a68d7..7032e6ac787 100644 --- a/versioned_docs/version-2.1/db-connect/database-connect.md +++ b/versioned_docs/version-2.1/db-connect/database-connect.md @@ -56,7 +56,7 @@ Example of connection code: ```Java String user = "user_name"; String password = "user_password"; -String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; +String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; try { Connection myCon = DriverManager.getConnection(newUrl, user, password); Statement stmt = myCon.createStatement(); @@ -73,6 +73,12 @@ try { } ``` +If you need to initially change session variables when connecting, you can use the following format: + +``` +jdbc:mysql://FE_IP:FE_PORT/demo?sessionVariables=key1=val1,key2=val2 +``` + ## DBeaver Create a MySQL connection to Apache Doris: diff --git a/versioned_docs/version-3.0/data-operate/import/group-commit-manual.md b/versioned_docs/version-3.0/data-operate/import/group-commit-manual.md index 4d2cbbea095..d87ec074069 100644 --- a/versioned_docs/version-3.0/data-operate/import/group-commit-manual.md +++ b/versioned_docs/version-3.0/data-operate/import/group-commit-manual.md @@ -85,7 +85,7 @@ url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionStat * Through JDBC url by adding `sessionVariables=group_commit=async_mode` ``` -url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=500&sessionVariables=group_commit=async_mode&sessionVariables=enable_nereids_planner=false +url = jdbc:mysql://127.0.0.1:9030/db?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=500&sessionVariables=group_commit=async_mode,enable_nereids_planner=false ``` * Through SQL execution @@ -100,7 +100,7 @@ try (Statement statement = conn.createStatement()) { ```java private static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; -private static final String URL_PATTERN = "jdbc:mysql://%s:%d/%s?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50$sessionVariables=group_commit=async_mode"; +private static final String URL_PATTERN = "jdbc:mysql://%s:%d/%s?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode"; private static final String HOST = "127.0.0.1"; private static final int PORT = 9087; private static final String DB = "db"; @@ -554,7 +554,6 @@ Disable the printing of prepared statement audit logs to enhance performance. #### Test Results - | Rows per insert | Concurrency | Rows / Second | MB / Second | |-------------------|--------|--------------------|--------------------| | 100 | 10 | 160,758 | 17.21 | @@ -614,18 +613,27 @@ JMeter Parameter Settings as Shown in the Images  1. Set the Init Statement Before Testing: -set group_commit=async_mode and set enable_nereids_planner=false. + + ``` + set group_commit=async_mode; + set enable_nereids_planner=false; + ``` 2. Enable JDBC Prepared Statement: -Complete URL: -jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode&sessionVariables=enable_nereids_planner=false. + Complete URL: + + ``` + jdbc:mysql://127.0.0.1:9030?useServerPrepStmts=true&useLocalSessionState=true&rewriteBatchedStatements=true&cachePrepStmts=true&prepStmtCacheSqlLimit=99999&prepStmtCacheSize=50&sessionVariables=group_commit=async_mode,enable_nereids_planner=false. + ``` + 3. Set the Import Type to Prepared Update Statement. 4. Set the Import Statement. 5. Set the Values to Be Imported: -Ensure that the imported values match the data types one by one. + + Ensure that the imported values match the data types one by one. **Testing Methodology** @@ -637,26 +645,26 @@ Ensure that the imported values match the data types one by one. * The following tests are divided into 30, 100, and 500 concurrency. -**Performance Test with 30 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** - -| Group commit internal | 10ms | 20ms | 50ms | 100ms | -|-----------------------|---------------|---------------|---------------|---------------| -|enable_nereids_planner=true| 891.8 | 701.1 | 400.0 | 237.5 | -|enable_nereids_planner=false| 885.8 | 688.1 | 398.7 | 232.9 | - -**Performance Test with 100 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** - -| Group commit internal | 10ms | 20ms | 50ms | 100ms | -|-----------------------|---------------|---------------|---------------|---------------| -|enable_nereids_planner=true| 2427.8 | 2068.9 | 1259.4 | 764.9 | -|enable_nereids_planner=false| 2320.4 | 1899.3 | 1206.2 |749.7| - -**Performance Test with 500 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** - -| Group commit internal | 10ms | 20ms | 50ms | 100ms | -|-----------------------|---------------|---------------|---------------|---------------| -|enable_nereids_planner=true| 5567.5 | 5713.2 | 4681.0 | 3131.2 | -|enable_nereids_planner=false| 4471.6 | 5042.5 | 4932.2 | 3641.1 | + **Performance Test with 30 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** + + | Group commit internal | 10ms | 20ms | 50ms | 100ms | + |-----------------------|---------------|---------------|---------------|---------------| + |enable_nereids_planner=true| 891.8 | 701.1 | 400.0 | 237.5 | + |enable_nereids_planner=false| 885.8 | 688.1 | 398.7 | 232.9 | + + **Performance Test with 100 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** + + | Group commit internal | 10ms | 20ms | 50ms | 100ms | + |-----------------------|---------------|---------------|---------------|---------------| + |enable_nereids_planner=true| 2427.8 | 2068.9 | 1259.4 | 764.9 | + |enable_nereids_planner=false| 2320.4 | 1899.3 | 1206.2 |749.7| + + **Performance Test with 500 Concurrent Users in Sync Mode, 5 BEs, and 3 Replicas** + + | Group commit internal | 10ms | 20ms | 50ms | 100ms | + |-----------------------|---------------|---------------|---------------|---------------| + |enable_nereids_planner=true| 5567.5 | 5713.2 | 4681.0 | 3131.2 | + |enable_nereids_planner=false| 4471.6 | 5042.5 | 4932.2 | 3641.1 | ### Insert into Sync Mode Large Batch Data @@ -707,4 +715,4 @@ Ensure that the imported values match the data types one by one. | Group commit internal | 10ms | 20ms | 50ms | 100ms | |-----------------------|---------------|---------------|---------------|---------------| |enable_nereids_planner=true| 2.5K | 2.5K | 2.3K | 2.1K | -|enable_nereids_planner=false| 94.2K | 95.1K | 94.4K | 94.8K | \ No newline at end of file +|enable_nereids_planner=false| 94.2K | 95.1K | 94.4K | 94.8K | diff --git a/versioned_docs/version-3.0/db-connect/database-connect.md b/versioned_docs/version-3.0/db-connect/database-connect.md index bd01e8a68d7..7032e6ac787 100644 --- a/versioned_docs/version-3.0/db-connect/database-connect.md +++ b/versioned_docs/version-3.0/db-connect/database-connect.md @@ -56,7 +56,7 @@ Example of connection code: ```Java String user = "user_name"; String password = "user_password"; -String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; +String newUrl = "jdbc:mysql://FE_IP:FE_PORT/demo?useUnicode=true&characterEncoding=utf8&useTimezone=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"; try { Connection myCon = DriverManager.getConnection(newUrl, user, password); Statement stmt = myCon.createStatement(); @@ -73,6 +73,12 @@ try { } ``` +If you need to initially change session variables when connecting, you can use the following format: + +``` +jdbc:mysql://FE_IP:FE_PORT/demo?sessionVariables=key1=val1,key2=val2 +``` + ## DBeaver Create a MySQL connection to Apache Doris: --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org