## System tweaking

This section contains a few options that set how we want the operating system to treat Cherokee.
The File descriptor number (`fdlimit`) limit, defines how many file descriptors the server can handle.
File descriptor number: range values: 64 - 32768, default OS setting (i.e. 1024, etc.).
See also: `ulimit -n fdlimit` shell command.
Keep in mind that the max. number of concurrent connections that can be handled is printed by the server at startup and it is roughly a bit less than (fdlimit / 2).
If the server is very slow in replying to new connections or if it fails to accept new requests under heavy load, you may investigate and, if needed, try to raise this limit.
NOTE: using `select` or `win32` pollers may limit the max. number of file descriptors to a low value (i.e. only 256 per thread, 256 * 5 = 1280).
NOTE: when setting high fdlimit values (i.e. more than 2048 - 4096 fds) if on server system is not available or is not used an efficient fds polling method (i.e. epoll, kqueue, ports), then it is possible that the server slows down on high number of connections because of this fact (inefficient polling method). In this case try to increase the number of threads (reserving at least 32-128 fds per thread) to alleviate the load.
The Thread Number (`thread_number`) specifies the number of worker threads that accept and handle HTTP requests. The real number of threads created is printed by Cherokee at startup.
Thread number: range values: 1 - 1024, default 5 * number of CPUs.
NOTE: Cherokee can be configured and compiled to not use multithreaded code (by only using main process), this can be useful in very small / embedded systems that have very low resources and system requirements.
NOTE: if Cherokee has to serve lots of big files and the server is limited by disk/IO (including disk seeks, etc.), then it can be useful to increase the number of threads in order to lower latencies, otherwise if all file content is cached by OS and no dynamic handler (*CGI) is used, then the number of threads can be lowered. Your mileage may vary.

## Server tweaking

The web server can be configured to use specific system calls under certain circumstances. By using the Polling method it is possible to force the server to use a specific file descriptor polling method even if this is not recommended.

The sendfile minimum and maximum limit can be set to let the server know when to use this system call. Depending on the operating system these limits may vary.
Min. limit: range values: 1 - 2147483647, default: 32768 bytes
Max. limit: range values: 1 - 2147483647, default: 2147483647 bytes (2 GB)

Finally, the Panic Action option allows you to define a program that will be called if, by some reason, the server fails. By default, it should be cherokee-panic.

## Server behaviour

The Reuse Connections field allows to set the number of how many internal connections per thread should be hold for reuse. It's an optimization tweaking option.
Reuse connections: range values: 0 - 128, default 20.

Log flush time sets the number of seconds between log buffer flushes (writes to disk). Setting this number to a value greater than 0 seconds, usually has a significant positive impact on performance but this can lead to a loss of log data in case of an unclean server close or shutdown.
Log flush time: range values: 0 - 60, default 10.

Finally, the Max Keepalive requests allows to specify the max. number of HTTP requests that can be served by each keepalive connection. A high number is usually okay.
Max Keepalive requests: range values: 1 - 2147483647, default 500.