Giter Site home page Giter Site logo

Comments (3)

nnhy avatar nnhy commented on July 28, 2024

cluster本身就不支持批量命令如mget等。
因为cluster是根据key进行哈希分片存储,某次请求一批keys,可能并不在同一个分片上面,因此不支持。

实际经验里面,我们不适用cluster,而是自己手工分片。例如48实例,就有一个Redis[48]的数组,100亿数据key计算哈希后,得到具体redis,再进行各种操作。如果需要批量获取,那就先对每一个key记性哈希计算,然后分组,同一组的key落在同一个redis上,可以使用mget,48个组可以并行处理,也就是并行执行48个mget,然后合并结果。

from newlife.redis.

leegkon avatar leegkon commented on July 28, 2024

多谢大石头,您说的很对,cluster默认是不支持mget的。
但类似Jredis之类的客户端 通过smart client的形式间接支持了mget的实现,对于调用方无需了解其内部细节,目前在.net方面暂时还没有好的支持,不知道newlife 有没有打算支持这一需求?

from newlife.redis.

nnhy avatar nnhy commented on July 28, 2024

可以考虑根据key提前分组到各个client,然后对它们使用mget,我们在实际项目中就是这么做的。不过没有用cluster,而是自己认为把数据key分摊到多组redis实例上。100亿数据平均分摊到48组。

from newlife.redis.

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.