Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Cache] Optimize caching of tags #45896

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

Merged
merged 1 commit into from
Apr 25, 2022

Conversation

sbelyshkin
Copy link
Contributor

@sbelyshkin sbelyshkin commented Mar 30, 2022

Q A
Branch? 6.1
Bug fix? no
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

It's the follow-up to #42997.

  1. Forcing the adapter to fetch tags on item commits makes the algorithm straightforward and a bit more optimized.
  2. Caching tag versions only when they are retrieved from or being persisted to the pool ensures that any tagged item will be rejected when there is no related tags in the pool.
  3. Using FIFO instead of LRU for known tag versions allows to use all cached tags until expiration and still be able to prevent memory leak.

@carsonbot
Copy link

It looks like you unchecked the "Allow edits from maintainer" box. That is fine, but please note that if you have multiple commits, you'll need to squash your commits into one before this can be merged. Or, you can check the "Allow edits from maintainers" box and the maintainer can squash for you.

Cheers!

Carsonbot

@nicolas-grekas
Copy link
Member

Thanks for having another look :)
For 1. and 2., is it really better? To me, the main thing to optimize is the number of roundtrips to the backend. The changes here increase the number of roundtrips, so they should degrade perf to me.

@sbelyshkin
Copy link
Contributor Author

sbelyshkin commented Mar 31, 2022

P.1 and p.2 don't change the number of roundtrips, they just force the adapter to always work the same and not to rely on quasi-uniqueness of tag versions in some situations. P.3 may change the number of roundtrips but only downward by allowing large sets of tags (500+) to be cached for the very next reads (until other tags are requested). And although smaller sets are not affected much, I would suggest to use pruning instead of LRU cut-off. Pruning only expired tags would allow use of all known tags in any read operaion during their TTLs (as it was before).

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

Here is my (miss)understanding of your proposal :)

@sbelyshkin sbelyshkin force-pushed the improve-tags-fetching branch 2 times, most recently from 78fff0c to 7d0735c Compare April 8, 2022 11:25
@sbelyshkin sbelyshkin force-pushed the improve-tags-fetching branch from 7d0735c to a366300 Compare April 15, 2022 07:30
@sbelyshkin sbelyshkin changed the title [Cache] Optimize fetching of tags [Cache] Optimize caching of tags Apr 15, 2022
@sbelyshkin sbelyshkin force-pushed the improve-tags-fetching branch 2 times, most recently from 9763ed0 to 1ccd607 Compare April 18, 2022 05:40
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

Just one last question and good to me!

@sbelyshkin sbelyshkin force-pushed the improve-tags-fetching branch from 1ccd607 to e53f742 Compare April 20, 2022 05:46
@sbelyshkin sbelyshkin force-pushed the improve-tags-fetching branch 3 times, most recently from 82ca189 to 0faaa75 Compare April 25, 2022 03:08
@nicolas-grekas nicolas-grekas force-pushed the improve-tags-fetching branch from 0faaa75 to 68f309b Compare April 25, 2022 17:19
@nicolas-grekas
Copy link
Member

Thank you @sbelyshkin.

@nicolas-grekas nicolas-grekas merged commit fa636c0 into symfony:6.1 Apr 25, 2022
@fabpot fabpot mentioned this pull request Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants