# xSQL Automatic Restart

> It is possible to cause xSQL to automatically restart after it has been terminated abruptly. (Note that currently this feature is implemented only on Linux platforms.)

> ### For an overview see page xSQL Server Instrumentation

> When xSQL is running in server mode as a `daemon` (by specifying the option `-daemon` on the command line), the server process is forked. The parent process is then put into a wait state and waits for the child xSQL process to terminate. If the xSQL child is terminated normally, the parent is also terminated. If the child process is terminated abruptly (via a segfault of any kind), the parent process forks another child. If the database is in-memory-only (containing only transient classes ) then the new child process opens an empty database. If however the database is disk-based (containing only persistent classes) the new child process connects it.

> The automatic restart is regulated through the configuration file by xlog_params options:

>         xlog_params : {
>             # Turn automatic restart on (true) or off (false) (default=true)
>             restart_server : true,

>             # Maximum number of restarts if the current server is terminated “too quickly“;
>             # i.e. the server is up for less than restart_quick_fail_time milliseconds.
>             # (default=3)
>             restart_n_quick_fail : 3,

>             # The time in milliseconds that is considered “too small”. Thus if the server is up
>             # for less than this number of milliseconds, it is restarted restart_n_quick_fail
>             # times before the parent process is terminated. (default=10*1000 i.e. 10 seconds)
>             restart_quick_fail_time : 10000,
>         }