DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Question on the Ring Library
@ 2013-12-04 11:46 Sambath Kumar Balasubramanian
  2013-12-04 13:47 ` François-Frédéric Ozog
  2013-12-04 21:25 ` Stephen Hemminger
  0 siblings, 2 replies; 9+ messages in thread
From: Sambath Kumar Balasubramanian @ 2013-12-04 11:46 UTC (permalink / raw)
  To: dev

Hi,

  The ring library seems to be an excellent IPC. But looking at one use
case where the fast path code posts events to event thread for example, the
event thread will spend some cycles polling the ring rather than waiting
for the event. One approach could be a fast path code basically posts the
event in the ring as is today and there is a background thread that polls
the queues and wakes up the event threads. This is similar to Linux
SOFTIRQs.The event threads are asynchronous. Is this a fair model to avoid
extra polling CPU cycles by the event threads? Is there any other
alternatives in dpdk?

Regards,
Sambath

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

* Re: [dpdk-dev] Question on the Ring Library
  2013-12-04 11:46 [dpdk-dev] Question on the Ring Library Sambath Kumar Balasubramanian
@ 2013-12-04 13:47 ` François-Frédéric Ozog
  2013-12-04 14:00   ` Sambath Kumar Balasubramanian
  2013-12-04 21:25 ` Stephen Hemminger
  1 sibling, 1 reply; 9+ messages in thread
From: François-Frédéric Ozog @ 2013-12-04 13:47 UTC (permalink / raw)
  To: 'Sambath Kumar Balasubramanian'; +Cc: dev

Hi

On a 10Gbps link, there is a new packet every 650ns on average on each
direction. So handling latency is extremely important.

Traditional "fast" userland mutexes involves system call and scheduling
costs (look at the kernel code: it is "hairy"). I measured difference
between mutex controlled fifo and DPDK controlled fifo on a Xeon E5-2680v2,
1867MHz RAM: for times the performance... I consider the cost of a mutex
lock is something close to 400ns on average (well I don't say that it always
costs that, but the delays can be not predictable and extremely high - I saw
a few ms even if you use isolcpus and precise affinities-). So if you plan
to do 10Gbps stuff, I guess polling is the only way to go.

François-Frédéric


> -----Message d'origine-----
> De : dev [mailto:dev-bounces@dpdk.org] De la part de Sambath Kumar
> Balasubramanian
> Envoyé : mercredi 4 décembre 2013 12:47
> À : dev@dpdk.org
> Objet : [dpdk-dev] Question on the Ring Library
> 
> Hi,
> 
>   The ring library seems to be an excellent IPC. But looking at one use
> case where the fast path code posts events to event thread for example,
the
> event thread will spend some cycles polling the ring rather than waiting
> for the event. One approach could be a fast path code basically posts the
> event in the ring as is today and there is a background thread that polls
> the queues and wakes up the event threads. This is similar to Linux
> SOFTIRQs.The event threads are asynchronous. Is this a fair model to avoid
> extra polling CPU cycles by the event threads? Is there any other
> alternatives in dpdk?
> 
> Regards,
> Sambath

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

* Re: [dpdk-dev] Question on the Ring Library
  2013-12-04 13:47 ` François-Frédéric Ozog
@ 2013-12-04 14:00   ` Sambath Kumar Balasubramanian
  2013-12-04 20:02     ` François-Frédéric Ozog
  0 siblings, 1 reply; 9+ messages in thread
From: Sambath Kumar Balasubramanian @ 2013-12-04 14:00 UTC (permalink / raw)
  To: François-Frédéric Ozog; +Cc: dev

Thanks François-Frédéric. That puts real good perspective on the cost for
the vent assuming each packet in the fast will result
in an event. If event rate is orders of magnitude less than the packet
rate, then I guess we can still achieve 10G since the "extra cost" will be
in the event thread and not in the fast path thread.

Regards,
Sambath

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

