You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shardingsphere.apache.org by Terry Zhang <co...@qq.com> on 2020/08/12 02:43:09 UTC

回复: SO slow to insert 5K record one time using Sharding-JDBC

Dear Yonglun,&nbsp;


Thanks for your suggestion. it costs about 1s now by upgrading the version.


However, we found another issue of that some SQL works well in old version, but not work in new version.&nbsp;


Thanks.


Terry




------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "dev"                                                                                    <zhangyonglun@apache.org&gt;;
发送时间:&nbsp;2020年8月4日(星期二) 晚上6:54
收件人:&nbsp;"dev"<dev@shardingsphere.apache.org&gt;;

主题:&nbsp;Re: SO slow to insert 5K record one time using Sharding-JDBC



It is the parsing module cost so much time. You can update the
Sharding-JDBC to 4.1.0 or above to solve the problem.
Please refer to the release notes of 4.1.0:
https://github.com/apache/shardingsphere/releases/tag/4.1.0

--

Zhang Yonglun
Apache ShardingSphere


Terry Zhang <confach@qq.com&gt; 于2020年8月4日周二 下午6:37写道:

&gt; Hi, ShardingSphere community,
&gt;
&gt; &amp;nbsp;
&gt;
&gt; We are using Sharding-Sphere 4.0.RC2 in our project for a long time.
&gt; Recently, we are encountering a serious issue struggling us. When we try to
&gt; insert 5K records one time into one table, it takes about 40 seconds.
&gt; However, when the execution time is about 0.11 second according to MySQL
&gt; Audit log.
&gt;
&gt; &amp;nbsp;
&gt;
&gt; To figure our the root reason, we try to disable ShardingSphere and use
&gt; native JDBC instead, the result is very positive. It is so quick to execute
&gt; the same SQL. It is about 0.2s.
&gt;
&gt; &amp;nbsp;
&gt;
&gt; Based on above findings, we think ShardingJDBC may cause it happen.
&gt;
&gt; &amp;nbsp;
&gt;
&gt; To solve it, we are finding the possible solution. Here is our solution,
&gt; as not all of MySQL tables need to use sharding feature. we have those
&gt; non-sharding tables keep to use the native JDBC, not use ShardingJDBC. To
&gt; implement it, we try to find the way to implement it according to the
&gt; official document, unfortunately, we don’t find the best way. &amp;nbsp;
&gt;
&gt; &amp;nbsp;
&gt;
&gt; How to implement our solution? Alternatively, any other solution to
&gt; resolve it?
&gt;
&gt; &amp;nbsp;
&gt;
&gt; To help to understand it easily ,here is some information for the
&gt; reference.
&gt;
&gt; &amp;nbsp;
&gt;
&gt; --------The format of SQL DML like this------
&gt;
&gt; INSERT INTO tbl_orders (id,f2,f3,....) VALUES (1,xx,xx,...),
&gt; (2,xx,xx,...), (3,xx,xx,...), ...,(5000,xx,xx,...).
&gt;
&gt; Please note, the table &amp;nbsp;tbl_orders is a non-sharding table.
&gt;
&gt; &amp;nbsp;
&gt;
&gt; ------ Java --------
&gt;
&gt; Java 1.8
&gt;
&gt; &amp;nbsp;
&gt;
&gt; ----MySQL---
&gt;
&gt; MySQL 5.7
&gt;
&gt; &amp;nbsp;
&gt;
&gt; --OS --
&gt;
&gt; CentOS 7.2
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;
&gt; Terry