Proposal for a O_NOATIME open(2) Flag

Here’s an idea I had the other day while talking to Jonathan.

Engineers often know that when designing a database that the filesystem should NOT update the ‘atime’ filesystem attribute.

This can be expensive. On DBs that use LOTs of small files this can be a few orders of magnitude slower.

The problem is that the designer of the DB and the system administrator who deploys the system often never communicate. The sysadmin might not deploy the system with the noatime mount option.

This is where O_NOATIME comes into play. XFS and ext3 could pay attention to this attribute and not update the atime attribute for a file when it’s set.

This would allow your DB to perform optimally even when the configuration is incorrect.

Another idea could be for the DB to detect mount options at runtime and issue a warning into the log file with steps on how to correct the problem.

  1. If you are writing a db, just set:
    chattr +A filename

    (there is some C api to do this too, I just don’t remember what it is called right now)

    So, there doesn’t need to be any coordination between admins and coders, just coders need to add a few more lines of code when they create files.

  2. Hey Paul… Good catch!

    chattr is ext3 specific, is it not?

    …. though that might be fine if you could detect it at runtime and XFS supported a similar feature.


  3. This also leaves open the question of mtime? There is no ‘nomtime’ option from what I can tell.

    If one were to presize a DB table and could disable atime and mtime updating then you could have 100% append based operation.


%d bloggers like this: