-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Embedded HTTP benchmark, various small perf improvements #8974
Conversation
SonarCloud Quality Gate failed. |
@Requires(property = "spec.name", value = "FullHttpStackBenchmark") | ||
public class SearchController { | ||
@Post("find") | ||
public HttpResponse<?> find(@Body Input input) { |
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.
It would be nice to test more variations, like returning a simple string, a completable future reactive response.
Right now the async flow (completable future) is executed using the reactor which can be improved
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.
this benchmark is from micronaut-benchmark, which does not use reactive / async code so that it's a more fair comparison between frameworks. benchmarking reactive code is also worthwhile but this simple controller is basically the best "bare-bones" test of the http stack
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.
Ok, having some other benchmark testing overhead of async/reactive flow would be nice
* the next step will be executed later | ||
*/ | ||
@Nullable | ||
final Step atomicSetOutput(Object output) { |
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.
It would be better to name the methods like they are actually in the flow, setSomethin
is very confusing
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.
what do you mean like in the flow? the method sets the output field (if step is unset) which is why it's called that, but yea it does a bit more than set
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.
Is just the naming is not very clear to me, I would expect something like process next, but it doesn't matter much
This PR contains a benchmark for the full http stack using EmbeddedChannel. It's almost as close to reality as testing TCP directly, but it's on a single thread so it's a bit easier to work with. It stresses the full HTTP stack including netty handlers, routing, filters, serialization and so on.
There are a few minor optimizations with relatively small diffs. There is also one fairly big change: Introducing a new DelayedExecutionFlow which acts kind of like CompletableFuture, but is faster (it doesn't have to support multiple downstreams for every CF).
The changes are separated into individual commits, so you can look at each commit one by one if you want. But they don't cross over each other very much anyway.
I'm not done optimizing, but because the DelayedExecutionFlow is a fairly big diff I want to make this PR before it blows up further.