Code Monkey home page Code Monkey logo

Comments (6)

cgordon avatar cgordon commented on May 26, 2024

I can't comment on the thread-safety of HashClient, as it has been awhile since I looked at the code (and I have never used Python threads), but I concur that the intention for PooledClient is as @jaysoffian says: PooledClient should manage instances of HashClient, and not vice-versa. In this case my first inclination would be to create a HashPooledClient similar to how PooledClient works. If possible, it would be nice to share some code between those classes.

from pymemcache.

jaysoffian avatar jaysoffian commented on May 26, 2024

After some more reading, I'm dubious about the design of HashClient. The memcached docs recommend:

In the dark days of memcached, the default was to always "failover", by trying the next server in the list. That way if a server crashes, its keys will get reassigned to other instances and everything moves on happily. ... Modern life encourages the use of "Failure", when possible. That is, if the server you intend to fetch or store a cache entry to is unavailable, simply proceed as though it was a cache miss.

In my case, I've decided to not bother with HashClient. I'm just going to create multiple instances of PooledClient which are chosen using RendezvousHash and not bother with retry logic, adding/removing servers, etc. KISS and all that. I'll revisit this issue when I'm done with that. Minimally, I'll submit a PR updating the docs about thread-safety and this library.

In any case, thanks you for this library I chose it after reading over the code and the base Client is solid.

from pymemcache.

abhijit-15 avatar abhijit-15 commented on May 26, 2024

Can this be considered closed as of v3.2.0?

from pymemcache.

jparise avatar jparise commented on May 26, 2024

@abhijit-15 is there a specific change that was released that you're thinking of?

from pymemcache.

abhijit-15 avatar abhijit-15 commented on May 26, 2024

@jparise Yes. So as of v3.0.0, use_pooling has been made available and HashClient sends encoding to its pooled clients. IMO even if there are still any issues, the ability to handle custom client classes (for Hash & PooledClient as of v3.2.0) should be sufficient for user to deal with this?

from pymemcache.

jparise avatar jparise commented on May 26, 2024

That sounds good. Thanks for leaving the detailed comment so others who find this issue will have that additional context.

from pymemcache.

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.