Will noatime on a tmpfs volume improve performance?
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)
Solution 1:
The reason for using noatime
or relatime
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.
Solution 2:
In theory I agree with what @kasperd said. However, I decided to try the change on my very busy tmpfs backing munin data, and it immediately provided an 8% decrease in total munin processing time.
This fs has 300,000+ files that each get touched every 5 minutes, and every bit of performance I get helps, so 8% was pretty significant.