* Re: [dpdk-dev] Question on the Ring Library
  2013-12-04 14:00   ` Sambath Kumar Balasubramanian
@ 2013-12-04 20:02     ` François-Frédéric Ozog
  2013-12-04 21:49       ` Sambath Kumar Balasubramanian
  0 siblings, 1 reply; 9+ messages in thread
From: François-Frédéric Ozog @ 2013-12-04 20:02 UTC (permalink / raw)
  To: 'Sambath Kumar Balasubramanian'; +Cc: dev

You are welcome !

 

Even if you insert packets in batch into a fifo, the mutex is still
unpredictable. If one pthread_lock costs 1ms, you are going to lose packets,
regardless of the number of RSS queues and ring sizes… Batching comes with
another issue: need to flush a batch after a certain timeout if you do not
have packets. Userland timer resolution is such that you are introducing
port to port latency quite a lot: DPDK native, you can manage to get a 2µs
latency (including PCI express), while with batch it may be 1ms… You may
find smarter algorithms but still you will be an order of magnitude higher
than DPDK.

 

Hope this helps.

 

François-Frédéric

 

De : Sambath Kumar Balasubramanian
[mailto:sambath.balasubramanian@gmail.com] 
Envoyé : mercredi 4 décembre 2013 15:01
À : François-Frédéric Ozog
Cc : dev@dpdk.org
Objet : Re: [dpdk-dev] Question on the Ring Library

 

Thanks François-Frédéric. That puts real good perspective on the cost for
the vent assuming each packet in the fast will result

in an event. If event rate is orders of magnitude less than the packet rate,
then I guess we can still achieve 10G since the "extra cost" will be in the
event thread and not in the fast path thread.

 

Regards,

Sambath

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

* Re: [dpdk-dev] Question on the Ring Library
  2013-12-04 11:46 [dpdk-dev] Question on the Ring Library Sambath Kumar Balasubramanian
  2013-12-04 13:47 ` François-Frédéric Ozog
@ 2013-12-04 21:25 ` Stephen Hemminger
  2013-12-04 21:47   ` Sambath Kumar Balasubramanian
  1 sibling, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2013-12-04 21:25 UTC (permalink / raw)
  To: Sambath Kumar Balasubramanian; +Cc: dev

On Wed, 4 Dec 2013 03:46:36 -0800
Sambath Kumar Balasubramanian <sambath.balasubramanian@gmail.com> wrote:

> Hi,
> 
>   The ring library seems to be an excellent IPC. But looking at one use
> case where the fast path code posts events to event thread for example, the
> event thread will spend some cycles polling the ring rather than waiting
> for the event. One approach could be a fast path code basically posts the
> event in the ring as is today and there is a background thread that polls
> the queues and wakes up the event threads. This is similar to Linux
> SOFTIRQs.The event threads are asynchronous. Is this a fair model to avoid
> extra polling CPU cycles by the event threads? Is there any other
> alternatives in dpdk?
> 
> Regards,
> Sambath

I have in several cases combined RTE ring with use of eventfd + poll to
get wakeup

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

* Re: [dpdk-dev] Question on the Ring Library
  2013-12-04 21:25 ` Stephen Hemminger
@ 2013-12-04 21:47   ` Sambath Kumar Balasubramanian
  2013-12-04 21:51     ` Stephen Hemminger
  0 siblings, 1 reply; 9+ messages in thread
From: Sambath Kumar Balasubramanian @ 2013-12-04 21:47 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

Thanks Stephen. I was going to do prototype something similar (not doing
the wakeup inline but using a background thread)
and is it a worthwhile effort to move this as a feature of the RTE ring or
is it best left at the application level.


On Wed, Dec 4, 2013 at 1:25 PM, Stephen Hemminger <
stephen@networkplumber.org> wrote:

> On Wed, 4 Dec 2013 03:46:36 -0800
> Sambath Kumar Balasubramanian <sambath.balasubramanian@gmail.com> wrote:
>
> > Hi,
> >
> >   The ring library seems to be an excellent IPC. But looking at one use
> > case where the fast path code posts events to event thread for example,
> the
> > event thread will spend some cycles polling the ring rather than waiting
> > for the event. One approach could be a fast path code basically posts the
> > event in the ring as is today and there is a background thread that polls
> > the queues and wakes up the event threads. This is similar to Linux
> > SOFTIRQs.The event threads are asynchronous. Is this a fair model to
> avoid
> > extra polling CPU cycles by the event threads? Is there any other
> > alternatives in dpdk?
> >
> > Regards,
> > Sambath
>
> I have in several cases combined RTE ring with use of eventfd + poll to
> get wakeup
>

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

* Re: [dpdk-dev] Question on the Ring Library
  2013-12-04 20:02     ` François-Frédéric Ozog
