问题原文
原帖链接 · Shayne Fitzgerald · CC BY-SA 4.0
We have a server with 64GB of total RAM, applications are using typically a maximum of 30GB of that available RAM. One of those applications deals with a lot of flat files, and we're having throughput issues, namely waiting on disk I/O. While exploring possible solutions the idea of a RAM disk came up. The problem I have with a RAM disk is the inherent volatility.
I've found separate documentation on RAM disks, RAID 1 configuration, and Logical Mirrored Volumes to group physical disks, but I can't seem to find any documentation that suggests if either of these disk replication solutions can be used with a RAM disk. More importantly since the idea is to have the RAM disk be available for read/write, and have the physical disk "shadowing" the RAM disk, catching up with writes, we would want the RAM disk to be the "primary" disk for all reads/writes.
To note, we would like to avoid merely RAM caching the files with the OS, but if we can get the same performance as a stand-alone RAM disk, that could work. We initially avoided this since often times certain files will not be accessed for long periods of time, but still need the read/write speed on-demand.
已采纳解答
原帖链接 · forest · CC BY-SA 4.0
To note, we would like to avoid merely RAM caching the files with the OS, but if we can get the same performance as a stand-alone RAM disk, that could work. We initially avoided this since often times certain files will not be accessed for long periods of time, but still need the read/write speed on-demand.
You could use vmtouch to solve your problem. This is a utility which allows you to pin certain files or even entire directories and everything under them in the page cache so they do not get evicted, even if they are not accessed for long periods of time (which was your initial reason for not simply relying on the page cache). This requires at most the same amount of memory as your RAM disk, or less in practice. You'll still be using the page cache, but it will result in similar performance to using a RAM disk for everything (actually superior performance as the MD driver will not be involved).
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
