Skip to main content

Buffered I/O vs. Direct I/O

Buffered I/O vs. Direct I/O

In general, most of the supported UNIX®, Linux, and macOS file systems and operating systems offer two distinct I/O options, using either program control, a mount option, or both:

  • Buffered I/O, in which the operating system caches reads and writes, is the default.

  • Direct I/O is an option in which reads and writes bypass the operating system cache. Some platforms further distinguish an optimized form of direct I/O, called concurrent I/O which, if offered, is preferred.

The use of buffered and direct I/O in Caché varies by platform, file system, and the nature of the files that are stored on the file system, as follows:

  • Journal files

    Some platforms have specific recommendations to use direct or concurrent I/O mount options for optimal performance, as documented in “Supported File Systems” in the online InterSystems Supported PlatformsOpens in a new tab document for this release. On other platforms, Caché uses direct I/O automatically for journal files as appropriate and no special consideration is required.

  • Installation files, executables, and system databases

    This file system should be mounted to use buffered I/O (the default option, and on some platforms the only option).

  • Databases (CACHE.DAT files)

    The use of direct I/O (or concurrent I/O) varies in order to optimize I/O characteristics for database files on each platform, as detailed in the following. In all cases, Caché uses its own database cache, so buffering at the operating system level is not advantageous for database files. You must ensure that sufficient database cache is configured; this is particularly true on platforms on which Caché utilizes direct I/O, since operating system buffering cannot make up for an insufficient database cache.

    • IBM AIX

      Caché uses concurrent I/O for database files regardless of whether the cio file system mount option is used.

      Note:

      On AIX, in unusual configurations in which an external command is used to read a database file while Caché is running, the external command may fail because the file is opened for concurrent I/O by Caché. An example is performing an external backup using the cp command instead of a more sophisticated backup or snapshot utility. Mounting the file system with the cio option resolves this by forcing all programs to open files with concurrent I/O.

    • Linux

      Caché uses buffered I/O for database files. If using the VxFS file system, this can be overridden by mounting the file system for concurrent I/O with the cio mount option.

    • macOS

      Caché uses buffered I/O for database files.

  • External application files and streams

    Applications that use external files typically benefit from those files being located on a buffered file system.

FeedbackOpens in a new tab