Skip to contentSkip to conversation

Add Membership Library

RFC New Yipeng Wang 3 participants 7 messages May 27, 2017 – Jul 17, 2017 Library code

lore
Share & tools
lore
#0 lore raw

A proposal for a new DPDK library that is called “Membership Library”. It provides an API for DPDK applications to insert a new member, delete an existing member, or query the existence of a member in a given set, or a group of sets. For the case of a group of sets the library will return not only whether the element has been inserted before in one of the sets but also which set it belongs to.

The Membership Library is an extension and generalization of a traditional filter (for example Bloom Filter) structure that has multiple usages in a wide variety of workloads and applications. In general, the Membership Library is a data structure that provides a “set-summary” and responds to set-membership queries whether a certain member belongs to a set(s). There are two advantages of using such a set-summary rather than operating on a “full-blown” complete list of elements: firstly it has a much smaller storage requirement than storing the whole list of elements themselves, and secondly checking an element membership (or other operations) in this set-summary is much faster than checking it for the original full-blown complete list of elements.

A membership test for an element will return the set this element belongs to or null (meaning not found) with very high probability of accuracy. Set-summary is a fundamental data aggregation component that can be used in many network (and other) applications. It is a crucial structure to address performance and scalability issues of diverse network applications including overlay networks, wild card flow classification, web-caches, load balancing, connection tracking, data-centric networks, flow table summaries, network statistics and traffic monitoring.

Our Proof of Concept (PoC) using membership library to optimize flow lookup for Open vSwitch (OvS) shows a speed up of about 3X.

Yipeng Wang (1):
Add Membership Library

 MAINTAINERS                                      |    7 +
 config/defconfig_x86_64-native-linuxapp-gcc      |    3 +
 doc/guides/prog_guide/img/memship_i1.svg         | 1269 ++++++++++++++++++++++
 doc/guides/prog_guide/img/memship_i2.svg         |   36 +
 doc/guides/prog_guide/img/memship_i3.svg         |  148 +++
 doc/guides/prog_guide/img/memship_i4.svg         |  428 ++++++++
 doc/guides/prog_guide/img/memship_i5.svg         |  123 +++
 doc/guides/prog_guide/img/memship_i6.svg         |  233 ++++
 doc/guides/prog_guide/img/memship_i7.svg         |  277 +++++
 doc/guides/prog_guide/index.rst                  |   14 +
 doc/guides/prog_guide/membership_lib.rst         |  421 +++++++
 lib/Makefile                                     |    3 +-
 lib/librte_eal/common/eal_common_log.c           |    1 +
 lib/librte_eal/common/include/rte_log.h          |    1 +
 lib/librte_membership/Makefile                   |   48 +
 lib/librte_membership/rte_membership.c           |  378 +++++++
 lib/librte_membership/rte_membership.h           |  321 ++++++
 lib/librte_membership/rte_membership_bf.c        |  254 +++++
 lib/librte_membership/rte_membership_bf.h        |   99 ++
 lib/librte_membership/rte_membership_cache.c     |  345 ++++++
 lib/librte_membership/rte_membership_cache.h     |   95 ++
 lib/librte_membership/rte_membership_ht.c        |  471 ++++++++
 lib/librte_membership/rte_membership_ht.h        |   98 ++
 lib/librte_membership/rte_membership_vbf.c       |  391 +++++++
 lib/librte_membership/rte_membership_vbf.h       |   85 ++
 lib/librte_membership/rte_membership_version.map |   15 +
 mk/rte.app.mk                                    |    1 +
 test/test/Makefile                               |    2 +
 test/test/test_membership.c                      |  459 ++++++++
 29 files changed, 6025 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/prog_guide/img/memship_i1.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i2.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i3.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i4.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i5.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i6.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i7.svg
 create mode 100644 doc/guides/prog_guide/membership_lib.rst
 create mode 100644 lib/librte_membership/Makefile
 create mode 100644 lib/librte_membership/rte_membership.c
 create mode 100644 lib/librte_membership/rte_membership.h
 create mode 100644 lib/librte_membership/rte_membership_bf.c
 create mode 100644 lib/librte_membership/rte_membership_bf.h
 create mode 100644 lib/librte_membership/rte_membership_cache.c
 create mode 100644 lib/librte_membership/rte_membership_cache.h
 create mode 100644 lib/librte_membership/rte_membership_ht.c
 create mode 100644 lib/librte_membership/rte_membership_ht.h
 create mode 100644 lib/librte_membership/rte_membership_vbf.c
 create mode 100644 lib/librte_membership/rte_membership_vbf.h
 create mode 100644 lib/librte_membership/rte_membership_version.map
 create mode 100644 test/test/test_membership.c
