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

Performance Refactor for privacy-experience #4192

Merged
merged 10 commits into from
Sep 30, 2023

Conversation

ThomasLaPiana
Copy link
Contributor

@ThomasLaPiana ThomasLaPiana commented Sep 29, 2023

Closes #4040

Description Of Changes

See below ⬇️

This PR will be followed up with another that focuses on adding proper Caching to that endpoint

Code Changes

  • update drill to give us more data for A/B testing
  • sprinkle in asyncio.sleep calls to force privacy-experience to give up the event loop between heavy db calls

Steps to Confirm

  • run nox -s dev and then nox -s load_tests, it should be observed that the response times for all endpoints (besides privacy-experience) are extremely consistent, representing that they aren't being significantly blocked by privacy-experience

Pre-Merge Checklist

@ThomasLaPiana ThomasLaPiana self-assigned this Sep 29, 2023
@cypress
Copy link

cypress bot commented Sep 29, 2023

Passing run #4430 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge d8ba25b into c91f688...
Project: fides Commit: bbbc5f8067 ℹ️
Status: Passed Duration: 00:52 💡
Started: Sep 30, 2023 6:29 AM Ended: Sep 30, 2023 6:30 AM

Review all test suite changes for PR #4192 ↗︎

@ThomasLaPiana
Copy link
Contributor Author

ThomasLaPiana commented Sep 29, 2023

I found a good caching library but it requires a newer version of the Python Redis library, which is a breaking change and will require updates on our side...going to give it a shot

Nevermind we're on a really old version of Redis for python, I'll move it to a new PR

@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (c91f688) 87.67% compared to head (d8ba25b) 87.67%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4192   +/-   ##
=======================================
  Coverage   87.67%   87.67%           
=======================================
  Files         333      333           
  Lines       20734    20743    +9     
  Branches     2690     2690           
=======================================
+ Hits        18178    18187    +9     
  Misses       2093     2093           
  Partials      463      463           
Files Coverage Δ
...i/api/v1/endpoints/privacy_experience_endpoints.py 93.75% <100.00%> (+0.54%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ThomasLaPiana ThomasLaPiana marked this pull request as ready for review September 29, 2023 13:17
@@ -174,6 +175,7 @@ def privacy_experience_list(
db=db, fides_user_device_id=fides_user_device_id
)

await asyncio.sleep(delay=0.001)
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, where did you come up with this trick?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I recall having to use this trick years ago but don't really remember where I learned it...probably from a book like Fluent Python if I had to guess

@ThomasLaPiana ThomasLaPiana merged commit 76af3fa into main Sep 30, 2023
39 checks passed
@ThomasLaPiana ThomasLaPiana deleted the add-more-drill-endpoints branch September 30, 2023 08:32
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.

Add "real" endpoints to the drill bencharks
2 participants