DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] Is Elastic Flow Distributor thread-safe?
@ 2017-02-13 14:26 Rob Zimmerman
  2017-02-14 14:14 ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Zimmerman @ 2017-02-13 14:26 UTC (permalink / raw)
  To: users

Hi Everyone,

  Playing around with EFD and seeing some really bizarre behavior in a
multi-core environment. Is it safe for multiple logical cores to be making
EFD table updates while another logical core is performing lookups? Side
note: the core which is making lookups is where the offline table resides.

Intuition tells me this is probably not safe, but the docs make no mention
of thread safety.

Thanks,
-Rob

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

* Re: [dpdk-users] Is Elastic Flow Distributor thread-safe?
  2017-02-13 14:26 [dpdk-users] Is Elastic Flow Distributor thread-safe? Rob Zimmerman
@ 2017-02-14 14:14 ` De Lara Guarch, Pablo
  2017-02-14 14:23   ` Rob Zimmerman
  2017-02-14 14:26   ` Thomas Monjalon
  0 siblings, 2 replies; 5+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-14 14:14 UTC (permalink / raw)
  To: Rob Zimmerman, users

Hi Rob,

> -----Original Message-----
> From: users [mailto:users-bounces@dpdk.org] On Behalf Of Rob
> Zimmerman
> Sent: Monday, February 13, 2017 2:26 PM
> To: users@dpdk.org
> Subject: [dpdk-users] Is Elastic Flow Distributor thread-safe?
> 
> Hi Everyone,
> 
>   Playing around with EFD and seeing some really bizarre behavior in a
> multi-core environment. Is it safe for multiple logical cores to be making
> EFD table updates while another logical core is performing lookups? Side
> note: the core which is making lookups is where the offline table resides.
> 
> Intuition tells me this is probably not safe, but the docs make no mention
> of thread safety.

The library is not thread-safe. The only operation that is thread safe is the lookup.

However, although update is not thread safe, it is interesting to know the following.
Updating the EFD table consists of two steps:

1 - Compute Update: the new key is added to the offline group, which is not thread safe.
     Then, a new perfect hash for the group is computed (thread safe and where most of time is spent).

2 - Apply Update: Once the update is computed, it has to be applied to the online table (fast, but not thread safe).

Multi-writer support might be added in the future, as it was added in the Hash library.

For now, several readers can work simultaneously, as long as there is no writer working on it (you would need locks for this),
and only a single writer is supported if there is no other core doing lookups.
 
> 
> Thanks,
> -Rob

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

* Re: [dpdk-users] Is Elastic Flow Distributor thread-safe?
  2017-02-14 14:14 ` De Lara Guarch, Pablo
@ 2017-02-14 14:23   ` Rob Zimmerman
  2017-02-14 14:26   ` Thomas Monjalon
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Zimmerman @ 2017-02-14 14:23 UTC (permalink / raw)
  To: De Lara Guarch, Pablo; +Cc: users

Hi Pablo,

  That was my assumption. I peeked at the EFD implementation and saw the
memcpy's which are definitely not multi-producer safe. What I ended up
doing is throwing together a ring buffer for the one core which will
perform the EFD update. All other cores just send their updates to that
core and it processes them, doing updates.

Thanks so much for the confirmation!
-Rob

On Tue, Feb 14, 2017 at 9:14 AM, De Lara Guarch, Pablo <
pablo.de.lara.guarch@intel.com> wrote:

> Hi Rob,
>
> > -----Original Message-----
> > From: users [mailto:users-bounces@dpdk.org] On Behalf Of Rob
> > Zimmerman
> > Sent: Monday, February 13, 2017 2:26 PM
> > To: users@dpdk.org
> > Subject: [dpdk-users] Is Elastic Flow Distributor thread-safe?
> >
> > Hi Everyone,
> >
> >   Playing around with EFD and seeing some really bizarre behavior in a
> > multi-core environment. Is it safe for multiple logical cores to be
> making
> > EFD table updates while another logical core is performing lookups? Side
> > note: the core which is making lookups is where the offline table
> resides.
> >
> > Intuition tells me this is probably not safe, but the docs make no
> mention
> > of thread safety.
>
> The library is not thread-safe. The only operation that is thread safe is
> the lookup.
>
> However, although update is not thread safe, it is interesting to know the
> following.
> Updating the EFD table consists of two steps:
>
> 1 - Compute Update: the new key is added to the offline group, which is
> not thread safe.
>      Then, a new perfect hash for the group is computed (thread safe and
> where most of time is spent).
>
> 2 - Apply Update: Once the update is computed, it has to be applied to the
> online table (fast, but not thread safe).
>
> Multi-writer support might be added in the future, as it was added in the
> Hash library.
>
> For now, several readers can work simultaneously, as long as there is no
> writer working on it (you would need locks for this),
> and only a single writer is supported if there is no other core doing
> lookups.
>
> >
> > Thanks,
> > -Rob
>

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

