-
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
Do not initialise RequestHandlerContext object when serve bundle assets #128880
Comments
Pinging @elastic/kibana-core (Team:Core) |
I though kibana/src/core/server/http/http_server.ts Lines 487 to 491 in d5416ed
it does. So the only difference between
kibana/src/core/server/http/http_server.ts Lines 495 to 498 in d5416ed
where
If we were to change
More work, but that's ihmo the end goal here, as it will improve performance for all routes and not only the bundles ones. We could even think of an option to allow route registration to totally opt-out of context handling/wrapping. This may be type-hell though, as the handlers would change from |
So I took a shot as using
Note that looking at https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#freshness, revalidation should not be performed until the max-age based freshness expires, so it may not, in fact be an issue? Could anyone with better http-caching experience than I have confirm (or infirm) this?
This will go away if using |
Also linking to #84763 which is the opened issue about
|
Yeah I think we can close as resolved by #129896 |
Kibana uses the standard
RequestHandler
interface to send static assets (js bundles) to the browser.kibana/src/core/server/core_app/bundle_routes/dynamic_asset_response.ts
Line 51 in 8f63225
The problem with this approach is that the
RequestHandler
creates aRequestHandlerContext
object on every invocation, even though the route handler does not use the initialized context object. Thus, Kibana performs unnecessary work since most properties extending theRequestHandlerContext
object are instantiated eagerly.Proposed Solution
Kibana provides API to serve static assets
kibana/src/core/server/core_app/core_app.ts
Lines 201 to 204 in 8f63225
CoreApp
service can be refactored to use it, or Core can provide an alternative implementation that doesn't requireRequestHandlerContext
initialization on every call.Another option could be to refactor
Context
service to build context objects lazily on demandkibana/src/core/server/context/container/context.ts
Line 227 in 8f63225
The text was updated successfully, but these errors were encountered: