Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Settings] Cache settings after first retrieval #9216

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

driusan
Copy link
Collaborator

@driusan driusan commented Apr 24, 2024

There are a number of settings that we use frequently in LORIS such as "base" to get the base path. When accessed multiple times in a request at different places in LORIS, each one currently requires a query against the database.

This caches any settings that are used in NDB_Config so that future calls to getSetting() can return the cached value and not make another round trip to the DB.

@driusan driusan force-pushed the SettingCache branch 2 times, most recently from da4b7de to 14eaf24 Compare April 24, 2024 18:52
@skarya22
Copy link
Contributor

Testing shows that this did not introduce any issues in modules that use the getSetting function, however I wanted to note that it seems that although it has reduced the number of DB pulls, it seems that sometimes it skips over the cache for some reason.
I set the function to log when it pulls from cache, and when it pulls from DB. If you look at the useEDC field you can see here that it pulls it three times when I load candidate_list, it pulls from the DB twice, and uses the cached value once. Not necessarily an issue, but just something to note incase we want to improve it further
image

@driusan driusan merged commit 44d6da5 into aces:main Apr 25, 2024
28 checks passed
@driusan
Copy link
Collaborator Author

driusan commented Apr 25, 2024

@skarya22 is it possible the logs are coming from different requests?

@skarya22
Copy link
Contributor

@driusan I suppose it is possible, but shouldn't it still ideally pull from the same cache?

@driusan
Copy link
Collaborator Author

driusan commented Apr 26, 2024

No.

I mean, ideally, yes. But I don't think that is possible with PHP (at least not in any easy way) since each request is isolated in its own process/thread with its own state.

@ridz1208 ridz1208 added this to the 26.0.0 milestone Jun 6, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants