How is the cache hit rate of the Coprocessor calculated?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: Coprocessor 的缓存命中率是怎么计算出来的

| username: Raymond

Dear teachers, could you please explain how the copr_cache_hit_ratio in explain analyze is calculated? I always see the result as either 0 or 1, but how is the 75% mentioned in the documentation calculated?

| username: xfworld | Original post link

This article has a very detailed description.

More details:

| username: Kongdom | Original post link

Is it related to the number of nodes? Are you testing with multiple nodes over there?

| username: 人如其名 | Original post link

The cache hit rate is the ratio of cop_task cache hits to the total number of cop_tasks, which is cop_task(cache hits)/total_cop_task. Whether the cache is hit depends on the region version information in TiKV (it is speculated that a new version is generated when the data in the region changes, and if the version does not change, it is a hit). After a hit, TiDB’s copr_cache uses the key generated by the cop_task request (copRequest) to find the value from the last request. Network overhead is unavoidable, but there is no need to rescan the data in TiKV.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.