Skip to content

Add performance test for set/delete routes#2344

Merged
shi-su merged 13 commits intosonic-net:masterfrom
shi-su:perf_test
Oct 21, 2020
Merged

Add performance test for set/delete routes#2344
shi-su merged 13 commits intosonic-net:masterfrom
shi-su:perf_test

Conversation

@shi-su
Copy link
Contributor

@shi-su shi-su commented Oct 14, 2020

Description of PR

Summary: Add a performance test for setting and deleting routes
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

The goal of this PR is to add a test case to quantify the performance of set/delete routes and make sure the operation could finish within the time limit.

How did you do it?

Set or delete multiple (10k level) routes with swssconfig and record the time for the routes to show up in ASIC_DB.

How did you verify/test it?

Verified by running the test locally with a virtual switch.

Any platform specific information?

Supported testbed topology if it's a new test case?

Any.

Documentation

@shi-su shi-su requested a review from qiluo-msft October 14, 2020 03:55
@qiluo-msft qiluo-msft requested a review from prsunny October 15, 2020 01:55
Copy link
Contributor

@qiluo-msft qiluo-msft Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10.1.0.37 [](start = 37, length = 9)

The neigh IP is too similar to the interface IPs. Do you want to use a totally different IP? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to a different IP.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qiluo-msft , @shi-su , the neighbor is expected to be in the same subnet as interface IP. With the subnet of /31, it can have only one neighbor, ie. 10.1.0.55. Suggest to change to a /24 subnet and have few neighbors so as to cover ECMP as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prsunny . Thanks for this suggestion. I updated the test to fix it.

Copy link
Contributor

@qiluo-msft qiluo-msft Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ROUTE_JSON [](start = 0, length = 10)

Use ansible tempfile module to generate a safe temp filename? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using mktemp in DUT to generate this temp file.

Copy link
Contributor

@qiluo-msft qiluo-msft Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ROUTE_JSON [](start = 62, length = 10)

Actually you don't need to copy a file into container. You can call docker exec -i swss swssconfig /dev/stdin < filename #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed as prescribed.

Copy link
Contributor

@qiluo-msft qiluo-msft Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duthost.shell [](start = 22, length = 13)

duthost.shell [](start = 22, length = 13)

Is there already a function for this? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not find a function that does this job. I did find a few other places that use similar sonic-db-cli and redis-cli to get keys.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried about the performance. I found a better solution https://stackoverflow.com/a/18247870/2514803


In reply to: 505121217 [](ancestors = 505121217)

Copy link
Contributor

@qiluo-msft qiluo-msft Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10000 [](start = 17, length = 5)

I thought you change this number much to get a performance diagram. If this is the right use case, could you make a testcase parameter with a default value? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a testcase parameter with default value for the number of routes.

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments

Copy link
Collaborator

@wangxin wangxin Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --num_routes option has been defined in tests/vxlan/conftest.py. There is conflicting. PR testing failed because of this conflicting. Suggest to move definition of this --num_routes specific to route testing to tests/route/conftest.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this suggestion! I did move it to tests/route/conftest.py but the PR tests still fail. And I could not reproduce this problem locally. Wondering if you have any idea about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out that the vxlan tests define the option in init.py and it can be seen outside. Moved the part to a separate conftest.py file resolves the problem.

Copy link
Contributor

@prsunny prsunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have two more cases to consider:

  1. Add IPv6 routes
  2. Add ECMP routes, by creating ~8 neighbors or so and add route pointing to those 8 neighbors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not every platforms have Ethernet72. Is this intended to run only on some platform?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the interface used for the test. Also added IPv6 and multiple neighbors.

@shi-su
Copy link
Contributor Author

shi-su commented Oct 20, 2020

retest this please

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please also resolve others' review comments.

@shi-su shi-su requested review from prsunny and wangxin October 20, 2020 21:57
'interface' : 'Ethernet%d' % (idx_neigh * 4 + 4),
'ip' : '10.%d.0.1/24' % (idx_neigh + 1),
'neighbor' : '10.%d.0.2' % (idx_neigh + 1),
'mac' : '55:54:00:ad:48:%0.2x' % idx_neigh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

55 as the first byte would cause issue in some platforms as they treat this as a multicast mac. For e,g 01:00:53 is the standard multicast mac but many platforms checks only the first byte 01. So please change it to 54 or 00

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! Fixed.

'interface' : 'Ethernet%d' % (idx_neigh * 4),
'ip' : '%x::1/64' % (0x2000 + idx_neigh),
'neighbor' : '%x::2' % (0x2000 + idx_neigh),
'mac' : '55:54:00:ad:48:%0.2x' % idx_neigh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


logger = logging.getLogger(__name__)

def pytest_addoption(parser):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have vxlan change in this PR? Suggest to separate if not part of this feature. @theasianpianist for visibility

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is to resolve the --num-routes option conflicting issue. Please refer to #2344 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --num_routes option is used for route tests and vxlan tests. Currently, vxlan test put pytest_addoption in init.py. This will be seen by pytest during initialization and cause conflict if any other tests try to add --num_routes option. I moved pytest_addoption to conftest.py to resolve conflict.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prsunny I originally put these in __init__.py because we had a bug that caused CLI options defined in test specific conftest.py files to not be recognized. I believe @wangxin has since fixed the issue, so this should be fine.

@shi-su
Copy link
Contributor Author

shi-su commented Oct 21, 2020

retest this please

@shi-su shi-su merged commit 814f702 into sonic-net:master Oct 21, 2020
shi-su added a commit that referenced this pull request Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants