Smarter caches #46
No reviewers
Labels
No labels
area: devops
area: discovery
area: docs
area: livestream
area: proposal
consider soon
dependencies
Epic
good first issue
hacktoberfest
help wanted
icebox
level: 1
level: 2
level: 3
level: 4
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
on hold
priority: blocker
priority: high
priority: low
priority: medium
resilience
Tom's Wishlist
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/reflector.go#46
Loading…
Reference in a new issue
No description provided.
Delete branch "smarter_caches"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There are two main additions here:
LRUStore
class adds LRU eviction mechanics to any store. This is most useful for finite stores (like disk and memory, which is where we're using it now)afero.Fs
is a nice library for abstracting the filesystem. im using it inDiskStore
. makes testing faster.Tagging Beamer and Andrey because they might find this interesting. It's probably not the last time we'll need to cache something (esp blobs) so let's not reinvent the wheel when it comes to caching.
Sorry about all the renaming in the PR. Makes it hard to read 🥺
Maybe look at them one commit at a time.
@ -0,0 +5,4 @@
"github.com/lbryio/lbry.go/v2/stream"
"github.com/lbryio/reflector.go/internal/metrics"
golru "github.com/hashicorp/golang-lru"
We're using a different cache lib in @nikooo777 's proposed cache in lbrytv-player. Is either of them better than the other? Should probably keep it simple and stick to one.
@ -0,0 +10,4 @@
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Given that test functions have to be named
Test*
, this looks like a typo.createTestLRUstore
?@ -0,0 +5,4 @@
"github.com/lbryio/lbry.go/v2/stream"
"github.com/lbryio/reflector.go/internal/metrics"
golru "github.com/hashicorp/golang-lru"
Yep. We're actually planning to merge reflector and player into a single program/process so they don't have to send blobs back and forth via TCP.
@ -0,0 +10,4 @@
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
agreed
MemStore should probably be removed or replaced with the ccache store.
the LRU store, as andrey mentioned, should not use that library, ccache should do just fine. Also there is probably no need to reload the cache in memory on restart, that was needed in the player back when that was the only kind of cache on the server.
I think the changes are overall good, the charts should be changed when we push this live.
I will test it locally as well to see how it performs.
i'm slightly confused here. what is what?
expressed in what?