snowjena-common

Distributed lock-free current limiting framework based on token bucket algorithm.

License

License

GroupId

GroupId

cn.yueshutong
ArtifactId

ArtifactId

snowjena-common
Last Version

Last Version

3.0.0.RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

snowjena-common
Distributed lock-free current limiting framework based on token bucket algorithm.
Project URL

Project URL

http://www.yueshutong.cn

Download snowjena-common

How to add to project

<!-- https://jarcasting.com/artifacts/cn.yueshutong/snowjena-common/ -->
<dependency>
    <groupId>cn.yueshutong</groupId>
    <artifactId>snowjena-common</artifactId>
    <version>3.0.0.RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/cn.yueshutong/snowjena-common/
implementation 'cn.yueshutong:snowjena-common:3.0.0.RELEASE'
// https://jarcasting.com/artifacts/cn.yueshutong/snowjena-common/
implementation ("cn.yueshutong:snowjena-common:3.0.0.RELEASE")
'cn.yueshutong:snowjena-common:jar:3.0.0.RELEASE'
<dependency org="cn.yueshutong" name="snowjena-common" rev="3.0.0.RELEASE">
  <artifact name="snowjena-common" type="jar" />
</dependency>
@Grapes(
@Grab(group='cn.yueshutong', module='snowjena-common', version='3.0.0.RELEASE')
)
libraryDependencies += "cn.yueshutong" % "snowjena-common" % "3.0.0.RELEASE"
[cn.yueshutong/snowjena-common "3.0.0.RELEASE"]

Dependencies

compile (3)

Group / Artifact Type Version
com.alibaba : fastjson jar 1.2.47
org.slf4j : slf4j-api jar 1.7.26
ch.qos.logback : logback-classic jar 1.2.3

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

💝 SnowJena

What

基于令牌桶算法实现的分布式无锁限流框架,支持熔断降级,支持动态配置规则,支持可视化监控,开箱即用。

Document

使用文档:中文|English

功能概要

限流 熔断 降级 监控 注解
黑名单 白名单 控制台 分布式 高可用

设计模式

单例模式 观察者模式 工厂模式 建造者模式 MVC模式
全局配置 动态规则 生产限流器 限流规则 控制台

Quick Start

Maven

<dependency>
  <groupId>com.github.onblog</groupId>
  <artifactId>snowjena-core</artifactId>
  <version>4.0.0.RELEASE</version>
</dependency>

本地限流

public class AppTest {
    Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * 本地限流
     */
    @Test
    public void test1() {
        // 1.配置规则
        RateLimiterRule rateLimiterRule = new RateLimiterRuleBuilder()
                .setLimit(1)
                .setPeriod(1)
                .setUnit(TimeUnit.SECONDS) //每秒令牌数为1
                .build();
        // 2.工厂模式生产限流器
        RateLimiter limiter = RateLimiterFactory.of(rateLimiterRule);
        // 3.使用
        while (true) {
            if (limiter.tryAcquire()) {
                logger.info("ok");
            }
        }
    }

}

About

Email:[email protected]

如果帮助到你了,请不吝赞赏!谢谢!

Versions

Version
3.0.0.RELEASE
2.0.0.RELEASE
1.0.0.RELEASE