Signature · 1 line
1.9.1
#1 lore raw

RFC 1/1 Add Membership Library

A proposal for a new DPDK library that is called “Membership Library”. It provides an API for DPDK applications to insert a new member, delete an existing member, or query the existence of a member in a given set, or a group of sets. For the case of a group of sets the library will return not only whether the element has been inserted before in one of the sets but also which set it belongs to.

The Membership Library is an extension and generalization of a traditional filter (for example Bloom Filter) structure that has multiple usages in a wide variety of workloads and applications. In general, the Membership Library is a data structure that provides a “set-summary” and responds to set-membership queries whether a certain member belongs to a set(s). There are two advantages of using such a set-summary rather than operating on a “full-blown” complete list of elements: firstly it has a much smaller storage requirement than storing the whole list of elements themselves, and secondly checking an element membership (or other operations) in this set-summary is much faster than checking it for the original full-blown complete list of elements.

A membership test for an element will return the set this element belongs to or null (meaning not found) with very high probability of accuracy. Set-summary is a fundamental data aggregation component that can be used in many network (and other) applications. It is a crucial structure to address performance and scalability issues of diverse network applications including overlay networks, wild card flow classification, web-caches, load balancing, connection tracking, data-centric networks, flow table summaries, network statistics and traffic monitoring.

Our Proof of Concept (PoC) using membership library to optimize flow lookup for Open vSwitch (OvS) shows a speed up of about 3X.

---
 MAINTAINERS                                      |    7 +
 config/defconfig_x86_64-native-linuxapp-gcc      |    3 +
 doc/guides/prog_guide/img/memship_i1.svg         | 1269 ++++++++++++++++++++++
 doc/guides/prog_guide/img/memship_i2.svg         |   36 +
 doc/guides/prog_guide/img/memship_i3.svg         |  148 +++
 doc/guides/prog_guide/img/memship_i4.svg         |  428 ++++++++
 doc/guides/prog_guide/img/memship_i5.svg         |  123 +++
 doc/guides/prog_guide/img/memship_i6.svg         |  233 ++++
 doc/guides/prog_guide/img/memship_i7.svg         |  277 +++++
 doc/guides/prog_guide/index.rst                  |   14 +
 doc/guides/prog_guide/membership_lib.rst         |  424 ++++++++
 lib/Makefile                                     |    3 +-
 lib/librte_eal/common/eal_common_log.c           |    1 +
 lib/librte_eal/common/include/rte_log.h          |    1 +
 lib/librte_membership/Makefile                   |   48 +
 lib/librte_membership/rte_membership.c           |  378 +++++++
 lib/librte_membership/rte_membership.h           |  321 ++++++
 lib/librte_membership/rte_membership_bf.c        |  254 +++++
 lib/librte_membership/rte_membership_bf.h        |   99 ++
 lib/librte_membership/rte_membership_cache.c     |  345 ++++++
 lib/librte_membership/rte_membership_cache.h     |   95 ++
 lib/librte_membership/rte_membership_ht.c        |  471 ++++++++
 lib/librte_membership/rte_membership_ht.h        |   98 ++
 lib/librte_membership/rte_membership_vbf.c       |  391 +++++++
 lib/librte_membership/rte_membership_vbf.h       |   85 ++
 lib/librte_membership/rte_membership_version.map |   15 +
 mk/rte.app.mk                                    |    1 +
 test/test/Makefile                               |    2 +
 test/test/test_membership.c                      |  459 ++++++++
 29 files changed, 6028 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/prog_guide/img/memship_i1.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i2.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i3.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i4.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i5.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i6.svg
 create mode 100644 doc/guides/prog_guide/img/memship_i7.svg
 create mode 100644 doc/guides/prog_guide/membership_lib.rst
 create mode 100644 lib/librte_membership/Makefile
 create mode 100644 lib/librte_membership/rte_membership.c
 create mode 100644 lib/librte_membership/rte_membership.h
 create mode 100644 lib/librte_membership/rte_membership_bf.c
 create mode 100644 lib/librte_membership/rte_membership_bf.h
 create mode 100644 lib/librte_membership/rte_membership_cache.c
 create mode 100644 lib/librte_membership/rte_membership_cache.h
 create mode 100644 lib/librte_membership/rte_membership_ht.c
 create mode 100644 lib/librte_membership/rte_membership_ht.h
 create mode 100644 lib/librte_membership/rte_membership_vbf.c
 create mode 100644 lib/librte_membership/rte_membership_vbf.h
 create mode 100644 lib/librte_membership/rte_membership_version.map
 create mode 100644 test/test/test_membership.c
