DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] rte_ring's dequeue appears to be slow
@ 2015-04-06 12:18 Dor Green
  2015-04-06 20:43 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Dor Green @ 2015-04-06 12:18 UTC (permalink / raw)
  To: dev

I have an app which captures packets on a single core and then passes
to multiple workers on different lcores, using the ring queues.

While I manage to capture packets at 10Gbps, when I send it to the
processing lcores there is substantial packet loss. At first I figured
it's the processing I do on the packets and optimized that, which did
help it a little but did not alleviate the problem.

I used Intel VTune amplifier to profile the program, and on all
profiling checks that I did there, the majority of the time in the
program is spent in "__rte_ring_sc_do_dequeue" (about 70%). I was
wondering if anyone can tell me how to optimize this, or if I'm using
the queues incorrectly, or maybe even doing the profiling wrong
(because I do find it weird that this dequeuing is so slow).

My program architecture is as follows (replaced consts with actual values):

A queue is created for each processing lcore:
      rte_ring_create(qname, swsize, NUMA_SOCKET, 1024*1024,
RING_F_SP_ENQ | RING_F_SC_DEQ);

The processing core enqueues packets one by one, to each of the queues
(the packet burst size is 256):
     rte_ring_sp_enqueue(lc[queue_index].queue, (void *const)pkts[i]);

Which are then dequeued in bulk in the processor lcores:
     rte_ring_sc_dequeue_bulk(lc->queue, (void**) &mbufs, 128);

I'm using 16 1GB hugepages, running the new 2.0 version. If there's
any further info required about the program, let me know.

Thank you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] rte_ring's dequeue appears to be slow
  2015-04-06 12:18 [dpdk-dev] rte_ring's dequeue appears to be slow Dor Green
@ 2015-04-06 20:43 ` Stephen Hemminger
  2015-04-14 11:58   ` Dor Green
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2015-04-06 20:43 UTC (permalink / raw)
  To: Dor Green; +Cc: dev

On Mon, 6 Apr 2015 15:18:21 +0300
Dor Green <dorgreen1@gmail.com> wrote:

> I have an app which captures packets on a single core and then passes
> to multiple workers on different lcores, using the ring queues.
> 
> While I manage to capture packets at 10Gbps, when I send it to the
> processing lcores there is substantial packet loss. At first I figured
> it's the processing I do on the packets and optimized that, which did
> help it a little but did not alleviate the problem.
> 
> I used Intel VTune amplifier to profile the program, and on all
> profiling checks that I did there, the majority of the time in the
> program is spent in "__rte_ring_sc_do_dequeue" (about 70%). I was
> wondering if anyone can tell me how to optimize this, or if I'm using
> the queues incorrectly, or maybe even doing the profiling wrong
> (because I do find it weird that this dequeuing is so slow).
> 
> My program architecture is as follows (replaced consts with actual values):
> 
> A queue is created for each processing lcore:
>       rte_ring_create(qname, swsize, NUMA_SOCKET, 1024*1024,
> RING_F_SP_ENQ | RING_F_SC_DEQ);
> 
> The processing core enqueues packets one by one, to each of the queues
> (the packet burst size is 256):
>      rte_ring_sp_enqueue(lc[queue_index].queue, (void *const)pkts[i]);
> 
> Which are then dequeued in bulk in the processor lcores:
>      rte_ring_sc_dequeue_bulk(lc->queue, (void**) &mbufs, 128);
> 
> I'm using 16 1GB hugepages, running the new 2.0 version. If there's
> any further info required about the program, let me know.
> 
> Thank you.

First off, make sure you are enqueuing and dequeuing in bursts
if possible. That saves a lot of the overhead.

Also, with polling applications, the dequeue function can be
falsely blamed for taking CPU, if most of the time the poll does
not succeed in finding any data.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] rte_ring's dequeue appears to be slow
  2015-04-06 20:43 ` Stephen Hemminger
@ 2015-04-14 11:58   ` Dor Green
  0 siblings, 0 replies; 3+ messages in thread
From: Dor Green @ 2015-04-14 11:58 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

Dequeuing is done in bulk (that's what shows as CPU consuming, as
well). Enqueuing is not due to some constraint we have.

It seemed likely that the dequeue function is falsely blamed for
taking up CPU, but in my tests there are constant incoming packets so
I don't see when it will poll and receive no packets.
Any other ideas to check?

On Mon, Apr 6, 2015 at 11:43 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Mon, 6 Apr 2015 15:18:21 +0300
> Dor Green <dorgreen1@gmail.com> wrote:
>
>> I have an app which captures packets on a single core and then passes
>> to multiple workers on different lcores, using the ring queues.
>>
>> While I manage to capture packets at 10Gbps, when I send it to the
>> processing lcores there is substantial packet loss. At first I figured
>> it's the processing I do on the packets and optimized that, which did
>> help it a little but did not alleviate the problem.
>>
>> I used Intel VTune amplifier to profile the program, and on all
>> profiling checks that I did there, the majority of the time in the
>> program is spent in "__rte_ring_sc_do_dequeue" (about 70%). I was
>> wondering if anyone can tell me how to optimize this, or if I'm using
>> the queues incorrectly, or maybe even doing the profiling wrong
>> (because I do find it weird that this dequeuing is so slow).
>>
>> My program architecture is as follows (replaced consts with actual values):
>>
>> A queue is created for each processing lcore:
>>       rte_ring_create(qname, swsize, NUMA_SOCKET, 1024*1024,
>> RING_F_SP_ENQ | RING_F_SC_DEQ);
>>
>> The processing core enqueues packets one by one, to each of the queues
>> (the packet burst size is 256):
>>      rte_ring_sp_enqueue(lc[queue_index].queue, (void *const)pkts[i]);
>>
>> Which are then dequeued in bulk in the processor lcores:
>>      rte_ring_sc_dequeue_bulk(lc->queue, (void**) &mbufs, 128);
>>
>> I'm using 16 1GB hugepages, running the new 2.0 version. If there's
>> any further info required about the program, let me know.
>>
>> Thank you.
>
> First off, make sure you are enqueuing and dequeuing in bursts
> if possible. That saves a lot of the overhead.
>
> Also, with polling applications, the dequeue function can be
> falsely blamed for taking CPU, if most of the time the poll does
> not succeed in finding any data.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-14 11:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-06 12:18 [dpdk-dev] rte_ring's dequeue appears to be slow Dor Green
2015-04-06 20:43 ` Stephen Hemminger
2015-04-14 11:58   ` Dor Green

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).