Git Product home page Git Product logo

abtest-gateway's Introduction

ngx+lua gateway

背景

  • 产品需要迭代,上线新品,需要进行新旧对比,针对用户群体分流实验,检验效果如何
    • 新旧版本,制定一部分能使用新版本,制定方式可以是限制某个国家,或者某批用户,或者某国家某些用户;
  • 根据国家隐私法,需要对数据进行分流,落地所属用户注册的国家的数据中心

依赖交互

gateway[cache/lmdb] <> 配置中心(redis/zk) <> gateway-admin 后台(mysql)

用户自定义新策略插件开发:(DIY)

  1. policy_schema设计(根据所选的存储模型进行定义):

    • 策略:分流策略名,策略类型,策略详细数据 (策略模块对应的策略用户模块;用户请求信息命中对应后端某些功能模块-(backend_upstream) ) ; 分流策略组,优先级;
    • 运行时策略元数据:策略执行时间(设置永久或者过期时间);请求某个服务所运行的分流策略步骤;依次步骤所执行的策略插件,包括: 分流模块元信息、对应分流的用户模块元信息、以及对应的策略元信息;
  2. 对应policy_schema的分流模块设计:

    • 根据所选存储模型,对schema进行存放,读取,验证
  3. 根据请求信息命中对应分流的用户模块设计:

    • 对用户请求的信息进行解析,获取对应分流模块所需的keyword(分流关键字)-> backend_upstream(后端功能服务模块)

新加策略模块修改:

  • 在lib/abtesting/diversion目录中加入对应分流策略schema解析模块
  • 在lib/abtesting/userinfo目录中加入解析用户请求获取对应用于分流策略关键字keyword
  • 在lib/abtesting/utils/init.lua中的_M.divtypes 这个table变量中加入对应策略解析模块名和用户请求解析模块的映射关系

abtest-gateway's People

Contributors

weedge avatar

Watchers

James Cloos avatar  avatar

Forkers

aiical

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.