Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Cache validation packages #2202

Merged
merged 7 commits into from
Jul 13, 2020
Merged

Cache validation packages #2202

merged 7 commits into from
Jul 13, 2020

Conversation

zippy
Copy link
Member

@zippy zippy commented Jul 7, 2020

PR summary

This PR adds caching of FullChain ValidationPackages received from agents so that on subsequent attempts get data from the same agent we can skip the network roud-trip. This is especially important when nodes first come on any may have to hold lots of data from a given node. This can drastically reduce the number of network round-trips.

  • validation data gets cached from direct messages from authors
  • validation data gets cached when rebuilt from dht (may not implement)
  • works for header only validation_package type (may not implement)

testing/benchmarking notes

N.B. App-spec failing

This PR includes changing the sim2h RETRY_FETCH_MISSING_ASPECTS_INTERVAL_MS from .5s to 30 seconds. This is necessary for systemic health (especially as new nodes come online), but causes a number of app-spec tests to fail due to timing issues.

followups

( any new tickets/concerns that were discovered or created during this work but aren't in scope for review here )

changelog

  • if this is a code change that effects some consumer (e.g. zome developers) of holochain core, then it has been added to our between-release changelog with the format
- summary of change [PR#1234](https://github.com/holochain/holochain-rust/pull/1234)

documentation

@zippy zippy changed the title Cache validation packages data so as not to keep re-fetching Cache validation packages Jul 7, 2020
@zippy zippy requested a review from neonphog July 8, 2020 19:30
@zippy zippy marked this pull request as ready for review July 8, 2020 19:31
ValidationCacheData {
entries: validation.source_chain_entries.clone(),
headers: validation.source_chain_headers.as_ref().unwrap().clone(),
cached_at: SystemTime::now(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we cool keeping these things cached forever? cached_at doesn't seem to ever be read.

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'm not persisting this data, so it will be cleared on reboot, which is fine I think because in that case the chain in the cache is probably pretty stale and will need to be fetched anyways. I think he only real reason to dump the cache is because memory gets tight...

Copy link
Contributor

@neonphog neonphog left a comment

Choose a reason for hiding this comment

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

question about cache expiry and comment addition - otherwise looks good 👍

zippy and others added 2 commits July 8, 2020 15:51
Co-authored-by: David Braden <neonphog@gmail.com>
@zippy zippy merged commit 6047b04 into develop Jul 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants