Giter Club home page Giter Club logo

Comments (2)

manugupt1 avatar manugupt1 commented on June 19, 2024

I am not sure this will work. Consider You have 3 nodes behind an LB. If redis fails and then you have in-memory singleflight request, you may still get 3 single flight requests overwriting each other. I am not sure if there is a good way to guarantee uniqueness.

the easiest way is to probably write a new singleflight type backed by a managed by a cloud provider just like storage.

from athens.

r-ashish avatar r-ashish commented on June 19, 2024

Consider You have 3 nodes behind an LB. If redis fails and then you have in-memory singleflight request, you may still get 3 single flight requests overwriting each other.

Yes if the fallback is configured to use in-memory then that's the expected behaviour after this implementation. The idea is to let it work even after redis is down, currently it doesn't work at all.

you may still get 3 single flight requests overwriting each other. I am not sure if there is a good way to guarantee uniqueness.

Also, like I described above - another distributed store (redis/ etcd etc.) can also be used as fallback so it can still guarantee uniqueness, it would just depend on your config.

Basically there're 3 possible scenarios:

  • Fallback configured to "none": Don't use any fallback and return an error like the current behavior.
    • Mainly for backwards compatibility or if you'd like to keep things simple and are okay with handling these situations manually.
  • Fallback configured to "memory": Fallback to memory until the distributed store is up. Athens will continue working but distributed singleflight won't work.
    • Use this If you'd want Athens to continue working without distributed locking.
  • Fallback configured to "etcd/redis/etc.": Fallback to another distributed cache until the primary one is up. Athens will continue working and distributed singleflight will also work.
    • Use this If you'd want Athens to continue working with distributed locking and are okay with maintaining a secondary distributed store.

So based on the resiliency requirements of the users they will be able to configure Athens accordingly.

from athens.

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.