Skip to content

Fix for slowdown caused by initialfetch#16969

Merged
karthiknadig merged 6 commits into
microsoft:mainfrom
karthiknadig:tas-client-fix
Aug 16, 2021
Merged

Fix for slowdown caused by initialfetch#16969
karthiknadig merged 6 commits into
microsoft:mainfrom
karthiknadig:tas-client-fix

Conversation

@karthiknadig

Copy link
Copy Markdown
Member

Closes #16959

@karthiknadig karthiknadig self-assigned this Aug 13, 2021
await this.experimentationService.initialFetch;

const experiments = this.globalState.get<{ features: string[] }>(EXP_MEMENTO_KEY, { features: [] });
if (experiments.features.length === 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Do we need to run this.experimentationService.initialFetch in background in the other case, to ensure the cache is eventually populated?
  • When the fetch eventually completes, does that mean experiments are changed mid-session?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to run this.experimentationService.initialFetch in background in the other case, to ensure the cache is eventually populated?

initialFetch is a promise, so it will be run in the background no matter what.

When the fetch eventually completes, does that mean experiments are changed mid-session?

Yes, this may happen.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this may happen.

This seems unideal. In deprecated exp manager, we had a separate storage for experiments downloaded in background, and it was only used in the next session.

Seems like a feature request for the exp team.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an interim solution. We could essentially read all the values at start up and use a in memory cache for the experiment values?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see, under the hood the package loads info from cache, but then doesn't update the in-memory data for this session unless the overrideInMemoryFeatures flag for getFeaturesAsync is set to true.

@karthiknadig Could you set a breakpoint in getFeaturesAsync (in node_modules/tas-client/tas-client/ExperimentationServiceBase.js) and see if it's ever called with overrideInMemoryFeatures set to true? If that's the case, we would probably use the solution you suggest. If not, we don't need to make extra changes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding a comment describing this behavior.

Comment thread src/client/common/experiments/service.ts Outdated
Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
@karthiknadig karthiknadig merged commit a75688b into microsoft:main Aug 16, 2021
@karthiknadig karthiknadig deleted the tas-client-fix branch August 16, 2021 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Start up performance issues with the async TAS calls

3 participants