课程: Linux Performance Tuning

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Examples of filesystem caching

Examples of filesystem caching - Linux教程

课程: Linux Performance Tuning

Examples of filesystem caching

- [Instructor] Let's look at some examples of some caching stuff and performance. So here's a little script, diskcache.sh. The first line creates a file called bigfile. The output file is bigfile. The input is dev zero. Whenever you read from that, you just get binary zeros. We're saying a block size of one meg and do that 4,000 times. So we're going to create a four gigabyte file called bigfile. It's going to be all zeroes. Now, DD did that reading and it wrote out to that file. But again, it's all going into RAM and it hasn't necessarily been written out to disk yet. We're going to do the sync command, which will force that to be written out to disk. So that's going to take a bit of time. Then, we're going to use bigfile as an input file with a block size of 4K, and we're just going to throw it away to dev/null. But that's going to force us to read the file. Now if it's cached, we're actually going to be reading it out of RAM. If it's not cached, then we're going to have to go to…

内容