Joystream / Joystream/joystream
Giza integration tests: Distributor node: Cache eviction
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
Preconditions:
- A running Joystream node
- A running query-node
- A running storage node which accepts channel assets and has sufficient limits set to handle the scenario
- A running distributor node which accepts channel assets and has sufficient limits set to handle the scenario
Flow parameters:
lg- lowest (best) data object initial LRU-SP cache grouphg- highest (worst) data object initial LRU-SP cache group
Other variables:
ts- total created data objects size, always equal to[2^lg + 2^(lg+1) + ... + 2^hg]gc-CACHE_GROUPS_COUNTdistributor node constantsl- distributor node's storage limit
Constraints:
hg >= lg + 2lg >= 2sl >= ts
Part 1: Movement between cache groups
- Check the cache limit in the distributor node using
/statusendpoint. Populate the distributor node cache with data objects of total size equal tosl - ts. - For each group
ibetweenlgandhgupload 3 data objects (let's call them{i}-0,{i}-1and{i}-2) of size2^ito storage - Let
t1be the timestamp taken at this setp (in seconds) - Request all created objects from distributor node (
GETrequest) - Wait at least one minute or until all objects are confirmed to be fully cached by the distributor node (whichever takes longer)
- For each group
ibetweenlgandhg(from lowest to highest):- Send 1 request to retrieve object
{i}-1 - Send 3 requests to retrieve object
{i}-2 - Wait at least 1 minute or until all responses are recieved (whichever takes longer)
- Send 1 request to retrieve object
- Let
t2be the timestamp at this step (in seconds) - Wait at least
ceil( (t2-t1)/60 )minutes. This will make sure theelapsedparameter of LRU cache items (e) won't affect the expected result, because the ratio of highesteto lowestewill become< 2 - We expect the cache structure to be the following:
-
Group
lg-2:- Each item has
(s/p) = 2^(lg-2)
LRU set:- object
{lg}-2
- object
- Each item has
-
Group
lg-1:- Each item has:
(s/p) = 2^(lg-1)
LRU set:- object
{lg+1}-2, accessed at least 1 minute before: - object
{lg}-1
- object
- Each item has:
-
Group
{lg}:- Each item has:
(s/p) = 2^(lg)
LRU set:- object
{lg+2}-2, accessed at least 1 minute before: - object
{lg+1}-1, accessed at least 1 minute before: - object
{lg}-0
...
- object
- Each item has:
-
Group
{hg-2}:- Each item has:
(s/p) = 2^(hg-2)
LRU set:- object
{hg}-2, accessed at least 1 minute before: - object
{hg-1}-1, accessed at least 1 minute before: - object
{hg-2}-0
- object
- Each item has:
-
Group
{hg-1}:- Each item has:
(s/p) = 2^(hg-1)
LRU set:- object
{hg}-1, accessed at least 1 minute before: - object
{hg-1}-0
- object
- Each item has:
-
Group
{hg}:- Each item has:
(s/p) = 2^(hg)
LRU set:- object
{hg}-0
- object
Note that each time cache eviction is triggered:
- The last item from the LRU set in each group is chosen (least recently accessed item)
- We calculate the cost of each chosen item (where the cost is:
s/p*e) - We evict item with highest cost
Because in step
9.we mitigated the effect ofefor the purpose of this test, we can assume the cost of each item is justs/p.Given items
{a}-{b}and{c}-{d}we know that{a}-{b}will be dropped before{c}-{d}, if:a-b > c-dor,a-b == c-dandb < d
We sort all items accordingly to the rules above (from first-dropping to last-dropping).
- Each item has:
- For each item
{i}in the set created in step10.:- Make sure item
{i}is cached by distributor node (useHEADrequest to verify) - Create another data object with size equal to the size of item
{i}and upload it to storage - Request the created object from distributor node
- Make sure the request succeeds and item
{i}is dropped from the cache (useHEADrequest to verify)
- Make sure item
Part 2: Dropping order depending on elapsed parameter
- Upload 1 data object of size
2^(lg+1)(let's call itA) - Upload 2 data objects of size
2^(lg)(let's call themBandC) - Request all objects (
A-C) from distributor node usingGETrequests - Wait until the objects are fully cached
- Request object
Cfrom distributor node usingGETrequest - Wait 4 minutes
- Request objects
AandBfrom distributor node usingGETrequests (can be requested simultaneously) - We expect the cache structure to be the following:
-
Group
lg-1:- Each item has:
(s/p) = 2^(lg-1)
LRU set:- object
B, elapsed = ~1 minute - object
C, elapsed = ~5 minutes
- object
- Each item has:
-
Group
lg:- Each item has:
(s/p) = 2^(lg)
LRU set:- object
A, elapsed = ~1 minute
- object
Therefore the items should be dropped in the following order:
C(because5*2^(lg-1) > 1*2^(lg))A(because1*2^(lg) > 1*2^(lg-1))B
- Each item has:
- For each item
{i}in [C,A,B] set (starting fromCand ending withB):
- Make sure item
{i}is cached by distributor node (useHEADrequest to verify) - Create another data object with size equal to the size of item
{i}and upload it to storage - Request the created object from distributor node
- Make sure the request succeeds and item
{i}is dropped from the cache (useHEADrequest to verify)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Giza integration-test entry point for the distributor node and the /status, GET, and HEAD request helpers; no file paths are named in the issue. Run the existing distributor integration tests with a running Joystream node, query-node, storage node, and distributor node, then verify both described eviction orders and cache-presence checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100