kytos-ng / pathfinder

Kytos main path finder Network Application (NApp)
https://kytos-ng.github.io/api/pathfinder.html
MIT License
0 stars 7 forks source link

[Feature/EP-23-2 blueprint] CSPF links metadata filtering #1

Closed viniarck closed 2 years ago

viniarck commented 2 years ago

Summary

I've also explored this version on mininet with mef_eline and worked as intended since no breaking changes were expected, considering how mef_eline is currently interfacing with pathfinder, and also since it's using at most 2 paths, which was the spf_max_paths default value for now to avoid leaving too much room for high CPU usage when the graph is larger in terms of edges and nodes (which will probably be the case in production). @jab1982 @dgarc330 I think it would be neat to augment some end to end tests to indirectly test that with mef eline, and plan for it, we've got several unit and integration tests, but having the end-to-end would also be great and less biased since even though most of the tests were contributed by the previous authors, I unified some of them.

Perf

When I was exploring some larger topologies in the integration tests, I noticed in some cases, it was noticeable hanging so I decided to benchmark and the function we used to use, as it was being invoked, was exhaustively computing all the best paths, test_n_shortest_simple_paths below, and now we have the k paths being computed lazily, represented by the test_k*_shortest_simple_paths test functions, and these ones are optimal based on the k input:

❯ pytest bench.py --benchmark-columns='min,max,mean,stddev,rounds,iterations'                                                                                                   [NORMAL]
================================================================================== test session starts ===================================================================================
platform linux -- Python 3.6
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /mnt/b/repos/networkx_proto
plugins: benchmark-3.4.1
collected 6 items

bench.py ......                                                                                                                                                                    [100%]

-------------------------------------------------------------- benchmark: 6 tests -------------------------------------------------------------
Name (time in us)                         Min                    Max                   Mean                StdDev            Rounds  Iterations
-----------------------------------------------------------------------------------------------------------------------------------------------
test_k1_shortest_simple_paths         40.4670 (1.0)         473.0600 (3.45)         44.1140 (1.0)          9.6005 (1.12)      14698           1
test_dijkstra                         45.7080 (1.13)        137.0790 (1.0)          49.2101 (1.12)         8.5580 (1.0)       12730           1
test_k2_shortest_simple_paths         52.4290 (1.30)        466.3990 (3.40)         55.3048 (1.25)         8.7324 (1.02)      11143           1
test_k4_shortest_simple_paths         92.0600 (2.27)        295.0550 (2.15)         99.4376 (2.25)        16.7802 (1.96)       8046           1
test_n_shortest_simple_paths      55,771.9020 (>1000.0)  59,501.4840 (434.07)   56,846.8905 (>1000.0)    923.8802 (107.96)       18           1
test_all_shortest_paths           56,784.1620 (>1000.0)  60,191.6640 (439.10)   57,836.4018 (>1000.0)  1,090.3481 (127.41)       18           1
-----------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean
=================================================================================== 6 passed in 6.79s ====================================================================================

UI

2021-10-19-191242_1919x950_scrot

I used the exact same components and layout, I'm not a front-end specialist, but one of the things we could improve in terms of UX would be to more easily to click on desired/undesired links, it's usable as it is, but maybe something to align and prioritize later on.

Open API spec preview

@ajoaoff here's the openapi spec preview, it's still backwards compatible from mef_eline's perspective, if you need help integrating this let me know. thanks.

2021-10-19-181933_889x899_scrot

viniarck commented 2 years ago

LGTM

I appreciated your review @ajoaoff, thanks, I'll merge this PR today.