MAINTAINERS +7 -0
index afb4cab..fc9e937 100644
@@ -696,6 +696,13 @@ F: test/test/test_meter.c
 F: examples/qos_meter/
 F: doc/guides/sample_app_ug/qos_metering.rst
 
+MEMBERSHIP
+M: Yipeng Wang <[email protected]>
+M: Sameh Gobriel <[email protected]>
+F: lib/librte_membership/
+F: doc/guides/prog_guide/membership.rst
+F: test/test/test_membership*
+
 
 Other libraries
 ---------------
config/defconfig_x86_64-native-linuxapp-gcc +3 -0
index e69a37e..0a218d5 100644
@@ -41,3 +41,6 @@ CONFIG_RTE_ARCH_64=y
 
 CONFIG_RTE_TOOLCHAIN="gcc"
 CONFIG_RTE_TOOLCHAIN_GCC=y
+
+
+CONFIG_RTE_LIBRTE_MEMBERSHIP=y
doc/guides/prog_guide/img/memship_i1.svg new file +1269 -0

1,269 lines not on this page · raw message

doc/guides/prog_guide/img/memship_i2.svg new file +36 -0
new file mode 100644
index 0000000..ef71303
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by Microsoft Visio, SVG Export memship_i2.svg Page-1 -->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events"
+		xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="4.38194in" height="1.25694in"
+		viewBox="0 0 315.5 90.5" xml:space="preserve" color-interpolation-filters="sRGB" class="st6">
+	<v:documentProperties v:langID="1033" v:viewMarkup="false"/>
+
+	<style type="text/css">
+	<![CDATA[
+		.st1 {fill:none;stroke:none;stroke-width:0.25}
+		.st2 {fill:#5b9bd5;font-family:Calibri;font-size:1.16666em}
+		.st3 {baseline-shift:32.4943%;font-size:0.649886em}
+		.st4 {font-size:1em}
+		.st5 {font-family:Cambria Math;font-size:1em}
+		.st6 {fill:none;fill-rule:evenodd;font-size:12px;overflow:visible;stroke-linecap:square;stroke-miterlimit:3}
+	]]>
+	</style>
+
+	<g v:mID="0" v:index="1" v:groupContext="foregroundPage">
+		<title>Page-1</title>
+		<v:pageProperties v:drawingScale="1" v:pageScale="1" v:drawingUnits="0" v:shadowOffsetX="9" v:shadowOffsetY="-9"/>
+		<g id="shape3-1" v:mID="3" v:groupContext="shape" transform="translate(0.25,-0.25)">
+			<title>Sheet.3</title>
+			<desc>False Positive Probability = (1-(1-1/m)kn)k ≃ (1-ekn/m)k</desc>
+			<v:textBlock v:margins="rect(4,4,4,4)"/>
+			<v:textRect cx="157.5" cy="45.5" width="315" height="90"/>
+			<rect x="0" y="0.5" width="315" height="90" class="st1"/>
+			<text x="8.28" y="49.82" class="st2" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>False Positive Probability = (1-(1-1/m)<tspan
+						dy="-0.234em" class="st3" v:baseFontSize="14">kn</tspan><tspan dy="0.152em" class="st4">)</tspan><tspan
+						dy="-0.234em" class="st3" v:baseFontSize="14">k</tspan><tspan dy="0.152em" class="st4"> </tspan><tspan
+						class="st5">≃</tspan> (1-e<tspan dy="-0.234em" class="st3" v:baseFontSize="14">kn</tspan><tspan class="st3"
+						v:baseFontSize="14">/</tspan><tspan class="st3" v:baseFontSize="14">m</tspan><tspan dy="0.152em"
+						class="st4">)</tspan><tspan dy="-0.234em" class="st3" v:baseFontSize="14">k</tspan></text>		</g>
+	</g>
+</svg>
doc/guides/prog_guide/img/memship_i3.svg new file +148 -0

148 lines not on this page · raw message

doc/guides/prog_guide/img/memship_i4.svg new file +428 -0

428 lines not on this page · raw message

doc/guides/prog_guide/img/memship_i5.svg new file +123 -0

123 lines not on this page · raw message

doc/guides/prog_guide/img/memship_i6.svg new file +233 -0

233 lines not on this page · raw message

doc/guides/prog_guide/img/memship_i7.svg new file +277 -0

277 lines not on this page · raw message

doc/guides/prog_guide/index.rst +14 -0
index ef5a02a..096cc93 100644
@@ -48,6 +48,7 @@ Programmer's Guide
     timer_lib
     hash_lib
     efd_lib
+    membership_lib
     lpm_lib
     lpm6_lib
     packet_distrib_lib
@@ -187,6 +188,19 @@ Programmer's Guide
 
 :numref:`figure_efd11` :ref:`figure_efd11`
 
+:numref:`figure_membership1` :ref:`figure_membership1`
+
+:numref:`figure_membership2` :ref:`figure_membership2`
+
+:numref:`figure_membership3` :ref:`figure_membership3`
+
+:numref:`figure_membership4` :ref:`figure_membership4`
+
+:numref:`figure_membership5` :ref:`figure_membership5`
+
+:numref:`figure_membership6` :ref:`figure_membership6`
+
+:numref:`figure_membership7` :ref:`figure_membership7`
 
 **Tables**
 
doc/guides/prog_guide/membership_lib.rst new file +424 -0

425 lines not on this page · raw message

lib/Makefile +2 -1
index 07e1fd0..be1ee2d 100644
@@ -30,7 +30,6 @@
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 include $(RTE_SDK)/mk/rte.vars.mk
-
 DIRS-y += librte_compat
 DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
@@ -106,6 +105,8 @@ DIRS-$(CONFIG_RTE_LIBRTE_REORDER) += librte_reorder
 DEPDIRS-librte_reorder := librte_eal librte_mempool librte_mbuf
 DIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += librte_pdump
 DEPDIRS-librte_pdump := librte_eal librte_mempool librte_mbuf librte_ether
+DIRS-$(CONFIG_RTE_LIBRTE_MEMBERSHIP) += librte_membership
+DEPDIRS-librte_membership := librte_eal librte_mempool librte_hash librte_sched
 
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni
lib/librte_eal/common/eal_common_log.c +1 -0
index ddf65b7..3e712c2 100644
@@ -270,6 +270,7 @@ struct logtype {
 	{RTE_LOGTYPE_CRYPTODEV,  "cryptodev"},
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/include/rte_log.h +1 -0
index 3419138..a323411 100644

Lines of this file are not shown. View the raw message.

lib/librte_membership/Makefile new file +48 -0

48 lines not on this page · raw message

lib/librte_membership/rte_membership.c new file +378 -0

378 lines not on this page · raw message

lib/librte_membership/rte_membership.h new file +321 -0

321 lines not on this page · raw message

lib/librte_membership/rte_membership_bf.c new file +254 -0

254 lines not on this page · raw message

lib/librte_membership/rte_membership_bf.h new file +99 -0

99 lines not on this page · raw message

lib/librte_membership/rte_membership_cache.c new file +345 -0

345 lines not on this page · raw message

lib/librte_membership/rte_membership_cache.h new file +95 -0

95 lines not on this page · raw message

lib/librte_membership/rte_membership_ht.c new file +471 -0

471 lines not on this page · raw message

lib/librte_membership/rte_membership_ht.h new file +98 -0

98 lines not on this page · raw message

lib/librte_membership/rte_membership_vbf.c new file +391 -0

391 lines not on this page · raw message

lib/librte_membership/rte_membership_vbf.h new file +85 -0

85 lines not on this page · raw message

lib/librte_membership/rte_membership_version.map new file +15 -0
new file mode 100644
index 0000000..d10f8a2

Lines of this file are not shown. View the raw message.

mk/rte.app.mk +1 -0
index bcaf1b3..58218fe 100644

Lines of this file are not shown. View the raw message.

test/test/Makefile +2 -0
index ee240be..2dd0a90 100644

Lines of this file are not shown. View the raw message.

test/test/test_membership.c new file +459 -0

459 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.9.1

Part of the diff is not shown here. View the raw message.

#3 lore raw

Hi Vincent,

Thanks for the comments and some quick responses below:

- DPDK Bloom Filter is derived from the libbloom (as shown by the included BSD license), but optimized for performance with various DPDK goodness such as rte_zmalloc, rte_bitmap, rte_jhash, etc. It doesn't seem appropriate to bring those DPDK specific features into libbloom, which is designed for more generic environments.
- DPDK Bloom Filter is just one very basic mode among other more sophisticated ones in the DPDK Membership Library, which supports a different set of APIs (e.g., bulk lookup, multi-match, etc.) than those supported in libbloom.
- It may make sense to bring some generic (i.e., non DPDK specific) improvements back to libbloom once identified.

Thanks
Yipeng

Quoted 17 lines

-----Original Message-----
From: Vincent Jardin [mailto:[email protected]]
Sent: Saturday, May 27, 2017 2:42 AM
To: Wang, Yipeng1 <[email protected]>
Cc: [email protected]; Gobriel, Sameh <[email protected]>; Wang, Ren <[email protected]>; Tai, Charlie <[email protected]>
Subject: Re: [dpdk-dev] [RFC] Add Membership Library

Why duplicating Jyri's libbloom - https://github.com/jvirkki/libbloom - for this DPDK capability? Why not showing that you can contribute to libbloom and make it linkable with the DPDK?

There are so many duplicated code...

Thank you,
Vincent

#4 lore raw
Quoted 8 lines · Le 1 juin 2017 03:03:39 "Wang, Yipeng1" <[email protected]> a écrit :

Hi Vincent,

Thanks for the comments and some quick responses below:

- DPDK Bloom Filter is derived from the libbloom (as shown by the included
BSD license), but optimized for performance with various DPDK goodness such as rte_zmalloc, rte_bitmap, rte_jhash, etc. It doesn't seem appropriate to
bring those DPDK specific features into libbloom, which is designed for
more generic environments.

Did you try and ask to the original author?

Quoted 2 lines

- DPDK Bloom Filter is just one very basic mode among other more
sophisticated ones in the DPDK Membership Library, which supports a different set of APIs (e.g., bulk lookup, multi-match, etc.) than those supported in libbloom.

How does it justify forking the code?

Quoted 2 lines

- It may make sense to bring some generic (i.e., non DPDK specific) improvements back to libbloom once identified.

So let's start first with contributions to libbloom, please.

Quoted 22 lines

Thanks
Yipeng

Quoted 17 lines

-----Original Message-----
From: Vincent Jardin [mailto:[email protected]]
Sent: Saturday, May 27, 2017 2:42 AM
To: Wang, Yipeng1 <[email protected]>
Cc: [email protected]; Gobriel, Sameh <[email protected]>; Wang, Ren <[email protected]>; Tai, Charlie <[email protected]>
Subject: Re: [dpdk-dev] [RFC] Add Membership Library

Why duplicating Jyri's libbloom - https://github.com/jvirkki/libbloom - for this DPDK capability? Why not showing that you can contribute to libbloom and make it linkable with the DPDK?

There are so many duplicated code...

Thank you,
Vincent

#6 lore raw
In reply to Wang, Yipeng1
Quoted 29 lines · On Thu, 1 Jun 2017 01:03:36 +0000 "Wang, Yipeng1" <[email protected]>…

Hi Vincent,

Thanks for the comments and some quick responses below:

- DPDK Bloom Filter is derived from the libbloom (as shown by the included BSD license), but optimized for performance with various DPDK goodness such as rte_zmalloc, rte_bitmap, rte_jhash, etc. It doesn't seem appropriate to bring those DPDK specific features into libbloom, which is designed for more generic environments.
- DPDK Bloom Filter is just one very basic mode among other more sophisticated ones in the DPDK Membership Library, which supports a different set of APIs (e.g., bulk lookup, multi-match, etc.) than those supported in libbloom.
- It may make sense to bring some generic (i.e., non DPDK specific) improvements back to libbloom once identified.

Thanks
Yipeng

Quoted 17 lines

-----Original Message-----
From: Vincent Jardin [mailto:[email protected]]
Sent: Saturday, May 27, 2017 2:42 AM
To: Wang, Yipeng1 <[email protected]>
Cc: [email protected]; Gobriel, Sameh <[email protected]>; Wang, Ren <[email protected]>; Tai, Charlie <[email protected]>
Subject: Re: [dpdk-dev] [RFC] Add Membership Library

Why duplicating Jyri's libbloom - https://github.com/jvirkki/libbloom - for this DPDK capability? Why not showing that you can contribute to libbloom and make it linkable with the DPDK?

There are so many duplicated code...

Thank you,
Vincent

Note: rte_zmalloc is really no faster in my experience than regular malloc. And under memory pressure rte_malloc is worse than malloc.

#5 lore raw
In reply to Vincent Jardin

Hi,
So, I understand from a call we had today that you'll send an update of this series with:
- rte_membership for DPDK because it uses CRC+hash+rte_malloc+few EALs,
- calls to the lib bloom filter (to avoid forking code),
- using builtin/vectorized gcc instead of asm AVX code to keep it
readable code.

we'll be interested in this update. You are welcomed.

best regards,
Vincent