kangkaisen commented on a change in pull request #4479:
URL: https://github.com/apache/incubator-doris/pull/4479#discussion_r478804908
##########
File path: docs/zh-CN/administrator-guide/query_cache.md
##########
@@ -0,0 +1,184 @@
+---
+{
+ "title": "QUERY CACHE",
+ "language": "zh-CN"
+}
+---
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+# QUERY CACHE
+
+
+
+## 一 需求
+
+虽然在数据库层也做了对应的缓存,但这种数据库层次的缓存一般针对的是查询内容,而且粒度也太小,一般只有表中数据没有变更的时候,数据库对应的cache才发挥了作用。但这并不能减少业务系统对数据库产生的增、删、查、改的庞大IO压力。所以数据库缓存技术在此诞生,实现热点数据的高速缓存,提高应用的响应速度,极大缓解后端数据库的压力
+
+- 高并发场景
+ Doris可以较好的支持高并发,但单台服务器无法承载太高的QPS
+
+- 复杂图表的看板
+ 复杂的Dashboard或者大屏类应用,数据来自多张表,每个页面有数十个查询,虽然每个查询只有数十毫秒,但是总体查询时间会在数秒
+
+- 趋势分析
+ 给定日期范围的查询,指标按日显示,比如查询最近7天内的用户数的趋势,这类查询数据量大,查询范围广,查询时间往往需要数十秒
+
+- 用户重复查询
+ 如果产品没有防重刷机制,用户因手误或其他原因重复刷新页面,导致提交大量的重复的SQL
+
+
+
+以上四种场景,在应用层的解决方案,把查询结果放到Redis中,周期性的更新缓存或者用户手工刷新缓存,但是这个方案有如下问题:
+
+- 数据不一致
+ 无法感知数据的更新,导致用户经常看到旧的数据
+
+- 命中率低
+ 缓存整个查询结果,如果数据实时写入,缓存频繁失效,命中率低且系统负载较重
+
+- 额外成本
+ 引入外部缓存组件,会带来系统复杂度,增加额外成本
+
+
+
+## 二 解决方案
+
+目前我们设计出结果缓存和分区缓存两个模块
+
+
+
+## 三 名词解释
+
+1. 结果缓存 result_cache
+
+针对用户的sql直接缓存查询的结果集合
+
+
+
+2. 分区缓存 partition_cache
+
+在partition粒度做针对每个分区查询的结果缓存
+
+
+
+## 四 设计原理
+
+### 1 结果缓存 `result_cache`
Review comment:
每种cache最好给下 典型的应用场景。
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]