This feature is experimental and needs to be used with the data sharding rule. The cache for sharding route will put the logical SQL, the parameter value of the shard key, and the routing result into the cache, exchange space for time, and reduce CPU usage of the routing logic.
We recommend enabling it only if the following conditions are met:
If the above conditions are not met, the execution delay of SQL may not be significantly improved, and the memory pressure will be increased.
rules:
- !SHARDING
tables:
shardingAlgorithms:
# ...
shardingCache:
allowedMaxSqlLength: 512 # Allow cached SQL length limit
routeCache:
initialCapacity: 65536 # Initial capacity
maximumSize: 262144 # Maximum capacity
softValues: true # Whether to use soft references