-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1526 Benchmark for startup when merging multiple config files #1856
Conversation
Wow! Tanmay! But why do you create new PR(s) having ignored the work on other ones? I would say the team can review this PR after work completion of the previous PR #1842 . @ggnaegi FYI |
Tanmay, seems you didn't understand clearly the user scenario:
First, we don't know how many routes were defined in these old 7 files... maybe 100, but maybe 500, mauve only 7 😄 My understanding of #1526 is the following:
Your benchmark is great! And seems a bit more development should be provided. @ggnaegi Could you review this PR please, and advise on benchmark quality? I believe it is useful, but it needs some refactoring. |
//Setting up for more than 600 routes in different files | ||
CreateOcelotConfigFile(0,100,"ocelot.json"); | ||
CreateOcelotConfigFile(101, 500, "ocelot.second.json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1st step: We need to have some routes in 7+ files
2nd step: We add new file with 80+ routes
We need to split into 2 scenarios
- new file routes are new ones
- new file routes override routes in old files
private int FindAvailablePort() | ||
{ | ||
TcpListener listener = null; | ||
try | ||
{ | ||
listener = new TcpListener(IPAddress.Loopback, 0); | ||
listener.Start(); | ||
return ((IPEndPoint)listener.LocalEndpoint).Port; | ||
} | ||
finally | ||
{ | ||
listener?.Stop(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty new logic?
Why not to use helper from Ocelot.Testing
project. But the PortFinder
uses Socket
to bind to.
You use TcpListener
... So it can be a new helper in Ocelot.Testing
project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
public void Cleanup() | ||
{ | ||
// Stop the web host after benchmarking | ||
_ocelot.StopAsync().GetAwaiter().GetResult(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not await _ocelot.StopAsync();
? 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
Sorry for inconvenience, I'll be raising PR again. Something went wrong with my develop branch and was getting unable to find latest commits on it. |
With develop or feature branch? Please keep your develop identical to head repo develop! Regarding feature branch...
Clear? |
I use same, sync branch sir. But somehow I was getting unnnecessary commits in that and I was ahead of 4-5 commits on develop. So I decided to refork! |
I am sorry sir @raman-m . |
Fixes #1526
Adding benchmark for startup.
We can replicate issue or verify with this PR
Unable to replicate application down with 600 dummy routes.
Proposed Changes
HeavyRoutesStartupBenchmark
benchmark