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/02/11 09:12:34 UTC

[GitHub] [shardingsphere] TeslaCN opened a new issue #15358: There are many redundant overhead when creating DMLStatementContext

TeslaCN opened a new issue #15358:
URL: https://github.com/apache/shardingsphere/issues/15358


   ## Feature Request
   
   ### Is your feature request related to a problem?
   Related to performance issue. 
   
   ### Describe the feature you would like.
   When executing SQL with prepared statement, the `SQLStatement` is unchanged. But some logic in the following classes will be executed every time executing the same prepared statement, even the results of most calculations are same.
   - org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext (**especially in this**)
   - org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementContext
   - org.apache.shardingsphere.infra.binder.statement.dml.UpdateStatementContext
   - org.apache.shardingsphere.infra.binder.statement.dml.DeleteStatementContext
   
   For example:
   
   https://github.com/apache/shardingsphere/blob/4ea7c1f4a32b945b9c55396249e0113c078cdbc7/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/statement/dml/SelectStatementContext.java#L100-L112
   
   **Most logic in `SelectStatementContext.<init>` relies on `SelectStatement` only, which means the results of these logic are unchanged** and can be held in somewhere to reduce the overhead. Only those logic relies on parameters should be calculated every time.
   The performance of ShardingSphere may be improved if we can reduce the redundant calculations.
   
   We tested the ShardingSphere-Proxy by BenchmarkSQL 5.0 (TPC-C)
   
   ![image](https://user-images.githubusercontent.com/20503072/153563489-0057fc00-e51d-4d8b-b895-a01f60fa8869.png)
   
   Attachment:
   [flamegraph.zip](https://github.com/apache/shardingsphere/files/8047295/flamegraph.zip)
   
   


-- 
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



[GitHub] [shardingsphere] TeslaCN commented on issue #15358: There are many redundant overhead when creating DMLStatementContext

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


   ShardingSphere-JDBC has cached the `SQLStatementContext` in `ShardingSpherePreparedStatement` to reduce the overhead. We should consider refactoring `PreparedStatement` in ShardingSphere-Proxy to reduce the overhead of creating `SQLStatementContext`.


-- 
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