Skip to content

Fetch updated cache entries in bulk - #5970

Merged
sorindumitru merged 7 commits into
spiffe:mainfrom
faisal-memon:use-fetch-entries
Apr 19, 2025
Merged

sorindumitru merged 7 commits into
spiffe:mainfrom
faisal-memon:use-fetch-entries

Conversation

@faisal-memon

Copy link
Copy Markdown
Contributor

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality

Events based cache

Description of change

Use the new FetchRegistrationEntries API from #5910 to get the full list of updated entries rather than fetching them individually.

Which issue this PR fixes

partially addresses #5624

@sorindumitru sorindumitru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we'll also want to limit the number of entries we fetch in one go, I'm sure we'll reach some limit otherwise

@faisal-memon

Copy link
Copy Markdown
Contributor Author

I think we'll also want to limit the number of entries we fetch in one go, I'm sure we'll reach some limit otherwise

Like a page size?

@sorindumitru

Copy link
Copy Markdown
Member

Like a page size?

Sort of, more like a chunk size. Basically if you have a chunk size of 100 and 800 entries, you'd end up making 8 FetchRegistrationEntries calls.

@faisal-memon

Copy link
Copy Markdown
Contributor Author

Like a page size?

Sort of, more like a chunk size. Basically if you have a chunk size of 100 and 800 entries, you'd end up making 8 FetchRegistrationEntries calls.

@sorindumitru Added this functionality in.

@sorindumitru sorindumitru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks great to me. I'll try to run it tomorrow through a setup I had where I can reproduce the skipped entries issue with a large number of events, to see how well it behaves and also try to test a couple of different options for the pageSize.

@sorindumitru

Copy link
Copy Markdown
Member

Ran this locally with mysql, postgres and sqlite and it seemed to work ok with all 3. For mysql and postgres I ran them using the public docker container for them, so a very simple setup.

All 3 of them seem to work ok with this as it is. Somewhat surprisingly postgres seems to have worked the best and sqlite the worst. But this turned out to be more about the time it took to create the entries as opposed to sync them.

In terms of limits I could find that postgres has a limit of 65536, sqlite of 32768. I couldn't find a good source for mysql but one source mentioned 65536 for prepared statements due to using a short for holding the number of parameters.

@sorindumitru sorindumitru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me, thanks Faisal!

@faisal-memon

Copy link
Copy Markdown
Contributor Author

Thanks for testing @sorindumitru

@sorindumitru
sorindumitru force-pushed the use-fetch-entries branch 3 times, most recently from 350b999 to 2f10852 Compare April 18, 2025 18:31
faisal-memon and others added 7 commits April 19, 2025 08:14
…ies.go

Co-authored-by: Sorin Dumitru <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
…ies.go

Co-authored-by: Sorin Dumitru <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
@sorindumitru sorindumitru added this to the 1.12.1 milestone Apr 19, 2025
@sorindumitru
sorindumitru merged commit 7a7ad6e into spiffe:main Apr 19, 2025
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.

2 participants