Skip to content

Commit 4cdb7d2

Browse files
authored
Make Number of mbufs a Constant Value (#79)
We have been observing performance regression from the last few releases, this PR fixes one of the issues. This PR boosts basic_monitor & pktgen benchmark performance from 7Mpps to 13.1 Mpps. This is done by changing the number of mbufs to a static constant instead of it being a function depending on MAX_NFS number as setting the number of mbufs too high leads to performance degradation. The best performance is around 16-32 MAX_NFS number. This computes to a num of mbufs value between 27648 (16*1536 + 1536*2) and 52224 (32*1536 + 1536*2). Selected 32767 (2^15 - 1, negative one from DPDK docs) because it is between those numbers and tends to have the same performance. Commit log: * Fix mbuf size to a static constant * Adjust mbuf num to match dpdk recs
1 parent 46b6bc6 commit 4cdb7d2

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

onvm/onvm_mgr/onvm_init.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,11 @@ init(int argc, char *argv[]) {
265265
*/
266266
static int
267267
init_mbuf_pools(void) {
268-
const unsigned num_mbufs = (MAX_NFS * MBUFS_PER_NF) \
269-
+ (ports->num_ports * MBUFS_PER_PORT);
270-
271268
/* don't pass single-producer/single-consumer flags to mbuf create as it
272269
* seems faster to use a cache instead */
273270
printf("Creating mbuf pool '%s' [%u mbufs] ...\n",
274-
PKTMBUF_POOL_NAME, num_mbufs);
275-
pktmbuf_pool = rte_mempool_create(PKTMBUF_POOL_NAME, num_mbufs,
271+
PKTMBUF_POOL_NAME, NUM_MBUFS);
272+
pktmbuf_pool = rte_mempool_create(PKTMBUF_POOL_NAME, NUM_MBUFS,
276273
MBUF_SIZE, MBUF_CACHE_SIZE,
277274
sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init,
278275
NULL, rte_pktmbuf_init, NULL, rte_socket_id(), NO_FLAGS);

onvm/onvm_mgr/onvm_init.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@
8383
/***********************************Macros************************************/
8484

8585

86-
#define MBUFS_PER_NF 1536
87-
#define MBUFS_PER_PORT 1536
8886
#define MBUF_CACHE_SIZE 512
8987
#define MBUF_OVERHEAD (sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
9088
#define RX_MBUF_DATA_SIZE 2048

onvm/onvm_nflib/onvm_common.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@
5050
#include "onvm_msg_common.h"
5151
#include "onvm_config_common.h"
5252

53-
#define ONVM_MAX_CHAIN_LENGTH 4 // the maximum chain length
54-
#define MAX_NFS 128 // total number of NFs allowed
55-
#define MAX_SERVICES 32 // total number of unique services allowed
56-
#define MAX_NFS_PER_SERVICE 32 // max number of NFs per service.
53+
#define ONVM_MAX_CHAIN_LENGTH 4 // the maximum chain length
54+
#define MAX_NFS 128 // total number of NFs allowed
55+
#define MAX_SERVICES 32 // total number of unique services allowed
56+
#define MAX_NFS_PER_SERVICE 32 // max number of NFs per service.
5757

58+
#define NUM_MBUFS 32767 // total number of mbufs (2^15 - 1)
5859
#define NF_QUEUE_RINGSIZE 16384 //size of queue for NFs
5960

6061
#define PACKET_READ_SIZE ((uint16_t)32)

0 commit comments

Comments
 (0)