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

[backend] Improve redis sessions list perf (#7943) #8119

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

SouadHadjiat
Copy link
Member

@SouadHadjiat SouadHadjiat commented Aug 20, 2024

Proposed changes

  • prevent locking the event loop when parsing users sessions

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case (coverage and e2e)
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

@SouadHadjiat SouadHadjiat added the filigran team use to identify PR from the Filigran team label Aug 20, 2024
Copy link

codecov bot commented Aug 20, 2024

Codecov Report

Attention: Patch coverage is 62.25166% with 57 lines in your changes missing coverage. Please review.

Project coverage is 66.28%. Comparing base (e44e755) to head (d0e063c).

Files with missing lines Patch % Lines
...cti-platform/opencti-graphql/src/database/redis.ts 51.76% 41 Missing ⚠️
...i-platform/opencti-graphql/src/database/session.js 82.00% 9 Missing ⚠️
...rm/opencti-graphql/src/manager/telemetryManager.ts 0.00% 4 Missing ⚠️
...pencti-platform/opencti-graphql/src/domain/user.js 60.00% 2 Missing ⚠️
...-platform/opencti-graphql/src/http/httpPlatform.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8119      +/-   ##
==========================================
- Coverage   66.30%   66.28%   -0.02%     
==========================================
  Files         597      597              
  Lines       60949    61008      +59     
  Branches     6262     6268       +6     
==========================================
+ Hits        40410    40442      +32     
- Misses      20539    20566      +27     

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

@SouadHadjiat SouadHadjiat marked this pull request as ready for review August 21, 2024 16:02
};
export const getSession = async (key: string) => {
export const getSession = async (baseKeyId: string) => {
const key = `{${PLATFORM_KEY_SESSIONS}}:${baseKeyId}`; // Key of a list must be attached to the same redis slot
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand, does it mean the session key has now PLATFORM_KEY_SESSIONS as a prefix ?

Copy link
Member Author

Choose a reason for hiding this comment

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

something is wrong with this {${PLATFORM_KEY_SESSIONS}}:${baseKeyId}, when I debug this method, I find myself with a duplicate {${PLATFORM_KEY_SESSIONS}}: prefix, I'm not sure we should add it here, since the key is already named in redis with this prefix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filigran team use to identify PR from the Filigran team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants