[Gateway] Remove redundant list kernels request during session poll #1112
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Lab services issues
/api/kernels
and/api/sessions
requests every 10 seconds on behalf of itsKernelManager
andSessionManager
instances, respectively. When a gateway server is configured, the/api/kernels
request is forwarded to the gateway server, while the/api/sessions
request only needs to ensure the kernel model in its list of sessions is still valid (i.e., not culled) - which leads to an additional (but specific)/api/kernels/<kernel_id>
request.In highly latent and multi-tenant installations (in which a single gateway is servicing multiple clients) each of these requests adds up. This pull request eliminates the
/api/kernels/<kernel_id>
request performed on behalf of the client's/api/sessions
request by treating the set of kernel models maintained via the/api/kernels
request as the truth. Since the/api/kernels
request will detect kernels culled on the gateway server and update its list accordingly, we can use the kernel_id's absence in the list as an indicator it has been culled, triggering the session's deletion from the session table. The net effect of this is that the periodic (and constant)/api/kernels
requests are reduced by 50%.