|
|
|
|
|
by scalalang
909 days ago
|
|
Hi, I made this repo.
I'm here to drop my opinions as below. [1] - golang-fifo provides also SIEVE algorithm which is more effieicnt than S3-FIFO under web cache workloads(follows zipf's distribution) [2] - I added otter to my cache benchmark. It shows less efficiency than mine. I'm not sure why this happens. See results here: https://github.com/scalalang2/go-cache-benchmark [3] - If the behavior of the two algorithms is the same, they should produce similar results. but they shows different results. - Otter is faster with more concurrency, but misses more stuff (shows less hit/rate). |
|
1. You only test the hit ratio on a synthetic zipf distribution and claim an advantage without saying a word about the problems (which there are).
2. Checking implementation speed looks very questionable on such benchmarks, because you spend a huge amount of CPU time on synchronization and item generation.
3. Your implementation has at least three problems that otter doesn't: worst case O(n) time complexity of the eviction policy, disgusting scalability, also golang-fifo simply doesn't have as many features as otter, and adding each of them will only slow golang-fifo down even more.
4. Yes, when increasing contention otter sacrifices 1-2 percent (I'll have to see if I can reduce this loss) hit ratio to maintain response speed, but that's what caffeine, ristretto and other famous cache libraries do, because in this case it's more important to maintain scalability than to keep hundreds of goroutines waiting for a mutex to unlock.
5- This structure looks highly questionable to support ghost queue: https://github.com/scalalang2/golang-fifo/blob/main/s3fifo/b.... You are wasting a very large number of bytes just to maintain an item footprint.