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

Optimize or re-strategize getAllMonitoredDecisionPointLog query #1063

Closed
danoswaltCL opened this issue Oct 13, 2023 · 3 comments · Fixed by #1062
Closed

Optimize or re-strategize getAllMonitoredDecisionPointLog query #1063

danoswaltCL opened this issue Oct 13, 2023 · 3 comments · Fixed by #1062
Assignees
Labels

Comments

@danoswaltCL
Copy link
Collaborator

Version where bug was found:
5

Describe the bug
Query to find monitored experiment counts performs poorly when there are many marked experiments in the monitored_decision_point table. This was a factor in production incident #1061 where version 5 could not be released to production due to runaway database query times.

the query in question is called here via getAllMonitoredDecisionPointLog and was added for v5 to support within-subjects experiments: https://github.com/CarnegieLearningWeb/UpGrade/blob/8a4fcf1bc14ad4e936a19fe33059db3b40dd3958/backend/packages/Upgrade/src/api/repositories/MonitoredDecisionPointLogRepository.ts

The solution for this was to ensure that this query only was called for within-subjects experiments, and to temporarily disable "within-subjects" as choice. See https://github.com/CarnegieLearningWeb/UpGrade/pull/1062/files.

The query either needs to be optimized, or a new strategy to obtain the necessary information for within-subjects "stack" creation needs to be implemented before we allow within-subjects experiments to be used in production.

To Reproduce
The easiest way to reproduce would be to point to a production database snapshot of the database and create a within-subjects experiment. An assign call with an eligible user should produce a query that looks like:

image

Expected behavior
No bad query times.

@danoswaltCL danoswaltCL added the bug Something isn't working label Oct 13, 2023
@ppratikcr7 ppratikcr7 self-assigned this Oct 16, 2023
@VivekFitkariwala VivekFitkariwala moved this from Todo to QA in UpGrade Project Nov 1, 2023
@danoswaltCL danoswaltCL moved this from QA to In Progress in UpGrade Project Nov 3, 2023
@bcb37 bcb37 moved this from In Progress to Code Review in UpGrade Project Nov 6, 2023
@bcb37 bcb37 moved this from Code Review to QA in UpGrade Project Nov 6, 2023
@bcb37 bcb37 moved this from QA to Done in UpGrade Project Nov 10, 2023
@ppratikcr7
Copy link
Collaborator

@bcb37 @danoswaltCL Should we close this, as its moved to Done Column?

@danoswaltCL
Copy link
Collaborator Author

hm, do we have a ticket somewhere to handle when we actually do need this call in within-subjects experiments?

@danoswaltCL danoswaltCL reopened this Nov 21, 2023
@github-project-automation github-project-automation bot moved this from Done to In Progress in UpGrade Project Nov 21, 2023
@danoswaltCL danoswaltCL moved this from In Progress to Done in UpGrade Project Nov 21, 2023
@ppratikcr7
Copy link
Collaborator

hm, do we have a ticket somewhere to handle when we actually do need this call in within-subjects experiments?

@danoswaltCL I didn't get it. What exactly needs to be handled?

@ppratikcr7 ppratikcr7 moved this from Done to QA in UpGrade Project Nov 22, 2023
@bcb37 bcb37 moved this from QA to Done in UpGrade Project Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
3 participants