* Re: [dpdk-users] Is Elastic Flow Distributor thread-safe?
  2017-02-14 14:14 ` De Lara Guarch, Pablo
  2017-02-14 14:23   ` Rob Zimmerman
@ 2017-02-14 14:26   ` Thomas Monjalon
  2017-02-14 14:38     ` De Lara Guarch, Pablo
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2017-02-14 14:26 UTC (permalink / raw)
  To: De Lara Guarch, Pablo; +Cc: users, Rob Zimmerman

2017-02-14 14:14, De Lara Guarch, Pablo:
> From: Rob
> >   Playing around with EFD and seeing some really bizarre behavior in a
> > multi-core environment. Is it safe for multiple logical cores to be making
> > EFD table updates while another logical core is performing lookups? Side
> > note: the core which is making lookups is where the offline table resides.
> > 
> > Intuition tells me this is probably not safe, but the docs make no mention
> > of thread safety.
> 
> The library is not thread-safe. The only operation that is thread safe is the lookup.
> 
> However, although update is not thread safe, it is interesting to know the following.
> Updating the EFD table consists of two steps:
> 
> 1 - Compute Update: the new key is added to the offline group, which is not thread safe.
>      Then, a new perfect hash for the group is computed (thread safe and where most of time is spent).
> 
> 2 - Apply Update: Once the update is computed, it has to be applied to the online table (fast, but not thread safe).
> 
> Multi-writer support might be added in the future, as it was added in the Hash library.
> 
> For now, several readers can work simultaneously, as long as there is no writer working on it (you would need locks for this),
> and only a single writer is supported if there is no other core doing lookups.

Should it be added to the documentation?

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

* Re: [dpdk-users] Is Elastic Flow Distributor thread-safe?
  2017-02-14 14:26   ` Thomas Monjalon
@ 2017-02-14 14:38     ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 5+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-14 14:38 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: users, Rob Zimmerman



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, February 14, 2017 2:27 PM
> To: De Lara Guarch, Pablo
> Cc: users@dpdk.org; Rob Zimmerman
> Subject: Re: [dpdk-users] Is Elastic Flow Distributor thread-safe?
> 
> 2017-02-14 14:14, De Lara Guarch, Pablo:
> > From: Rob
> > >   Playing around with EFD and seeing some really bizarre behavior in a
> > > multi-core environment. Is it safe for multiple logical cores to be making
> > > EFD table updates while another logical core is performing lookups?
> Side
> > > note: the core which is making lookups is where the offline table
> resides.
> > >
> > > Intuition tells me this is probably not safe, but the docs make no
> mention
> > > of thread safety.
> >
> > The library is not thread-safe. The only operation that is thread safe is the
> lookup.
> >
> > However, although update is not thread safe, it is interesting to know the
> following.
> > Updating the EFD table consists of two steps:
> >
> > 1 - Compute Update: the new key is added to the offline group, which is
> not thread safe.
> >      Then, a new perfect hash for the group is computed (thread safe and
> where most of time is spent).
> >
> > 2 - Apply Update: Once the update is computed, it has to be applied to
> the online table (fast, but not thread safe).
> >
> > Multi-writer support might be added in the future, as it was added in the
> Hash library.
> >
> > For now, several readers can work simultaneously, as long as there is no
> writer working on it (you would need locks for this),
> > and only a single writer is supported if there is no other core doing
> lookups.
> 
> Should it be added to the documentation?

I will send a doc patch shortly about this.

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

end of thread, other threads:[~2017-02-14 14:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-13 14:26 [dpdk-users] Is Elastic Flow Distributor thread-safe? Rob Zimmerman
2017-02-14 14:14 ` De Lara Guarch, Pablo
2017-02-14 14:23   ` Rob Zimmerman
2017-02-14 14:26   ` Thomas Monjalon
2017-02-14 14:38     ` De Lara Guarch, Pablo

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