Search code examples
amazon-web-servicescachingdisk-io

disk cache/performance question on amazon instances


I observe some behavior on the EC2 instances that I believe it is due to the disk cache. Bascially: I have a calculation task that needs to access large chuck of data sequentially (~60 1GB files). I have included the files to my amazon image. I also use mpi to start ~30 processes to access different files simultaneously. BTW, the program is computation bound but the disk IO takes a decent chunk of run time. I noticed that when I start the instance and perform the calculation on the first try, it is extemely slow. The top command will show the processes were hanging from time to time and cpu usage is around 60%. However, once that run finishes, if I start another run, it is much faster and the cpu is around 99%. Is that because my data was still on a network drive (EBS) and it was loaded to local instance disk cache (SSD drive?) automatically? I ran it on C5n.18xlarge but it is listed as EBS only. Has anyone has similar experiences? Or alternative explanations?


Solution

  • It was almost certainly disk cache, but in RAM, not a local SSD.

    The c5.18xl instance type has 192 GB of RAM. So, depending on what else you're doing with that RAM, it's entirely possible that your 60 GB of data files were read into the cache and never left.

    For more information: https://www.tldp.org/LDP/sag/html/buffer-cache.html