I am using /run/shm/myfolder
for nginx micro caching, also keeping ngx_pagespeed
files there. I am wondering if there will be a speed increase if I go from relatime
to noatime
? It's for HDD, but on a tmpfs
what will it change?
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=9929500k)
Best Answer
The reason for using
noatime
orrelatime
on an actual disk is that without it reads will also involve writing to disk. This additional writing can slow down the system, cause disks to spin up which would otherwise have remained spun down for much longer, as well as cause wear on flash media.But with tmpfs no data ever has to be written to disk. The data may be written to swap, but only if needed to free up RAM for other data. This means frequent updates on tmpfs are no more expensive than frequent reads because in both cases the effect will be that the data is kept in memory.
Moreover tmpfs only swaps out the file contents. The meta data (including timestamps) simply stays in RAM. Thus we are really just talking about whether to update a time stamp in memory, which is very cheap compared to the actual read operation triggering it in the first place.
For those reasons it is unlikely that there will be a measurable performance difference between using
noatime
,relatime
, or neither on a tmpfs.