Last modified 4 years ago Last modified on 12/09/09 15:54:15


ktune is a service for server performance tuning.


  1. What is ktune?
  2. What it does
    1. ktune start
    2. ktune stop
  3. How you can use it
  4. How you can extend it
  5. Planned features

1. What is ktune?

The kernel in a Linux system is configured to fit the needs of a lot of customers and use cases. But for certain use cases these defaults might not be appropriate. For example there are use cases where much more shared memory segments are needed as with others. Also the size of network buffers might be important and also the elevator used for block devices to get maximum performance.

Initially the service ktune was created to have a simple way to tune kernel parameters according to a usage profile. Over time this service has been expanded to support multiple profiles and provide more than kernel parameter tuning as well as adding a way for customers to use their own tuning settings.

The package ktune provides a service init script together with a global config file and a sysctl throughput settings file, a directory to store additional profiles and some documentation.


2. What it does

ktune is a system service that is primarily managed by chkconfig. If the service is enabled and started, it will use the configuration options from /etc/sysconfig/ktune:


SYSCTL is the primary ktune sysctl profile. If you comment it out, it will not get applied.

USE_KTUNE_D is a switch, that enables or disabled the use of additional profiles from the /etc/ktune.d directory. A profile has to have the extension .conf to be used. If there is an additional file with the same name, but the extension .sh it will be used as a profile script.

SYSCTL_POST references the system wide sysctl file for customer settings.

ELEVATOR is the I/O scheduler, ktune will set for ELEVATOR_TUNE_DEVS. If you want to disable the setting of the I/O scheduler, just comment out the ELEVATOR line. ktune will not apply any scheduler if a scheduler is set on the kernel command line. It is safe to leave this on "deadline", but "as", "cfq", and "noop" are also legal values. ELEVATOR_TUNE_DEVS references the devices which should be tuned with the ELEVATOR.

2.1. ktune start

When the service starts, it is applying the sysctl settings from the SYSCTL file and afterwards the sysctl settings from the conf files in the /etc/ktune.d directory. For each sysctl settings, that will be modified, it will store the original value in a save file to be able to restore the initial settings if the service is stopped. This way it can easily be evaluated if settings are good or bad for a specific environment. After a profile from the ktune.d directory has been applied, the profile script will be called if available. The script will get the service parameter, the service has been started with: If "service ktune start" has been used, profile scripts will be called with the parameter "start". This way custom settings, for which the sysctl settings file can not be used, can be made.

After applying the sysctl settings, the elevators will be set.

2.2. ktune stop

When the service stopps, it applies the settings saved while starting.

3. How you can use it

The service is managed by chkconfig and can be enabled or disabled for automatic system start and stop. If you want to evaluate settings or want to find te best settings for your system it is save to leave the service disabled and to start or stop it manually with the service command.

To start or stop ktune you can use the service command:

service ktune <start|stop>

To enable or disable ktune for automatic system start, use the chkconfig command:

chkconfig ktune <on|off>

4. How you can extend it

To change the primary profile, use the SYSCTL variable in the ktune sysconfig file. If you want to add additional profiles, put them into the /etc/ktune.d directory altogether with a profile scrip if needed.

Skeleton of a profile scipt:


case "$1" in
        # do something
        # do something
        echo $"Usage: $0 {start|stop}"

exit $RETVAL

5. Planned features

  • Readahead tuning for block devices


$ git clone git://

Browse the GIT repository

Here in the Trac Browser or on ‚Äč