GithubHelp home page GithubHelp logo

Comments (14)

erikdubbelboer avatar erikdubbelboer commented on April 27, 2024 2

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.

ben-manes avatar ben-manes commented on April 27, 2024 1

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.

erikdubbelboer avatar erikdubbelboer commented on April 27, 2024 1

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.

souvikhaldar avatar souvikhaldar commented on April 27, 2024

What is the GC overhead here?

from ristretto.

souvikhaldar avatar souvikhaldar commented on April 27, 2024

Are you planning on using memory ballast for reducing GC cycles? @mangalaman93

from ristretto.

erikdubbelboer avatar erikdubbelboer commented on April 27, 2024

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.

erikdubbelboer avatar erikdubbelboer commented on April 27, 2024

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.

souvikhaldar avatar souvikhaldar commented on April 27, 2024

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.

souvikhaldar avatar souvikhaldar commented on April 27, 2024

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.

erikdubbelboer avatar erikdubbelboer commented on April 27, 2024

Both bigcache and https://github.com/coocood/freecache#how-it-is-done use different techniques to avoid having too many pointers.

from ristretto.

proyb6 avatar proyb6 commented on April 27, 2024

@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.

martinmr avatar martinmr commented on April 27, 2024

@mangalaman93 is this issue still relevant?

from ristretto.

mangalaman93 avatar mangalaman93 commented on April 27, 2024

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.

minhaj-shakeel avatar minhaj-shakeel commented on April 27, 2024

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.

drawing

from ristretto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.