Skip to content
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 plugin] Reduce startup time by applying a more aggresive retry strategy #197074

Open
afharo opened this issue Oct 21, 2024 · 1 comment
Labels
good first issue low hanging fruit Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@afharo
Copy link
Member

afharo commented Oct 21, 2024

Our current licensing plugin polls the licensing information periodically (default: every 30s).

Relevant pieces of code:

  • Trigger definition:
    // Trigger whenever the timer ticks or ES becomes available
    const intervalRefresh$ = this.isElasticsearchAvailable$.pipe(
    distinctUntilChanged(),
    filter((isElasticsearchAvailable) => isElasticsearchAvailable),
    switchMap(() => timer(0, pollingFrequency).pipe(takeUntil(isElasticsearchNotAvailable$))),
    throttleTime(pollingFrequency) // avoid triggering too often
    );
  • Actual fetching:
    const fetched$ = merge(triggerRefresh$, manuallyRefresh$).pipe(
    takeUntil(stop$),
    exhaustMap(fetcher),
    share()
    );

When the license fails to be fetched, Kibana waits for the next polling trigger to kick in, which leads to Kibana taking 30s for the next retry to occur. The main issue here is that network issues or ES starting up might lead to Kibana taking extra 30s to be ready to address authenticated HTTP traffic after startup.

We could improve this situation by applying a retry with back-off strategy that can retry the license fetch on failure, after a progressively increasing interval until we reach the actual polling interval (1s, 2s, 4s, 8s, 16s, 30s, 30s, ...).

@afharo afharo added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Oct 21, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@afharo afharo added the good first issue low hanging fruit label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue low hanging fruit Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

2 participants