如何检测我的查询结果是否是从 WiredTiger 缓存中检索到的? [英] How to detect if my query result is retrieved from WiredTiger cache?

查看:31
本文介绍了如何检测我的查询结果是否是从 WiredTiger 缓存中检索到的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Mongo 3.4 版,存储引擎是 WiredTiger.正如 文档 所说,Mongo 确实使用缓存用于适合 RAM 的工作集.

I'm using Mongo version 3.4, storage engine is WiredTiger. As the document says, Mongo does use cache for working set that fits in RAM.

所以我的问题是

  1. 有什么方法可以检查我的查询结果是否来自缓存?
  2. 如果我的工作集大于 RAM 怎么办?Mongo 会清除缓存,还是会驱逐一些数据?
  3. 关于学习 Mongo 缓存机制的良好资源的任何建议

推荐答案

WiredTiger 缓存是保留供 WiredTiger 使用的内存的通用术语.此内存包含未压缩的集合数据、索引、脏"内容(修改后的文档)等.

The WiredTiger cache is a generic term for memory reserved for use by WiredTiger. This memory contains uncompressed collection data, indexes, "dirty" content (modified documents), etc.

回答您的问题:

有什么方法可以检查我的查询结果是否来自缓存?

Is there any way I can check if my query result is served from cache or not ?

任何查询都会导致 WiredTiger 以未压缩的形式将文档从磁盘加载到其内存部分(所谓的缓存")中.因此,所有查询回复都来自缓存".

Any query will result in WiredTiger loading the document from disk into its part of memory (the so-called "cache") in an uncompressed form. Therefore all query replies are served from the "cache".

如果我的工作集大于 RAM 怎么办?Mongo 会清除缓存,还是会驱逐一些数据?

What if my working set is larger than RAM ? Would Mongo clear the cache, or would it evict some data ?

它会根据需要从缓存中驱逐数据.如果需要逐出的数据是脏的",则作为逐出过程的一部分,还需要将其写入磁盘.

It will evict data from the cache as necessary. If the data that needs to be evicted are "dirty", it will also need to be written to disk as part of the eviction process.

任何关于学习 Mongo 缓存机制的好资源的建议

Any suggestion for good resources to learn about Mongo caching mechanism

MongoDB 文档中有一些关于它的一般描述:

There are some general description of it in MongoDB documentation:

有关更深入的文档,请参阅 WiredTiger 文档.

For more in-depth documentation, please see the WiredTiger documentation.

这篇关于如何检测我的查询结果是否是从 WiredTiger 缓存中检索到的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