snowjena-core

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

License

License

GroupId

GroupId

cn.yueshutong
ArtifactId

ArtifactId

snowjena-core
Last Version

Last Version

3.0.0.RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

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

Project URL

http://www.yueshutong.cn

Download snowjena-core

How to add to project

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

Dependencies

compile (4)

Group / Artifact Type Version
cn.yueshutong : snowjena-common jar 3.0.0.RELEASE
cn.yueshutong : snowjena-monitor jar 3.0.0.RELEASE
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