Reverbrain wiki

Site Tools


thevoid:configuration

TheVoid

TheVoid is C++ library for building asynchronous HTTP servers. It provides several high-level interfaces for processing incoming HTTP connections and for application configuration.

TheVoid provides common support for reading json configuration files, usually path to file should be passed by –config command-line option.

Server configuration

Here is example of server application configuration file:

config.json
{
    "endpoints": [
        "0.0.0.0:8080",
        "unix:test.sock"
    ],
    "daemon": {
        "fork": true,
        "uid": 1000
    },
    "monitor-port": 20000,
    "buffer_size": 65536,
    "backlog": 128,
    "threads": 8,
    "logger": {
        "file": "/dev/stderr",
        "level": 4
    },
    "application": {
        "remotes": [
            "localhost:1025:2"
        ],
        "groups": [
            1,
            2,
            3
        ]
    }
}

Now the same configuration file with per-line explanations:

Endpoints are list of listening tcp and unix sockets.

{
    "endpoints": [
        "0.0.0.0:8080",
        "unix:test.sock"
    ],

Thevoid support daemonization, fork entire process pass true to fork field. Setting uid is possible for setuid call for drop root privileges.

    "daemon": {
        "fork": true,
        "uid": 1000
    },

TheVoid can return statistics information by requests to monitor port. Common usage is:

echo i | netcat example.org 20000
    "monitor-port": 20000,

It's possible to configure per-socket buffer size used for data reading. Default value is 8KB.

    "buffer_size": 65536,

Backlog is property of listening sockets, it determines limit of queue with not yet processed incoming connections.

    "backlog": 128,

Threads property determines number of working threads.

    "threads": 8,

To configure the logger set file where to write and logger level. Higher logger level means more verbosity.

    "logger": {
        "file": "/dev/stderr",
        "level": 4
    },

This part of configuration part is application-specific. Current example shows configuration for elliptics http proxy.

    "application": {
        "remotes": [
            "localhost:1025:2"
        ],
        "groups": [
            1,
            2,
            3
        ]
    }
}

Server monitoring

Monitoring currently accepts two commands:

  • h - returnes list of supported commands
  • i - returnes statistics information:
{
    "connections": 132,
    "active-connections": 78
}

connections - number of currently opened HTTP connections in terms of HTTP 1.1. active-connections - number of connections which process some request at current moment.

So there are 132 opened HTTP 1.1 connections between nginx and application, and only 78 of them process are processing some requests right now.

thevoid/configuration.txt · Last modified: 2013/11/01 07:11 by elessar