Release 2.6.2

This commit is contained in:
lancer.hong
2022-04-27 22:53:53 +08:00
parent e7f792a5d4
commit 0a10dfc71b
13 changed files with 51 additions and 34 deletions

View File

@@ -4,7 +4,7 @@ English | [简体中文](./README.md)
<a href="https://www.fizzgate.com"><img src="https://raw.githubusercontent.com/wiki/wehotel/fizz-gateway-community/img/icon-color.png" width="70%"></a> <a href="https://www.fizzgate.com"><img src="https://raw.githubusercontent.com/wiki/wehotel/fizz-gateway-community/img/icon-color.png" width="70%"></a>
</p> </p>
<p> <p>
<img alt="Version" src="https://img.shields.io/badge/version-2.6.1-blue.svg?cacheSeconds=2592000" /> <img alt="Version" src="https://img.shields.io/badge/version-2.6.2-blue.svg?cacheSeconds=2592000" />
<a href="http://www.fizzgate.com/fizz-gateway-community/" target="_blank"> <a href="http://www.fizzgate.com/fizz-gateway-community/" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" /> <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a> </a>
@@ -122,6 +122,7 @@ Starting from v1.3.0, the frontend and backend of the management backend are mer
| v2.5.2 | v2.5.2 | | v2.5.2 | v2.5.2 |
| v2.6.0 | v2.6.0 | | v2.6.0 | v2.6.0 |
| v2.6.1 | v2.6.1 | | v2.6.1 | v2.6.1 |
| v2.6.2 | v2.6.2 |
Please download the corresponding management backend version according to the version of the community version Please download the corresponding management backend version according to the version of the community version

View File

@@ -3,7 +3,7 @@
<a href="https://www.fizzgate.com"><img src="https://raw.githubusercontent.com/wiki/wehotel/fizz-gateway-community/img/icon-color.png" width="70%"></a> <a href="https://www.fizzgate.com"><img src="https://raw.githubusercontent.com/wiki/wehotel/fizz-gateway-community/img/icon-color.png" width="70%"></a>
</p> </p>
<p> <p>
<img alt="Version" src="https://img.shields.io/badge/version-2.6.1-blue.svg?cacheSeconds=2592000" /> <img alt="Version" src="https://img.shields.io/badge/version-2.6.2-blue.svg?cacheSeconds=2592000" />
<a href="http://www.fizzgate.com/fizz-gateway-community/" target="_blank"> <a href="http://www.fizzgate.com/fizz-gateway-community/" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" /> <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a> </a>
@@ -120,6 +120,7 @@ API地址http://demo.fizzgate.com/proxy/[服务名]/[API_Path]
| v2.5.2 | v2.5.2 | | v2.5.2 | v2.5.2 |
| v2.6.0 | v2.6.0 | | v2.6.0 | v2.6.0 |
| v2.6.1 | v2.6.1 | | v2.6.1 | v2.6.1 |
| v2.6.2 | v2.6.2 |
请根据社区版的版本下载对应的管理后台版本 请根据社区版的版本下载对应的管理后台版本

View File

@@ -2,7 +2,7 @@ version: "3.6"
services: services:
fizz-mysql: fizz-mysql:
image: "fizzgate/fizz-mysql:2.6.2-beta1" image: "fizzgate/fizz-mysql:2.6.2"
container_name: fizz-mysql container_name: fizz-mysql
restart: always restart: always
hostname: fizz-mysql hostname: fizz-mysql
@@ -27,7 +27,7 @@ services:
- fizz - fizz
fizz-gateway-community: fizz-gateway-community:
image: "fizzgate/fizz-gateway-community:2.6.2-beta1" image: "fizzgate/fizz-gateway-community:2.6.2"
container_name: fizz-gateway-community container_name: fizz-gateway-community
restart: always restart: always
hostname: fizz-gateway-community hostname: fizz-gateway-community
@@ -48,7 +48,7 @@ services:
- fizz - fizz
fizz-manager-professional: fizz-manager-professional:
image: "fizzgate/fizz-manager-professional:2.6.2-beta1" image: "fizzgate/fizz-manager-professional:2.6.2"
container_name: fizz-manager-professional container_name: fizz-manager-professional
restart: always restart: always
hostname: fizz-manager-professional hostname: fizz-manager-professional

View File

