简体   繁体   English

osx:如何找到磁盘I / O缓存的大小(例如,写入缓存)

[英]osx: how do I find the size of the disk i/o cache (write cache, for example)

I am looking to optimize my disk IO, and am looking around to try to find out what the disk cache size is. 我正在寻求优化磁盘IO,并四处寻找磁盘高速缓存的大小。 system_profiler is not telling me, where else can I look? system_profiler没有告诉我,我还能去哪里?

edit: my program is processing entire volumes: I'm doing a secure-wipe, so I loop through all of the blocks on the volume, reading, randomizing the data, writing... if I read/write 4k blocks per IO operation the entire job is significantly faster than r/wa single block per operation. 编辑:我的程序正在处理整个卷:我正在做一次安全擦除,所以我遍历卷上的所有块,读取,随机化数据,写入...如果我每个IO操作读取/写入4k块整个作业的速度明显快于每个操作的r / wa单个程序段。 so my question stems from my search to find the ideal size of ar/w operation (ideal in terms of performance:speed). 所以我的问题源于我的搜索,以找到理想的ar / w操作大小(在性能方面是理想的:速度)。 please do not point out that for a wipe-program I don't need the read operation, just assume that I do. 请不要指出,对于擦除程序,我不需要读取操作,只需假设我需要。 thx. 谢谢。

Mac OS X uses a Unified Buffer Cache. Mac OS X使用统一缓冲区缓存。 What that means is that in the kernel VM objects and files are them at some level, same thing, and the size of the available memory for caching is entirely dependent on the VM pressure in the rest of the system. 这意味着在内核中,VM对象和文件在某种程度上是相同的,并且可缓存的可用内存大小完全取决于系统其余部分中的VM压力。 It also means the read and write caching is unified, if an item in the read cache is written to it just gets marked dirty and then will be written to disk when changes are committed. 这也意味着读和写缓存是统一的,如果将读缓存中的项目写入其中,只是被标记为脏,然后在提交更改时将其写入磁盘。

So the disk cache may be very small or gigabytes large, and dynamically changes as the system is used. 因此,磁盘缓存可能很小,也可能只有千兆字节,并且会随着使用系统而动态变化。 Because of this trying to determine the cache size and optimize based on it is a losing fight. 因此,尝试确定缓存大小并基于缓存进行优化是一场失败的斗争。 You are much better off looking at doing things that inform the cache how to operate better, like checking with the underlying device's optimal IO size is, or identifying data that should not be cached and using F_NOCACHE. 您最好查看通知缓存如何更好操作的事情,例如检查基础设备的最佳IO大小,或者识别不应该缓存的数据并使用F_NOCACHE。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM