Giter VIP home page Giter VIP logo

Comments (3)

BG2BKK avatar BG2BKK commented on July 17, 2024

现在的master分支是支持多级分流的版本,多级分流指的是,如果配置为 uid-city-ip三级分流,如果uid有对应的upstream,则直接转发到该upstream;如果没有,那么继续查询city对应的upstream;如果city有对应的upstream,则直接转发,否则继续查询ip对应的usptream。

另一种多级分流模式,比如某类uid下,某个city的分流策略,可以采用折中的办法,或者将uid-city-ip连接起来做一个key,或者在redis中想办法如何将策略存储。所以我认为如果想以比较清爽的方式实现,需要额外的数据结构支持,我正在思考怎样扩展ngx_lua的shdict,以nginx的shm为基础做一个嵌入在nginx的"数据库";也欢迎您有好的想法,我们可以交流。

现在的分流是指向upstream的,不是单个server,所以最后一个问题,我理解的对吗?

from abtestinggateway.

zzweb3 avatar zzweb3 commented on July 17, 2024

我觉得第一种方法很好,具体代码实现,我稍后看下。
其实我自己开发了一个,类似你提的第二种方法,但是比较挫,主要是我们这里业务复杂度不高。

from abtestinggateway.

zzweb3 avatar zzweb3 commented on July 17, 2024

第二种方法构建一个uid-city-ip 这样的key 比较难搞,我开始用json实现的,但是就无法用redis的mget接口了,可能还需要遍历。 我觉得第一种方法 真的不错, 我现在看下~

from abtestinggateway.

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.