## ProFTPD module `mod_fsync`

On some kernels and/or filesystems, if there are files opened simultaneously for reading and writing, the buffer cache algorithms may cause the write I/O to swamp the read I/O, causing processes that are reading files to slow down because of buffer cache misses. The Linux 2.4 kernel, for example, suffers from this problem.

The `mod_fsync` module attempts to prevent such bottlenecks by forcibly flushing to disk the buffers used for files open for writing after a certain number of bytes have been written (for example, after 128 KB has been written to a file). This prevents the buffer cache from being dominated by data from files being written, freeing up space for data for files being read.

This module is contained in the `mod_fsync.c` file for ProFTPD 1.2.10rc1 and later, and is not compiled by default. Installation instructions are discussed here.

The most current version of `mod_fsync` can be found at:

      http://www.castaglia.org/proftpd/

## Author

Please contact TJ Saunders <tj at castaglia.org> with any questions, concerns, or suggestions regarding this module.

## Directives

- FsyncEngine
- FsyncLog
- FsyncThreshold

## FsyncEngine

Syntax: FsyncEngine on|off
Default: FsyncEngine off
Context: server config
Module: mod_fsync
Compatibility: 1.2.10rc1 and later

The `FsyncEngine` directive enables or disables the module's runtime sync engine. If it is set to off this module does no flushing of data outside of the normal I/O usage. Use this directive to disable the module.

## FsyncLog

Syntax: FsyncLog path
Default: None
Context: server config
Module: mod_fsync
Compatibility: 1.2.10c1 and later

The `FsyncLog` directive is used to a specify a log file for `mod_fsync` reporting and debugging. The path parameter must be the full path to the file to use for logging. Note that this path must not be to a world-writeable directory and, unless `AllowLogSymlinks` is explicitly set to on (generally a bad idea), the path must not be a symbolic link.

## FsyncThreshold

Syntax: FsyncThreshold size
Default: None
Context: server config
Module: mod_fsync
Compatibility: 1.2.10rc1 and later

The `FsyncThreshold` directive configures a threshold value, in bytes. When this number of bytes has been written, `mod_fsync` will walk the list of files currently open for writing, and will forcibly flush the data for those files to disk.

Note: This directive is required for `mod_fsync` to operate.

## Installation

To install `mod_fsync`, copy the `mod_fsync.c` file into:

      proftpd-dir/contrib/

after unpacking the latest proftpd-1.2.x source code. Then follow the usual steps for using third-party modules in proftpd:

      ./configure --with-modules=mod_fsync
      make
      make install

## Usage

Example Configuration

      <IfModule mod_fsync.c>
        FsyncEngine on
        FsyncLog /etc/ftpd/var/fsync.log
        FsyncThreshold 131072 # 128KB
      </IfModule>

Author: $Author: tj $
Last Updated: $Date: 2004/11/04 20:19:35 $

© Copyright 2004 TJ Saunders
All Rights Reserved