@ 2013-12-04 21:49       ` Sambath Kumar Balasubramanian
  0 siblings, 0 replies; 9+ messages in thread
From: Sambath Kumar Balasubramanian @ 2013-12-04 21:49 UTC (permalink / raw)
  To: François-Frédéric Ozog; +Cc: dev

Thanks François-Frédéric. Trying to embark on a small prototype and see the
results. Thanks for the timing data. Really helpful.

Regards,
Sambath


On Wed, Dec 4, 2013 at 12:02 PM, François-Frédéric Ozog <ff@ozog.com> wrote:

> You are welcome !
>
>
>
> Even if you insert packets in batch into a fifo, the mutex is still
> unpredictable. If one pthread_lock costs 1ms, you are going to lose
> packets, regardless of the number of RSS queues and ring sizes… Batching
> comes with another issue: need to flush a batch after a certain timeout if
> you do not have packets. Userland timer resolution is such that you are
> introducing port to port latency quite a lot: DPDK native, you can manage
> to get a 2µs latency (including PCI express), while with batch it may be
> 1ms… You may find smarter algorithms but still you will be an order of
> magnitude higher than DPDK.
>
>
>
> Hope this helps.
>
>
>
> François-Frédéric
>
>
>
> *De :* Sambath Kumar Balasubramanian [mailto:
> sambath.balasubramanian@gmail.com]
> *Envoyé :* mercredi 4 décembre 2013 15:01
> *À :* François-Frédéric Ozog
> *Cc :* dev@dpdk.org
> *Objet :* Re: [dpdk-dev] Question on the Ring Library
>
>
>
> Thanks François-Frédéric. That puts real good perspective on the cost for
> the vent assuming each packet in the fast will result
>
> in an event. If event rate is orders of magnitude less than the packet
> rate, then I guess we can still achieve 10G since the "extra cost" will be
> in the event thread and not in the fast path thread.
>
>
>
> Regards,
>
> Sambath
>

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

* Re: [dpdk-dev] Question on the Ring Library
  2013-12-04 21:47   ` Sambath Kumar Balasubramanian
@ 2013-12-04 21:51     ` Stephen Hemminger
  2013-12-04 21:58       ` Sambath Kumar Balasubramanian
  0 siblings, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2013-12-04 21:51 UTC (permalink / raw)
  To: Sambath Kumar Balasubramanian; +Cc: dev

On Wed, 4 Dec 2013 13:47:10 -0800
Sambath Kumar Balasubramanian <sambath.balasubramanian@gmail.com> wrote:

> Thanks Stephen. I was going to do prototype something similar (not doing
> the wakeup inline but using a background thread)
> and is it a worthwhile effort to move this as a feature of the RTE ring or
> is it best left at the application level.
> 

I prefer that RTE ring stays as simple as possible.
If you need a higher level abstraction, built it yourself

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

* Re: [dpdk-dev] Question on the Ring Library
  2013-12-04 21:51     ` Stephen Hemminger
@ 2013-12-04 21:58       ` Sambath Kumar Balasubramanian
  0 siblings, 0 replies; 9+ messages in thread
From: Sambath Kumar Balasubramanian @ 2013-12-04 21:58 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

Understood. Thanks for getting back.

Regards,
Sambath


On Wed, Dec 4, 2013 at 1:51 PM, Stephen Hemminger <
stephen@networkplumber.org> wrote:

> On Wed, 4 Dec 2013 13:47:10 -0800
> Sambath Kumar Balasubramanian <sambath.balasubramanian@gmail.com> wrote:
>
> > Thanks Stephen. I was going to do prototype something similar (not doing
> > the wakeup inline but using a background thread)
> > and is it a worthwhile effort to move this as a feature of the RTE ring
> or
> > is it best left at the application level.
> >
>
> I prefer that RTE ring stays as simple as possible.
> If you need a higher level abstraction, built it yourself
>

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

end of thread, other threads:[~2013-12-04 21:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-04 11:46 [dpdk-dev] Question on the Ring Library Sambath Kumar Balasubramanian
2013-12-04 13:47 ` François-Frédéric Ozog
2013-12-04 14:00   ` Sambath Kumar Balasubramanian
2013-12-04 20:02     ` François-Frédéric Ozog
2013-12-04 21:49       ` Sambath Kumar Balasubramanian
2013-12-04 21:25 ` Stephen Hemminger
2013-12-04 21:47   ` Sambath Kumar Balasubramanian
2013-12-04 21:51     ` Stephen Hemminger
2013-12-04 21:58       ` Sambath Kumar Balasubramanian

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