DPDK usage discussions
 help / color / mirror / Atom feed
From: Pavel Vazharov <freakpv@gmail.com>
To: Hao Chen <earthlovepython@outlook.com>
Cc: "users@dpdk.org" <users@dpdk.org>
Subject: Re: [dpdk-users] What is TCP read performance by using DPDK?
Date: Fri, 16 Apr 2021 09:00:02 +0300	[thread overview]
Message-ID: <CAK9EM19=Npxbji2aY7Gwjy-QTBwsEUYefOmfXSRRpdZgwyJtNg@mail.gmail.com> (raw)
In-Reply-To: <BYAPR04MB4167D19F94560D628840EB21B24D9@BYAPR04MB4167.namprd04.prod.outlook.com>

Hi Hao,

The current design of the application very roughly is following:
1. There is one main thread which pumps out the packets from the NIC queues
using rte_eth_rx_burst(), as you said. In the future we may need several
main threads to be able to scale the application. Each one of them will
work on separate groups of RX queues. The main thread distributes the
received packets to N other threads using single producer single consumer
rings provided by DPDK (rte_ring).
2. Each one of these N other threads runs a separate F-stack version. As I
said we use a networking stack per thread and share nothing design. Let's
call them worker threads for now.
3. Each worker thread has its own spsc_ring for the incoming packets and
uses a separate NIC queue to send the outgoing packets using
rte_eth_tx_burst.
The main loop of such worker thread looks roughly in the following way
(pseudo code):
while (not stopped) {

    if (X_milliseconds_have_passed)

        call_fstack_tick_functionality();



    send_queued_fstack_packets(); // using rte_eth_tx_burst



    dequeue_incoming_packets_from_spsc_ring();



    enqueue_the_incoming_packets_to_the_fstack();



    if (Y_milliseconds_have_passed)

        process_fstack_socket_events_using_epoll();

}
You may not the following things from the above code.
- The packets are sent (rte_eth_tx_burst) in the same thread where the
socket events are processed. The outgoing packets are also sent if we queue
enough of them while processing socket write events but this will
complicate the explanation here.
- The timer events and the socket events are not processed on each
iteration of the loop. These milliseconds come from a config file and are
measured using rte_rdtsc.
- The loop is very similar to the one present in the F-stack itself -
https://github.com/F-Stack/f-stack/blob/dev/lib/ff_dpdk_if.c#L1817. It's
just that in our case this loop is decoupled from the F-stack because we
removed the DPDK from the F-stack in order to use the latter as a separate
library and use a separate networking stack per thread.
4. The number of worker threads is configurable via the application config
file and the application sets up the NIC with the same number of RX/TX
queues as the number of worker threads. This way the main thread pumps out
packets from N RX queues and each worker thread enqueues packets to each
own TX queue i.e. there is no sharing. So the application may run with
single RX/TX queue and then it'll have one main thread and one worker
thread. Or may run with 10 RX/TX queues and then it'll have 1 main thread
and 10 worker threads. It depends on the traffic amount that we expect to
handle, the NIC capabilities, etc.

Regards,
Pavel.

      reply	other threads:[~2021-04-16  6:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 23:06 Hao Chen
2021-03-29  8:38 ` Pavel Vazharov
2021-04-15  5:59   ` Hao Chen
2021-04-15  6:57     ` Pavel Vazharov
2021-04-15 16:03       ` Hao Chen
2021-04-16  6:00         ` Pavel Vazharov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK9EM19=Npxbji2aY7Gwjy-QTBwsEUYefOmfXSRRpdZgwyJtNg@mail.gmail.com' \
    --to=freakpv@gmail.com \
    --cc=earthlovepython@outlook.com \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).