System Configuration

This section explains how to fine tune some Linux system configuration parameters for improved performance.

File Descriptors

The streaming components use one file descriptor for each active client connection, such as an individual viewing your video. Hence, the limit on the number of file descriptors per process also limits the number of client connections per process.

A Linux system has a global limit on the number of open file descriptors which is defined in the kernel and global system configuration. Linux systems also typically have per-process limits which can be different for particular users or groups of users. There is both a soft and hard limit. The hard limit specifies the upper limit to which a process can raise its soft limit. The current limit for your process can be discovered using the ulimit -n command in a terminal.

Typically, systems are limited to 1024 open file descriptors for each non-root process. Depending on the system you run on, this limit can be changed in various ways.

On most distributions of Linux, such as Fedora Linux, Red Hat Linux, and Ubuntu Linux, , this limit can be changed like so:

  1. Edit /etc/security/limits.conf as root. At the end of the file, add a line that reads

    flumotion    -    nofile    8192
    

    Replace flumotion with the username (or group name, prefixed with @) that the server will run under.

    Replace 8192 with the maximum number of open file descriptors you want to allow.

  2. Verify that this works by doing the following:

    On Fedora Linux or Red Hat Linux, as root:

    su -s /bin/bash -c "ulimit -n" flumotion

    On Ubuntu Linux:

    sudo su -s /bin/bash -c "ulimit -n" flumotion

    This will show the allowed number of open file descriptors:

    8192
    
[Note] Note

Due to the way PAM [2] and sshd are set up by default on Fedora Linux and Red Hat Linux, you might not be able to log in to this account any more using ssh. So let's correct that:

  1. Edit /etc/pam.d/sshd as root. Make sure this file contains a line that reads

    session    required     pam_limits.so
    

  2. Edit /etc/ssh/sshd_config as root. Turn off privilege separation by adding the following line

    UsePrivilegeSeparation no
    

  3. Restart the ssh daemon:

    [root@server root]# service sshd restart
    Stopping sshd:                                             [  OK  ]
    Starting sshd:                                             [  OK  ]
    [root@server root]#
    

  4. Verify that it works by trying to log in through ssh as the user:

    [flumotion@server flumotion]$ ssh localhost
    flumotion@localhost's password:
    [flumotion@server flumotion]$ ulimit -n
    8192
    

Memory limits

Like all software, Flumotion and its dependencies can never be completely free of all bugs. In extreme cases, GStreamer might cause Flumotion to fail by trying to allocate too much memory, for instance due to a demuxing error or a programming error.

If you are lucky, the number is sufficiently small and the buffer can be allocated from actual RAM. If you're slightly less lucky, the number is so big that the machine just doesn't have enough RAM and swap to allocate, and the program terminates. (6 hours of CD quality audio is more than 4 GB). If you're really unlucky, the number is huge, but in between your available RAM and your available RAM + swap. In that case, the allocation will succeed, and this will drive your machine into a huge swap storm as soon as the buffer gets written to.

The same file that controls limits on the number of file descriptors can also control the amount of memory a process of a user is allowed to take. The current virtual memory limit for your process can be inspected using ulimit -v in bash(1).

Most Linux distributions have this set to unlimited by default.

Linux systems using PAM

On systems that use PAM, this limit can be changed:

  1. Edit /etc/security/limits.conf as root. At the end of the file, add a line that reads

    flumotion        -    as              512000
    

    Replace flumotion with the username (or group name, prefixed with @) that the server will run under.

    Replace 512000 with the maximum number of KB that you want to allow.

  2. Verify that this works by doing the following as root:

    On Fedora Linux or Red Hat Linux, as root:

    su -s /bin/bash -c "ulimit -v" flumotion

    On Ubuntu Linux:

    sudo su -s /bin/bash -c "ulimit -v" flumotion

    Which will show the number of KB that a process is allowed to allocate:

    512000
    


[2] Pluggable Authentication Modules. See pam-home