Hi List,

We have been using policer_add_del and classify_add_del_session in single 
threaded VPP (ie one main thread only) and both API were giving decent 
performance, but after switching to multi thread VPP the performance seems be 
drastically less.

To test this out a small test program was written which will add 10,000 policer 
and classify table entries and measure the speed.

In single threaded VPP the program took 2.19 sec while with 1 main and 2 worker 
threads it took 115.89 sec. The tests were conducted without any traffic 
flowing through VPP.

The python test program too is attached for reference.

Platform and version are:

vpp# sh version
vpp v21.01.0-1~gfa065f96d built by root on ubuntu20-04 at 2021-02-24T09:00:32

vpp# sh cpu
Model name: Intel(R) Xeon(R) Silver 4208 CPU @ 2.10GHz
Microarch model (family): [0x6] Skylake ([0x55] Skylake X/SP) stepping 0x7
Flags: sse3 pclmulqdq ssse3 sse41 sse42 avx rdrand avx2 pqm pqe avx512f rdseed 
aes avx512_vnni invariant_tsc
Base frequency: 2.09 GHz
vpp#

vpp# sh thread
ID Name Type LWP Sched Policy (Priority) lcore Core Socket State
0 vpp_main 4230 other (0) 1 7 0
1 vpp_wk_0 workers 4243 other (0) 2 1 0
2 vpp_wk_1 workers 4244 other (0) 3 6 0
vpp#

corresponding classify table : classify table mask l3 ip4 src miss-next drop 
memory-size 800M

Is this behavior expected? Can some thing be done to achieve performance 
similar to single threaded VPP while running VPP with multiple threads?

X.
#!/usr/bin/env python3

from __future__ import print_function
import os
import fnmatch
from vpp_papi import VPPApiClient
import binascii
from ipaddress import ip_address
import random
import time
import sys

if sys.argv[1] and sys.argv[2]:
    total_req = int(sys.argv[1])
    offset = int(sys.argv[2])
    add = int(sys.argv[3])
else:
    print("2 args requered 1st: total no. 2nd: offset")
    sys.exit(0)
vpp_json_dir = '/usr/share/vpp/api/'
jsonfiles = []

for root, dirnames, filenames in os.walk(vpp_json_dir):
    for filename in fnmatch.filter(filenames, '*.api.json'):
        jsonfiles.append(os.path.join(root, filename))

if not jsonfiles:
    print('Error: no json api files found')
    exit(-1)

vpp = VPPApiClient()
r = vpp.connect("test_papi")

# CREATE CLASSIFY SESSION
match_len = 32#mask_len
match_n_vectors = 1
is_add = int(add) 
count = int(offset)
to = int(offset)+int(total_req)
st = time.time()
print(st)
for i in range(offset, to):
    name = "policy"+str(i)
    r = vpp.api.policer_add_del(is_add=is_add, name=name, cb=2500,cir=1000, eb=3000,eir=0,rate_type=0,round_type=1,type=1)
    match = "00000000000000000000000000000000000000000000000000006460" + str("%04x" % i) + "0000"
    match = binascii.unhexlify(match)
    r = vpp.api.classify_add_del_session(is_add=is_add,table_index=0,match=match,advance=1,match_len=match_len,metadata=0,action=0, hit_next_index = r.policer_index)
et = time.time()
print(et)
at = et - st
print("sec: ", at)
exit(vpp.disconnect())
sys.exit(0)
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#18805): https://lists.fd.io/g/vpp-dev/message/18805
Mute This Topic: https://lists.fd.io/mt/80903834/21656
Group Owner: [email protected]
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to