Re: [ovs-dev] [PATCH RFC 2/4] dpif-netdev: Skip EMC lookup/insert for recirculated packets.

2017-07-26 Thread Fischetti, Antonio
Thanks for your feedback, good to see this could follow up with some further
solutions. In the meantime - based also on your suggestions - I posted a 
v2 of this patch at 
https://mail.openvswitch.org/pipermail/ovs-dev/2017-July/335940.html

It's in a patchset that begins at 
https://mail.openvswitch.org/pipermail/ovs-dev/2017-July/335938.html

-Antonio

> -Original Message-
> From: O Mahony, Billy
> Sent: Wednesday, July 26, 2017 9:55 AM
> To: Fischetti, Antonio <antonio.fische...@intel.com>; d...@openvswitch.org
> Subject: RE: [ovs-dev] [PATCH RFC 2/4] dpif-netdev: Skip EMC lookup/insert
> for recirculated packets.
> 
> Hi Antonio,
> 
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH RFC 2/4] dpif-netdev: Skip EMC lookup/insert for recirculated packets.

2017-07-26 Thread O Mahony, Billy
Hi Antonio,

> -Original Message-
> From: Fischetti, Antonio
> Sent: Friday, June 23, 2017 10:49 PM
> To: O Mahony, Billy <billy.o.mah...@intel.com>; d...@openvswitch.org
> Subject: RE: [ovs-dev] [PATCH RFC 2/4] dpif-netdev: Skip EMC lookup/insert
> for recirculated packets.
> 
> Thanks a lot Billy, really appreciate your feedback.
> My replies inline.
> 
> /Antonio
> 
> > -Original Message-
> > From: O Mahony, Billy
> > Sent: Friday, June 23, 2017 6:39 PM
> > To: Fischetti, Antonio <antonio.fische...@intel.com>;
> > d...@openvswitch.org
> > Subject: RE: [ovs-dev] [PATCH RFC 2/4] dpif-netdev: Skip EMC
> > lookup/insert for recirculated packets.
> >
> > Hi Antonio,
> >
> > This is a really interesting patch. Comments inline below.
> >
> > Thanks,
> > /Billy.
> >
> > > -Original Message-
> > > From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> > > boun...@openvswitch.org] On Behalf Of antonio.fische...@intel.com
> > > Sent: Monday, June 19, 2017 11:12 AM
> > > To: d...@openvswitch.org
> > > Subject: [ovs-dev] [PATCH RFC 2/4] dpif-netdev: Skip EMC
> > > lookup/insert
> > for
> > > recirculated packets.
> > >
> > > From: Antonio Fischetti <antonio.fische...@intel.com>
> > >
> > > When OVS is configured as a firewall, with thousands of active
> > concurrent
> > > connections, the EMC gets quicly saturated and may come under heavy
> > > thrashing for the reason that original and recirculated packets keep
> > overwrite
> > > existing active EMC entries due to its limited size(8k).
> > >
> > > This thrashing causes the EMC to be less efficient than the dcpls in
> > terms of
> > > lookups and insertions.
> > >
> > > This patch allows to use the EMC efficiently by allowing only the
> > 'original'
> > > packets to hit EMC. All recirculated packets are sent to classifier
> > directly.
> > > An empirical threshold (EMC_FULL_THRESHOLD - of 50%) for EMC
> > > occupancy is set to trigger this logic. By doing so when EMC
> > > utilization exceeds EMC_FULL_THRESHOLD.
> > >  - EMC Insertions are allowed just for original packets. EMC insertion
> > >and look up is skipped for recirculated packets.
> > >  - Recirculated packets are sent to classifier.
> > >
> > > This patch depends on the previous one in this series. It's based on
> > patch
> > > "dpif-netdev: add EMC entry count and %full figure to pmd-stats-show"
> > at:
> > > https://mail.openvswitch.org/pipermail/ovs-dev/2017-January/327570.h
> > > tml
> > >
> > > Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com>
> > > Signed-off-by: Bhanuprakash Bodireddy
> > > <bhanuprakash.bodire...@intel.com>
> > > Co-authored-by: Bhanuprakash Bodireddy
> > > <bhanuprakash.bodire...@intel.com>
> > > ---
> > > In our Connection Tracker testbench set up with
> > >
> > >  table=0, priority=1 actions=drop
> > >  table=0, priority=10,arp actions=NORMAL  table=0,
> > priority=100,ct_state=-
> > > trk,ip actions=ct(table=1)  table=1, ct_state=+new+trk,ip,in_port=1
> > > actions=ct(commit),output:2  table=1, ct_state=+est+trk,ip,in_port=1
> > > actions=output:2  table=1, ct_state=+new+trk,ip,in_port=2
> > > actions=drop table=1, ct_state=+est+trk,ip,in_port=2
> > > actions=output:1
> > >
> > > we saw the following performance improvement.
> > >
> > > Measured packet Rx rate (regardless of packet loss). Bidirectional
> > > test
> > with
> > > 64B UDP packets.
> > > Each row is a test with a different number of traffic streams. The
> > traffic
> > > generator is set so that each stream establishes one UDP connection.
> > > Mpps columns reports the Rx rates on the 2 sides.
> > >
> > >  Traffic |Orig| Orig  |  +changes  |   +changes
> > >  Streams |   [Mpps]   | [EMC entries] |   [Mpps]   | [EMC entries]
> > > -++---++---
> > >  10  |  3.4, 3.4  |  20   |  3.4, 3.4  |  20
> > > 100  |  2.6, 2.7  | 200   |  2.6, 2.7  | 201
> > >   1,000  |  2.4, 2.4  |2009   |  2.4, 2.4  |1994
> > >   2,000  |  2.2, 2.2  |3903   |  2.2, 2.2  |3900
> > >   3,000  |  2.1, 2.1  |5473   |  2.2, 2.2  |4798
>

