maypok86/otter

How the cost works?

woodliu opened this issue · 4 comments

Every node has a cost value, when add a node otter will compare the node cost with the policy.MaxAvailableCost(), if it is larger than later, otter will reject to add this node.
I don't fullt understand how the cost infect the s3-FIFO policy. As i know, in s3-FIFO, the length of the queues of s3-FIFO is limited by the cost, a node with large cost will occupy more queue space, but the cost won't affect the evict sequence.
So what the cost does to the otter, will it improve some performance or hit rate in some cases?

You have described everything correctly. Such entries are rejected because inserting them will lead to a severe drop in the hit ratio. The queue will be completely cleared and most of the entries in it will be deleted, since they most likely have not been accessed.

You have described everything correctly. Such entries are rejected because inserting them will lead to a severe drop in the hit ratio. The queue will be completely cleared and most of the entries in it will be deleted, since they most likely have not been accessed.

How about remove the cost from node, that means every node will have a cost==1, what will happened if we remove the cost or set all nodes's cost == 1?

This is the most common scenario, but there are cases when the cost (bytes) of entries differs very much in the workload, which is why this parameter is introduced.

This is the most common scenario, but there are cases when the cost (bytes) of entries differs very much in the workload, which is why this parameter is introduced.

That make sense, it can limit the memory by this parameter😁