Introduction

Table of Contents

Infrastructure

           requests             dispatch
listener -----------> workers ------------> epoll_wait
           eventfd

main thread

start server and start event loop for signal

server_startup(&server);

{ // signal handling
    sigemptyset(&sigset);
    sigaddset(&sigset, SIGINT);
    sigfillset(&sigset);
    do {
        int signo = sigwaitinfo(&sigset, &siginfo);
        if (signo == -1) {
            if (errno == EAGAIN || errno == EINTR) {
                continue;
            }
            break;
        }
        mlog_info("[%s] signal: %s", __func__, strsignal(siginfo.si_signo));
        if (siginfo.si_signo == SIGINT) {
            mlog_info("[%s] quitting", __func__);
            break;
        }
    } while (1);
}

server_shutdown(&server);

Benchmark

ab - Apache HTTP server benchmarking tool

Syntax

ab [ -A auth-username:password ] [ -b windowsize ] [ -B local-address ]
 [ -c concurrency ] [ -C cookie-name=value ] [ -d ] [ -e csv-file ]
 [ -f protocol ] [ -g gnuplot-file ] [ -h ] [ -H custom-header ]
 [ -i ] [ -k ] [ -n requests ] [ -p POST-file ] [ -P proxy-auth-username:password ]
 [ -q ] [ -r ] [ -s timeout ] [ -S ] [ -t timelimit ] [ -T content-type ]
 [ -u PUT-file ]  [  -v verbosity] [ -V ] [ -w ] [ -x <table>-attributes ]
 [ -X proxy[:port] ] [ -y <tr>-attributes ] [ -z <td>-attributes ]
 [ -Z ciphersuite ] [http[s]://]hostname[:port]/path

Example

ab -c 1000 -n 10000 http://localhost:8000/

References