Closed faolivera closed 7 years ago
Hi Facundo, I really appreciate the effort you put into this.
Now, the issue I see with this is that it is a breaking change that will create some amount of work to fix. I haven't migrated one of our projects so I don't have a complete understanding of the impact yet.
Hi Werner, Thank you for your feedback, I'll prepare some performance test in order to understand better if there is some performance penalty or not. We can continue talking about this PR after the performance tests results.
Great! How about the other point? I started to migrate one of our services and quickly found out that this basically changes so much to the point that this feels like a different library. Do you think it might be possible to have both the version with explicit context passing as well as via thread locals and the user can choose which to use? Probably by setting the default-dispatcher
or not. Even if we were to ultimately use only the thread locals (and I definitely like them) this would greatly improve the migration story for existing users.
Yes, I will changed the PR to make it compatible with the current implementation, but only after seeing the test performance results so we know if it worth it to invest more work on this feature or not :). I think it is possible to make it compatible, also I will add an implementation for an ExecutionContext that propagate the Context so you can choose if use the Dispatcher or just to use the ExecutionContext wherever the library user consider it necessary.
Awesome. Because I like the idea.
I created this project for running the performance test for this PR: https://github.com/faolivera/hutmann-performance-test it is possible to download it and run it.
Some Results
Report for default Dispatcher Report for custom Dispatcher
Request Time | Default Dispatcher | Custom Dispatcher |
---|---|---|
<100 ms | 9.95% | 7.15% |
>100ms < 200ms | 10.4% | 10.3% |
>200ms < 300ms | 9.55% | 11.05% |
>300ms < 400ms | 7.25% | 8.94% |
Report for default Dispatcher Report for custom Dispatcher
Request Time | Default Dispatcher | Custom Dispatcher |
---|---|---|
<100 ms | 14.65% | 8.75% |
>100ms < 200ms | 10.95% | 8.19% |
>200ms < 300ms | 8.69% | 9.75% |
>300ms < 400ms | 5.05% | 7.74% |
Report for default Dispatcher Report for custom Dispatcher
Request Time | Default Dispatcher | Custom Dispatcher |
---|---|---|
<100 ms | 19.65% | 12.08% |
>100ms < 200ms | 11.05% | 6.55% |
>200ms < 300ms | 11.55% | 7.4% |
>300ms < 400ms | 2.75% | 6.8% |
Apologies for the long waiting time.
I think the values are good enough that it would warrant inclusion in the library. Then again, I'd like to defer the decision to you as the work would fall on you. If the version with the custom dispatcher is just a new feature and the library would behave no different for existing users, I basically don't care that much about the performance of the new feature.
Hi! Thank you for taking the time to review the PR. I made rollback some changes and add new ones in order to maintain the compatibility with the existing version. You can update the library version in your project and don't even notice the changes. Please let me know if there is something else that I can do.
:+1:
👍
Changes made in order to propagate the Context using ThreadLocal Variables.