You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/11/20 06:42:17 UTC

[GitHub] [shardingsphere] mmcLine opened a new issue, #22290: batch option sql will cause fullgc

mmcLine opened a new issue, #22290:
URL: https://github.com/apache/shardingsphere/issues/22290

   ## Question
   
   when i use this sql:
   ```
   <insert id="batchInsertOrder" parameterType="com.mmc.sharding.bean.Order" >
           insert into t_order (id,code,amt,user_id,create_time)
           values
           <foreach collection="list" item="item" separator=",">
               (#{item.id},#{item.code},#{item.amt},#{item.userId},#{item.createTime})
           </foreach>
       </insert>
   ```
   
   Because the number of parameters I pass in is different, the generated sql is different。
   
   These sql will be cached,Cause fullgc.
   
   ```
   public final class SQLStatementParserEngine {
       private final SQLStatementParserExecutor sqlStatementParserExecutor;
       private final LoadingCache<String, SQLStatement> sqlStatementCache;
   
       public SQLStatementParserEngine(String databaseType, SQLParserRule sqlParserRule) {
           this.sqlStatementParserExecutor = new SQLStatementParserExecutor(databaseType, sqlParserRule);
           this.sqlStatementCache = SQLStatementCacheBuilder.build(sqlParserRule, databaseType);
       }
   
       public SQLStatement parse(String sql, boolean useCache) {
           return useCache ? (SQLStatement)this.sqlStatementCache.getUnchecked(sql) : this.sqlStatementParserExecutor.parse(sql);
       }
   }
   ```
   The cache occupies 800m:
   ![image](https://user-images.githubusercontent.com/37876129/202889359-5a295abe-cbc3-4863-98d3-5d1bf144c851.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #22290: batch option sql will cause fullgc

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #22290:
URL: https://github.com/apache/shardingsphere/issues/22290#issuecomment-1321388844

   Maybe we can add an option to control the length of SQL allowed to be cached.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org