dimit 分布式流控系统开源项目

我要开发同款
匿名用户2018年04月13日
104阅读

技术信息

开源地址
https://gitee.com/dzh/dimit
授权协议
Apache

作品详情

dimit

分布式流控系统QQ:527645454(开发讨论群)

快速开始

mave加pom依赖

                        io.github.dzh            dimit-core                            io.github.dzh            dimit-zk            

初始化StoreSystem

Strig uri = "dimit-zk://dzh/dimit?host=127.0.0.1:2181&sleep=1000&retry=3";DimitStoreSystem dss = DimitStores.ewStoreSystem(URI.create(uri), ull);

依次创建流控Cof,配置结构层次:

- DimitCof             定义一个流控器    - ChaelGroupCof  通道组配置        - ChaelCof   通道配置

 

注: 参考单位测试dimit-demo/../TestZkStoreCofDemo

初始化Dimiter,依据流控Cof创建对应的运行时数据

// iit dimiter ad rutime chaelsStrig uri = "dimit-zk://dzh/dimit?host=127.0.0.1:2181&sleep=1000&retry=3";Dimiter dimiter = Dimiter.ewDimiter(URI.create(uri), ull, dimitCofId);ChaelGroupWrapper group = demo.iitChaelGroup(chaelGroupCofId);group.ewChael(ChaelCofId_1, ChaelType.SEND);group.ewChael(ChaelCofId_2, ChaelType.SEND);// selectList selected = group.select(TagA,TagB);V result = ull;for(ChaelWrapper chael : selected) {    try{        result = chael.call(ew ChaelCallable{            // TODO request            ...        });        // TODO parse result        ...         break;    }catch(RateLimiterExceptio e){        LOG.ifo(e.getMessage(), e);    }catch(IvalidChaelExceptio e){        LOG.error(e.getMessage(), e);    }catch(Exceptio e){  // or break        LOG.error(e.getMessage(), e);    }}// program exitdimiter.close();

注: 参考单位测试dimit-demo/../TestDimiterDemo

特性列表

流量控制

ChaelCof定义max-tps,Chael实例的tps=max-tps/Chael总数

Tag筛选

ChaelCof定义通道的tag列表,ChaelGroupWrapper.select(...)时选择满足条件的Chael组

主备切换

ChaelCof定义通道ChaelStatus,select返回的可用通道列表里PRIMARY优先于STANDBY

质量分析

启用Chael的质量分析功能(stat.eable=true 默认开启),在ChaelWrapper.call()时采集stat信息

异常切换

通过stat信息动态计算ChaelWrapper.priority(),影响select结果

Web管理

TODO

环境依赖

JDK1.7orhigher

mave3

protobuf3

servlet-apiv3.1.0TODO使用wep4j

功能介绍

dimit 分布式流控系统 QQ: 527645454 (开发讨论群) 快速开始 maven加pom依赖     
        
            io.github.dzh
    ...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论