"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/doc/napi_ids.txt" (21 Feb 2022, 2289 Bytes) of package /linux/www/memcached-1.6.15.tar.gz:

As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 NAPI ID based worker thread selection
    2   -N <num_napi_ids>  | --napi_ids=<num_napi_ids>
    4 By default memcached assigns connections to worker threads in a round-robin
    5 manner. NAPI ID based worker thread selection enables worker threads to be
    6 selected based on the NIC HW RX queue on which the incoming request is
    7 received.
    9 This is enabled using SO_INCOMING_NAPI_ID socket option that is supported
   10 in linux kernels 4.12 or higher. This socket option returns a system level
   11 unique ID called NAPI ID that is associated with a RX queue on which the
   12 last packet associated with that socket is received.
   14 This allows memcached to split the incoming flows among threads based on
   15 the RX queue on which they are received. Each worker thread is associated
   16 with a NIC HW receive queue and services all the connection requests
   17 received on a specific RX queue. This mapping between a memcached thread
   18 and a HW NIC queue streamlines the flow of data from the NIC to the
   19 application. In addition, an optimal path with reduced context switches is
   20 possible, if epoll based busy polling
   21 (sysctl -w net.core.busy_poll = <non-zero value>) is also enabled.
   23 This feature is enabled via a new command line parameter -N <num> or
   24 "--napi_ids=<num>", where <num> is the number of available/assigned NIC
   25 hardware RX queues through which requests associated with a connection are
   26 received. The number of napi_ids specified cannot be greater than the number
   27 of worker threads specified using -t/--threads option. If the option is
   28 not specified, or the conditions not met, the code defaults to round robin
   29 thread selection.
   31 During a normal run, each worker thread gets associated with a napi_id and
   32 this will establish a 1:1 mapping between the thread and queues. If a new
   33 napi_id is received after each thread is associated with its own napi_id
   34 (this can happen if num_napi_ids argument doesn't exactly match with the
   35 number of RX queues OR if the NIC driver goes through a reload), a stats
   36 error counter called 'unexpected_napi_ids' is incremented and all the
   37 napi_id's associated with the threads are reset.
   39 If -N option is used, but the connection requests are received from a
   40 virtual interface like loopback, napi_id returned can be 0. This condition
   41 is tracked via a stats counter called 'round_robin_fallback'.