☀️ Nepxion DiscoveryPlatform is a platform for Nepxion Discovery with service governance, release orchestration, flow inspection, instance blacklist, gateway route 服务治理、蓝绿灰度编排、流量侦测、实例摘除、网关路由的平台
☀️ Nepxion Discovery is a solution for Spring Cloud with blue green, gray, route, limitation, circuit breaker, degrade, isolation, tracing, dye, failover 蓝绿、灰度、路由、限流、熔断、降级、隔离、追踪、流量染色、故障转移
在自己的项目中使用
pip install KcangFuse
import KcangFuse.funcFuse as funcFuse
如果你下载了这个demo里的源代码的话
import funcFuse
建立限流器类,并赋予自定义的限流返回函数
flowControl = funcFuse.funcFlowControl(fallBackFunc=myFallBackFunc)
timeWindows=2, 单位秒 限流时间窗口期
maxCount=5 允许请求数 即 在限流时间窗口期内 最多允许5个请求在处理,可以理解为最多五个线程
@app.route(Router + "/test5", methods=['GET'])
@SimpleFuncFuse3.fuse(timeout=2)
@flowControl.flowControl(timeWindows=2,maxCount=5)
def fuseTest5(): #尝试这个demo 即可
time.sleep(3)
return "ok"
可以尝试一下下面这个demo调用上面这个接口,看看效果
def t5(count):
re = requests.get("http://127.0.0.1:8080/fuse/test5")
print(re.text + " 当前线程:"+str(count)+"\n")
if __name__ == '__main__':
import requests,threading
for i in range(0,200):
threading.Thread(target=t5,args=(i,)).start()
time.sleep(5)
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].