Release 2.6.2
This commit is contained in:
@@ -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>
|
||||
</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">
|
||||
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
|
||||
</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.6.0 | v2.6.0 |
|
||||
| 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
|
||||
|
||||
@@ -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>
|
||||
</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">
|
||||
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
|
||||
</a>
|
||||
@@ -120,6 +120,7 @@ API地址:http://demo.fizzgate.com/proxy/[服务名]/[API_Path]
|
||||
| v2.5.2 | v2.5.2 |
|
||||
| v2.6.0 | v2.6.0 |
|
||||
| v2.6.1 | v2.6.1 |
|
||||
| v2.6.2 | v2.6.2 |
|
||||
|
||||
|
||||
请根据社区版的版本下载对应的管理后台版本
|
||||
|
||||
@@ -2,7 +2,7 @@ version: "3.6"
|
||||
|
||||
services:
|
||||
fizz-mysql:
|
||||
image: "fizzgate/fizz-mysql:2.6.2-beta1"
|
||||
image: "fizzgate/fizz-mysql:2.6.2"
|
||||
container_name: fizz-mysql
|
||||
restart: always
|
||||
hostname: fizz-mysql
|
||||
@@ -27,7 +27,7 @@ services:
|
||||
- fizz
|
||||
|
||||
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
|
||||
restart: always
|
||||
hostname: fizz-gateway-community
|
||||
@@ -48,7 +48,7 @@ services:
|
||||
- fizz
|
||||
|
||||
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
|
||||
restart: always
|
||||
hostname: fizz-manager-professional
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<groupId>com.fizzgate</groupId>
|
||||
<artifactId>fizz-bootstrap</artifactId>
|
||||
<version>2.6.2-beta1</version>
|
||||
<version>2.6.2</version>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>fizz-gateway-community</artifactId>
|
||||
<groupId>com.fizzgate</groupId>
|
||||
<version>2.6.2-beta1</version>
|
||||
<version>2.6.2</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>fizz-gateway-community</artifactId>
|
||||
<groupId>com.fizzgate</groupId>
|
||||
<version>2.6.2-beta1</version>
|
||||
<version>2.6.2</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -52,6 +52,10 @@ public class FlowStat {
|
||||
*/
|
||||
public static long INTERVAL = 1000;
|
||||
|
||||
public boolean cleanResource = true;
|
||||
|
||||
public boolean createTimeSlotOnlyTraffic = true;
|
||||
|
||||
/**
|
||||
* A string Resource ID as key
|
||||
*/
|
||||
@@ -73,6 +77,12 @@ public class FlowStat {
|
||||
runScheduleJob();
|
||||
}
|
||||
|
||||
public FlowStat(boolean cleanResource, boolean createTimeSlotOnlyTraffic) {
|
||||
this.cleanResource = cleanResource;
|
||||
this.createTimeSlotOnlyTraffic = createTimeSlotOnlyTraffic;
|
||||
runScheduleJob();
|
||||
}
|
||||
|
||||
public FlowStat(CircuitBreakManager circuitBreakManager) {
|
||||
this.circuitBreakManager = circuitBreakManager;
|
||||
runScheduleJob();
|
||||
@@ -588,27 +598,28 @@ public class FlowStat {
|
||||
lastSlotId = slotId;
|
||||
// log.debug("housekeeping done");
|
||||
|
||||
|
||||
long currentTimeSlot = stat.currentTimeSlotId();
|
||||
long startTimeSlot = currentTimeSlot - n;
|
||||
for (Entry<String, ResourceStat> entry : stat.resourceStats.entrySet()) {
|
||||
String resource = entry.getKey();
|
||||
if (ResourceIdUtils.NODE_RESOURCE.equals(resource)) {
|
||||
continue;
|
||||
}
|
||||
ResourceStat resourceStat = entry.getValue();
|
||||
boolean noTraffic = true;
|
||||
long timeSlot = startTimeSlot;
|
||||
for ( ; timeSlot < currentTimeSlot; timeSlot += FlowStat.INTERVAL) {
|
||||
int reqCnt = resourceStat.getTimeSlot(timeSlot).getCounter();
|
||||
if (reqCnt > 0) {
|
||||
noTraffic = false;
|
||||
break;
|
||||
if (cleanResource) {
|
||||
long currentTimeSlot = stat.currentTimeSlotId();
|
||||
long startTimeSlot = currentTimeSlot - n;
|
||||
for (Entry<String, ResourceStat> entry : stat.resourceStats.entrySet()) {
|
||||
String resource = entry.getKey();
|
||||
if (ResourceIdUtils.NODE_RESOURCE.equals(resource)) {
|
||||
continue;
|
||||
}
|
||||
ResourceStat resourceStat = entry.getValue();
|
||||
boolean noTraffic = true;
|
||||
long timeSlot = startTimeSlot;
|
||||
for (; timeSlot < currentTimeSlot; timeSlot += FlowStat.INTERVAL) {
|
||||
int reqCnt = resourceStat.getTimeSlot(timeSlot).getCounter();
|
||||
if (reqCnt > 0) {
|
||||
noTraffic = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (noTraffic) {
|
||||
stat.resourceStats.remove(resource);
|
||||
log.info("HousekeepJob remove {}", resource);
|
||||
}
|
||||
}
|
||||
if (noTraffic) {
|
||||
stat.resourceStats.remove(resource);
|
||||
log.info("HousekeepJob remove {}", resource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -644,7 +655,9 @@ public class FlowStat {
|
||||
// curTimeSlotId);
|
||||
|
||||
ResourceStat resourceStat = entry.getValue();
|
||||
if (resourceStat.getConcurrentRequests().get() > 0) {
|
||||
if (createTimeSlotOnlyTraffic && resourceStat.getConcurrentRequests().get() > 0) {
|
||||
resourceStat.getTimeSlot(curTimeSlotId);
|
||||
} else {
|
||||
resourceStat.getTimeSlot(curTimeSlotId);
|
||||
}
|
||||
|
||||
|
||||
@@ -319,13 +319,13 @@ public class CircuitBreaker {
|
||||
|
||||
public boolean transit(State current, State target, long currentTimeWindow, FlowStat flowStat) {
|
||||
if (stateRef.compareAndSet(current, target)) {
|
||||
stateStartTime = currentTimeWindow;
|
||||
ResourceStat resourceStat = flowStat.getResourceStat(resource);
|
||||
/*AtomicLong circuitBreakNum = resourceStat.getTimeSlot(currentTimeWindow).getCircuitBreakNum();
|
||||
circuitBreakNum.set(0);*/
|
||||
resourceStat.getTimeSlot(currentTimeWindow).setCircuitBreakNum(0);
|
||||
resourceStat.updateCircuitBreakState(currentTimeWindow, current, target);
|
||||
LOGGER.debug("transit {} current time window {} from {} which start at {} to {}", resource, currentTimeWindow, current, stateStartTime, target);
|
||||
stateStartTime = currentTimeWindow;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -39,7 +39,7 @@ import we.util.JacksonUtils;
|
||||
*/
|
||||
public class FlowStatTests {
|
||||
|
||||
private FlowStat stat = new FlowStat();
|
||||
private FlowStat stat = new FlowStat(false, false);
|
||||
|
||||
class FlowRuleCase {
|
||||
public int threads = 3;
|
||||
|
||||
@@ -68,6 +68,8 @@ public class CircuitBreakManagerTests {
|
||||
@Test
|
||||
void permitTest() {
|
||||
FlowStat flowStat = new FlowStat(circuitBreakManager);
|
||||
flowStat.cleanResource = false;
|
||||
flowStat.createTimeSlotOnlyTraffic = false;
|
||||
long currentTimeWindow = flowStat.currentTimeSlotId();
|
||||
|
||||
MockServerHttpRequest mockServerHttpRequest = MockServerHttpRequest.get("/xxx").build();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>fizz-gateway-community</artifactId>
|
||||
<groupId>com.fizzgate</groupId>
|
||||
<version>2.6.2-beta1</version>
|
||||
<version>2.6.2</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>fizz-gateway-community</artifactId>
|
||||
<groupId>com.fizzgate</groupId>
|
||||
<version>2.6.2-beta1</version>
|
||||
<version>2.6.2</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
Reference in New Issue
Block a user