Comments (14)
I don't think this issue was created to reduce the amount of GC cycles. This is not something a custom memory allocator would change.
What this issue is about is that you want to have less pointers for the GC to check, so it runs faster. Using a custom memory allocator you can put everything in a []byte
so GC only has to check 1 pointer to the []byte
instead of all pointer to all objects.
from ristretto.
You will likely want to use a SeqLock when reading from / writing into the byte[] value. See Java's StampedLock API and internal algorithm notes for details
from ristretto.
Yes fastcache is also very good. I didn't mention it because it has a bit more complex way to deal with lowering GC overhead.
from ristretto.
What is the GC overhead here?
from ristretto.
Are you planning on using memory ballast for reducing GC cycles? @mangalaman93
from ristretto.
Memory ballast doesn't make sense for ristretto and if it would make sense it's still something the application should do by itself, not the library.
from ristretto.
A custom memory allocator doesn't make sense either seeing as ristretto only stores interface{}
. You could build a library on top of ristretto that serializes all data you put in into []byte
that uses a custom allocator. But that's not the use case for ristretto. ristretto allows you to put in unseralizable data like channels as well.
from ristretto.
My intention here is to understand what is the overhead of GC that this issue tries to reduce by the memory allocator. @mangalaman93
When I see someone trying to reduce unnecessary GC cycles to keep heap memory size in check (which isn't much important) I can't help but suggest using memory ballast. Sure there needs to be fine-tuning further and it's better not to do it at the library level, but it's pretty much doable and helpful nonetheless. Also, I think it is going to be part of Go runtime soon (refer- golang/go#23044) . @erikdubbelboer Can you suggest some alternative?
from ristretto.
I see. I would love to learn more about it. Is this what you are talking about? https://segment.com/blog/allocation-efficiency-in-high-performance-go-services/
If not, can you suggest some reading?
from ristretto.
Both bigcache and https://github.com/coocood/freecache#how-it-is-done use different techniques to avoid having too many pointers.
from ristretto.
@erikdubbelboer I think you know VictoriaMetric have FastCache repo as well, is it a good example for reference reading?
ethereum/go-ethereum#19971
from ristretto.
@mangalaman93 is this issue still relevant?
from ristretto.
I think so, because the way Ristretto stores data is all pointers. The more the data, GC effects are gonna be more and more visible.
from ristretto.
Github issues have been deprecated.
This issue has been moved to discuss. You can follow the conversation there and also subscribe to updates by changing your notification preferences.
from ristretto.
Related Issues (20)
- [QUESTION]: Differentiate between TTL and cost based eviction
- [FEATURE]: Support for Type Parameters, aka, generics HOT 1
- [BUG]: ristretto used about 2 x MaxCost memory?? HOT 5
- benchmark about gc or plan to reduce gc HOT 1
- [BUG]: Expiration map grows without limit HOT 6
- [QUESTION]: Why did you choose ristretto as the project name ? HOT 2
- [FEATURE]: Loading or Compute If key is not present
- How many bits tinyLFU uses to count access frequency? HOT 1
- [QUESTION]: Ristretto hit ratio benchmark result HOT 2
- [BUG]: <sync.Pool GC>
- [QUESTION]: Too high missed rate?
- [FEATURE]: Jemalloc 5.3.0
- [FEATURE]: use system jemalloc
- [Non-hashed key values in Item]: onEvict should send the non hashed key values HOT 1
- [BUG]: compilation reports asm error when -buildmode=plugin
- [QUESTION]: Is there any way to implement an expired map counter with ristretto?
- [QUESTION]: How can I pre warm the cache ?
- [QUESTION]: When get v.0.1.2 tag and it's release note?
- [QUESTION]: Why is Ristretto so slow and has such a small hit ratio?
- Update projects using ristretto
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ristretto.