Re: [ovs-dev] [PATCH RFC 2/4] dpif-netdev: Skip EMC lookup/insert for recirculated packets.

2017-06-23 Thread Fischetti, Antonio
Thanks a lot Billy, really appreciate your feedback.
My replies inline.

/Antonio

> -Original Message-
> From: O Mahony, Billy
> Sent: Friday, June 23, 2017 6:39 PM
> To: Fischetti, Antonio <antonio.fische...@intel.com>; d...@openvswitch.org
> Subject: RE: [ovs-dev] [PATCH RFC 2/4] dpif-netdev: Skip EMC lookup/insert
> for recirculated packets.
> 
> Hi Antonio,
> 
> This is a really interesting patch. Comments inline below.
> 
> Thanks,
> /Billy.
> 
> > -Original Message-
> > From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> > boun...@openvswitch.org] On Behalf Of antonio.fische...@intel.com
> > Sent: Monday, June 19, 2017 11:12 AM
> > To: d...@openvswitch.org
> > Subject: [ovs-dev] [PATCH RFC 2/4] dpif-netdev: Skip EMC lookup/insert
> for
> > recirculated packets.
> >
> > From: Antonio Fischetti <antonio.fische...@intel.com>
> >
> > When OVS is configured as a firewall, with thousands of active
> concurrent
> > connections, the EMC gets quicly saturated and may come under heavy
> > thrashing for the reason that original and recirculated packets keep
> overwrite
> > existing active EMC entries due to its limited size(8k).
> >
> > This thrashing causes the EMC to be less efficient than the dcpls in
> terms of
> > lookups and insertions.
> >
> > This patch allows to use the EMC efficiently by allowing only the
> 'original'
> > packets to hit EMC. All recirculated packets are sent to classifier
> directly.
> > An empirical threshold (EMC_FULL_THRESHOLD - of 50%) for EMC occupancy
> > is set to trigger this logic. By doing so when EMC utilization exceeds
> > EMC_FULL_THRESHOLD.
> >  - EMC Insertions are allowed just for original packets. EMC insertion
> >and look up is skipped for recirculated packets.
> >  - Recirculated packets are sent to classifier.
> >
> > This patch depends on the previous one in this series. It's based on
> patch
> > "dpif-netdev: add EMC entry count and %full figure to pmd-stats-show"
> at:
> > https://mail.openvswitch.org/pipermail/ovs-dev/2017-January/327570.html
> >
> > Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com>
> > Signed-off-by: Bhanuprakash Bodireddy
> > <bhanuprakash.bodire...@intel.com>
> > Co-authored-by: Bhanuprakash Bodireddy
> > <bhanuprakash.bodire...@intel.com>
> > ---
> > In our Connection Tracker testbench set up with
> >
> >  table=0, priority=1 actions=drop
> >  table=0, priority=10,arp actions=NORMAL  table=0,
> priority=100,ct_state=-
> > trk,ip actions=ct(table=1)  table=1, ct_state=+new+trk,ip,in_port=1
> > actions=ct(commit),output:2  table=1, ct_state=+est+trk,ip,in_port=1
> > actions=output:2  table=1, ct_state=+new+trk,ip,in_port=2 actions=drop
> > table=1, ct_state=+est+trk,ip,in_port=2 actions=output:1
> >
> > we saw the following performance improvement.
> >
> > Measured packet Rx rate (regardless of packet loss). Bidirectional test
> with
> > 64B UDP packets.
> > Each row is a test with a different number of traffic streams. The
> traffic
> > generator is set so that each stream establishes one UDP connection.
> > Mpps columns reports the Rx rates on the 2 sides.
> >
> >  Traffic |Orig| Orig  |  +changes  |   +changes
> >  Streams |   [Mpps]   | [EMC entries] |   [Mpps]   | [EMC entries]
> > -++---++---
> >  10  |  3.4, 3.4  |  20   |  3.4, 3.4  |  20
> > 100  |  2.6, 2.7  | 200   |  2.6, 2.7  | 201
> >   1,000  |  2.4, 2.4  |2009   |  2.4, 2.4  |1994
> >   2,000  |  2.2, 2.2  |3903   |  2.2, 2.2  |3900
> >   3,000  |  2.1, 2.1  |5473   |  2.2, 2.2  |4798
> >   4,000  |  2.0, 2.0  |6478   |  2.2, 2.2  |5663
> >  10,000  |  1.8, 1.9  |8070   |  2.0, 2.0  |7347
> > 100,000  |  1.7, 1.7  |8192   |  1.8, 1.8  |8192
> >
> 
> [[BO'M]]
> A few questions on the test:
> Are all the pkts rxd being recirculated?

[AF] Yes, I sent UDP packets with the firewall rules above. Every packets 
goes through the CT module, so after that it is recirculated.

> Are there any flows present where the pkts do not require recirculation?

[AF] No. The flow
table=0,priority=100,ct_state=-trk,ip actions=ct(table=1)
implies that any received packet goes through CT and then it is recirculated.

> Was the rxd rss hash calculation offloaded to the NIC?

[AF] Yes.

> For the cases with larger numbers of flows (10K , 100K) did you
> invest

Re: [ovs-dev] [PATCH RFC 2/4] dpif-netdev: Skip EMC lookup/insert for recirculated packets.

2017-06-23 Thread O Mahony, Billy
Hi Antonio,

This is a really interesting patch. Comments inline below. 

Thanks,
/Billy.

> -Original Message-
> From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> boun...@openvswitch.org] On Behalf Of antonio.fische...@intel.com
> Sent: Monday, June 19, 2017 11:12 AM
> To: d...@openvswitch.org
> Subject: [ovs-dev] [PATCH RFC 2/4] dpif-netdev: Skip EMC lookup/insert for
> recirculated packets.
> 
> From: Antonio Fischetti <antonio.fische...@intel.com>
> 
> When OVS is configured as a firewall, with thousands of active concurrent
> connections, the EMC gets quicly saturated and may come under heavy
> thrashing for the reason that original and recirculated packets keep overwrite
> existing active EMC entries due to its limited size(8k).
> 
> This thrashing causes the EMC to be less efficient than the dcpls in terms of
> lookups and insertions.
> 
> This patch allows to use the EMC efficiently by allowing only the 'original'
> packets to hit EMC. All recirculated packets are sent to classifier directly.
> An empirical threshold (EMC_FULL_THRESHOLD - of 50%) for EMC occupancy
> is set to trigger this logic. By doing so when EMC utilization exceeds
> EMC_FULL_THRESHOLD.
>  - EMC Insertions are allowed just for original packets. EMC insertion
>and look up is skipped for recirculated packets.
>  - Recirculated packets are sent to classifier.
> 
> This patch depends on the previous one in this series. It's based on patch
> "dpif-netdev: add EMC entry count and %full figure to pmd-stats-show" at:
> https://mail.openvswitch.org/pipermail/ovs-dev/2017-January/327570.html
> 
> Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com>
> Signed-off-by: Bhanuprakash Bodireddy
> <bhanuprakash.bodire...@intel.com>
> Co-authored-by: Bhanuprakash Bodireddy
> <bhanuprakash.bodire...@intel.com>
> ---
> In our Connection Tracker testbench set up with
> 
>  table=0, priority=1 actions=drop
>  table=0, priority=10,arp actions=NORMAL  table=0, priority=100,ct_state=-
> trk,ip actions=ct(table=1)  table=1, ct_state=+new+trk,ip,in_port=1
> actions=ct(commit),output:2  table=1, ct_state=+est+trk,ip,in_port=1
> actions=output:2  table=1, ct_state=+new+trk,ip,in_port=2 actions=drop
> table=1, ct_state=+est+trk,ip,in_port=2 actions=output:1
> 
> we saw the following performance improvement.
> 
> Measured packet Rx rate (regardless of packet loss). Bidirectional test with
> 64B UDP packets.
> Each row is a test with a different number of traffic streams. The traffic
> generator is set so that each stream establishes one UDP connection.
> Mpps columns reports the Rx rates on the 2 sides.
> 
>  Traffic |Orig| Orig  |  +changes  |   +changes
>  Streams |   [Mpps]   | [EMC entries] |   [Mpps]   | [EMC entries]
> -++---++---
>  10  |  3.4, 3.4  |  20   |  3.4, 3.4  |  20
> 100  |  2.6, 2.7  | 200   |  2.6, 2.7  | 201
>   1,000  |  2.4, 2.4  |2009   |  2.4, 2.4  |1994
>   2,000  |  2.2, 2.2  |3903   |  2.2, 2.2  |3900
>   3,000  |  2.1, 2.1  |5473   |  2.2, 2.2  |4798
>   4,000  |  2.0, 2.0  |6478   |  2.2, 2.2  |5663
>  10,000  |  1.8, 1.9  |8070   |  2.0, 2.0  |7347
> 100,000  |  1.7, 1.7  |8192   |  1.8, 1.8  |8192
> 

[[BO'M]] 
A few questions on the test:
Are all the pkts rxd being recirculated?
Are there any flows present where the pkts do not require recirculation? 
Was the rxd rss hash calculation offloaded to the NIC?
For the cases with larger numbers of flows (10K , 100K) did you investigate the 
results when the EMC is simply switched off? 

Say we have 3000 flows (the lowest figure at which we see a positive effect) 
that means 6000 flows are contending for places in the emc.  
Is the effect we see here to do with disabling recirculated packets in 
particular or just reducing contention on the emc in general. I know that the 
recirculated pkt hashes require software hashing albeit a small amount so they 
do make a good category of packet to drop from the emc when contention is 
severe.

Once there are too many entries contending  for any cache it's going to become 
a liability as the lookup_cost + (miss_rate * cost_of_miss) grows to be greater 
that the cost_of_miss. And in that case any scheme where a very cheap decision 
can be made to not insert a certain category of packets and to also not check 
the emc for that same category will reduce the cache miss rate.

But I'm not sure that is_recirculated is the best categorization on which to 
make that decision. Mainly because it is not controllable. In this test case 
50% pkts were recirculated so by ruling these packets out of eligibility for 
the EMC you