@@ -12,7 +12,7 @@
<groupId>com.fizzgate</groupId> <groupId>com.fizzgate</groupId>
<artifactId>fizz-bootstrap</artifactId> <artifactId>fizz-bootstrap</artifactId>
<version>2.6.2-beta1</version> <version>2.6.2</version>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fizz-gateway-community</artifactId> <artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId> <groupId>com.fizzgate</groupId>
<version>2.6.2-beta1</version> <version>2.6.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fizz-gateway-community</artifactId> <artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId> <groupId>com.fizzgate</groupId>
<version>2.6.2-beta1</version> <version>2.6.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -52,6 +52,10 @@ public class FlowStat {
*/ */
public static long INTERVAL = 1000; public static long INTERVAL = 1000;
public boolean cleanResource = true;
public boolean createTimeSlotOnlyTraffic = true;
/** /**
* A string Resource ID as key * A string Resource ID as key
*/ */
@@ -73,6 +77,12 @@ public class FlowStat {
runScheduleJob(); runScheduleJob();
} }
public FlowStat(boolean cleanResource, boolean createTimeSlotOnlyTraffic) {
this.cleanResource = cleanResource;
this.createTimeSlotOnlyTraffic = createTimeSlotOnlyTraffic;
runScheduleJob();
}
public FlowStat(CircuitBreakManager circuitBreakManager) { public FlowStat(CircuitBreakManager circuitBreakManager) {
this.circuitBreakManager = circuitBreakManager; this.circuitBreakManager = circuitBreakManager;
runScheduleJob(); runScheduleJob();
@@ -588,7 +598,7 @@ public class FlowStat {
lastSlotId = slotId; lastSlotId = slotId;
// log.debug("housekeeping done"); // log.debug("housekeeping done");
if (cleanResource) {
long currentTimeSlot = stat.currentTimeSlotId(); long currentTimeSlot = stat.currentTimeSlotId();
long startTimeSlot = currentTimeSlot - n; long startTimeSlot = currentTimeSlot - n;
for (Entry<String, ResourceStat> entry : stat.resourceStats.entrySet()) { for (Entry<String, ResourceStat> entry : stat.resourceStats.entrySet()) {
@@ -599,7 +609,7 @@ public class FlowStat {
ResourceStat resourceStat = entry.getValue(); ResourceStat resourceStat = entry.getValue();
boolean noTraffic = true; boolean noTraffic = true;
long timeSlot = startTimeSlot; long timeSlot = startTimeSlot;
for ( ; timeSlot < currentTimeSlot; timeSlot += FlowStat.INTERVAL) { for (; timeSlot < currentTimeSlot; timeSlot += FlowStat.INTERVAL) {
int reqCnt = resourceStat.getTimeSlot(timeSlot).getCounter(); int reqCnt = resourceStat.getTimeSlot(timeSlot).getCounter();
if (reqCnt > 0) { if (reqCnt > 0) {
noTraffic = false; noTraffic = false;
@@ -611,6 +621,7 @@ public class FlowStat {
log.info("HousekeepJob remove {}", resource); log.info("HousekeepJob remove {}", resource);
} }
} }
}
try { try {
@@ -644,7 +655,9 @@ public class FlowStat {
// curTimeSlotId); // curTimeSlotId);
ResourceStat resourceStat = entry.getValue(); ResourceStat resourceStat = entry.getValue();
if (resourceStat.getConcurrentRequests().get() > 0) { if (createTimeSlotOnlyTraffic && resourceStat.getConcurrentRequests().get() > 0) {
resourceStat.getTimeSlot(curTimeSlotId);
} else {
resourceStat.getTimeSlot(curTimeSlotId); resourceStat.getTimeSlot(curTimeSlotId);
} }

View File

@@ -319,13 +319,13 @@ public class CircuitBreaker {
public boolean transit(State current, State target, long currentTimeWindow, FlowStat flowStat) { public boolean transit(State current, State target, long currentTimeWindow, FlowStat flowStat) {
if (stateRef.compareAndSet(current, target)) { if (stateRef.compareAndSet(current, target)) {
stateStartTime = currentTimeWindow;
ResourceStat resourceStat = flowStat.getResourceStat(resource); ResourceStat resourceStat = flowStat.getResourceStat(resource);
/*AtomicLong circuitBreakNum = resourceStat.getTimeSlot(currentTimeWindow).getCircuitBreakNum(); /*AtomicLong circuitBreakNum = resourceStat.getTimeSlot(currentTimeWindow).getCircuitBreakNum();
circuitBreakNum.set(0);*/ circuitBreakNum.set(0);*/
resourceStat.getTimeSlot(currentTimeWindow).setCircuitBreakNum(0); resourceStat.getTimeSlot(currentTimeWindow).setCircuitBreakNum(0);
resourceStat.updateCircuitBreakState(currentTimeWindow, current, target); resourceStat.updateCircuitBreakState(currentTimeWindow, current, target);
LOGGER.debug("transit {} current time window {} from {} which start at {} to {}", resource, currentTimeWindow, current, stateStartTime, target); LOGGER.debug("transit {} current time window {} from {} which start at {} to {}", resource, currentTimeWindow, current, stateStartTime, target);
stateStartTime = currentTimeWindow;
return true; return true;
} }
return false; return false;

View File

@@ -39,7 +39,7 @@ import we.util.JacksonUtils;
*/ */
public class FlowStatTests { public class FlowStatTests {
private FlowStat stat = new FlowStat(); private FlowStat stat = new FlowStat(false, false);
class FlowRuleCase { class FlowRuleCase {
public int threads = 3; public int threads = 3;

View File

@@ -68,6 +68,8 @@ public class CircuitBreakManagerTests {
@Test @Test
void permitTest() { void permitTest() {
FlowStat flowStat = new FlowStat(circuitBreakManager); FlowStat flowStat = new FlowStat(circuitBreakManager);
flowStat.cleanResource = false;
flowStat.createTimeSlotOnlyTraffic = false;
long currentTimeWindow = flowStat.currentTimeSlotId(); long currentTimeWindow = flowStat.currentTimeSlotId();
MockServerHttpRequest mockServerHttpRequest = MockServerHttpRequest.get("/xxx").build(); MockServerHttpRequest mockServerHttpRequest = MockServerHttpRequest.get("/xxx").build();

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fizz-gateway-community</artifactId> <artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId> <groupId>com.fizzgate</groupId>
<version>2.6.2-beta1</version> <version>2.6.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fizz-gateway-community</artifactId> <artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId> <groupId>com.fizzgate</groupId>
<version>2.6.2-beta1</version> <version>2.6.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -37,7 +37,7 @@
<artifactId>fizz-gateway-community</artifactId> <artifactId>fizz-gateway-community</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<description>fizz gateway community</description> <description>fizz gateway community</description>
<version>2.6.2-beta1</version> <version>2.6.2</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>fizz-common</module> <module>fizz-common</module>