-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Licensing: Move shareReplay
to the bottom
#140763
Conversation
@elasticmachine merge upstream |
Running the test script linked in #129589, these are the side-by-side results:
Not a big change... although it's true that this PR achieved the shortest avg runtime (when loaded). But it may be circumstantial... 🤷 |
Pinging @elastic/kibana-core (Team:Core) |
Assigning @gsoldevila to review as he was the last one to touch this observable chain and IIRC we spent some time discussing the order and flow of the licensing observable at the time, so there may be a reason why it was in that exact order. |
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
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.
LGTM, this will cause the hasLicenseInfoChanged
to be executed once per emission, rather than once per emission per subscription.
That being said, I don't think this will bring any substantial performance improvements, as it will only reduce the number of calls for operators above the
Note that:
|
I agree! The performance improvements will be very low:
However, #129589 tested out downloading Bearing in mind that |
That's a fair point! Let's see if we can shave those 4ms off then. |
Summary
Potentially resolves #129589 (@lizozom can you help me out validating it?).
The
license$
observable is consumed on every pre_respose hook in HAPI to add the headerkbn-license-sig
:https://github.com/elastic/kibana/blob/3730dd0779ed8efd74aee88f57422781ec1ac122/x-pack/plugins/licensing/server/on_pre_response_handler.ts
Moving the
shareReplay
entry at the bottom of thepipe
avoids performing the computation that we run today.For simple requests like the one specified #129589, it may add up.
For maintainers