基于微服务的预分配额度限流设计研究  

Pre-allocated Capacity Quota Limiting System Based on Microservice

在线阅读下载全文

作  者:郑旭 范红杰 柳军飞[3] ZHENG Xu;FAN Hongjie;LIU Junfei(School of Software and Microelectronics,Peking University,Beijing 100871,China;Department of Science and Technology Teaching,China University of Political Science and Law,Beijing 102249,China;National Engineering Research Center for Software Engineering,Peking University,Beijing 100871,China)

机构地区:[1]北京大学软件与微电子学院,北京100871 [2]中国政法大学科学技术教学部,北京102249 [3]北京大学软件工程国家工程研究中心,北京100871

出  处:《计算机科学》2024年第6期346-353,共8页Computer Science

基  金:长沙市科技重大专项项目(kh2202006)。

摘  要:在分布式架构下,同时存在于多个节点的限流器需要很好地协作才能达到单体限流的效果。在真实的业务场景中,线上请求分布不规律,线下业务吞吐量大。在此情况下,某一些关键节点因为超负荷运作而响应缓慢,从而导致请求链路整体的延迟增加,甚至造成整个应用的反应迟缓。针对现有微服务限流所存在的问题,文中提出了一种基于预分配额度进行主动推送配额更新的限流算法。该算法采用服务器主动向客户端广播的模式,服务器既可以接受客户端请求,也可以主动更新持有该资源配额的节点在处理请求后的最新结果。在服务器端分配所有节点配额时,可以采用灵活的分配算法进行分配。在估算限流节点配额时,采用滑动窗口的模式记录下一段时间内的请求数量和拥有的资源配额,通过自定义的算法来预估下一个周期的配额。同时,文中基于该算法实现了一个限流模型。实验结果证明,该模型可以及时地响应配额的变化,很好地实现节点之间的公平性。相比Doorman系统,所提模型可以更好地适应线上线下流量场景和精准限流。In a distributed architecture,rate limiters that exist simultaneously on multiple nodes need to collaborate effectively to achieve the same effect as a monolithic rate limiter.In real-world business scenarios,there is irregular distribution of online requests and high offline business throughput.In such cases,certain critical nodes operating under overload conditions can result in slow response times,leading to increased overall latency in the request chain and even causing sluggish application performance.To address the issues of existing microservice flow limiting,this paper proposes a rate limiting algorithm based on proactive quota updates using pre-allocated quotas.This algorithm adopts a server-initiated broadcast approach where the server can both accept client requests and proactively update the latest results for processing requests on the nodes holding the resource quotas.Flexible allocation algorithms can be utilized during quota allocation at the server end.Estimation of rate limiter quotas involves sliding window pattern to track the number of requests and the allocated resource quotas over a period of time.Additionally,we implement a rate limiting model based on this algorithm.Experimental results demonstrate that the model can promptly respond to quota changes and effectively achieve fairness among nodes.Compared to the Doorman system,the proposed model is better suited for online and offline traffic scenarios and enables more precise rate limiting.

关 键 词:限流 微服务 令牌桶 推送机制 分布式系统 

分 类 号:TP391.4[自动化与计算机技术—计算机应用技术]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象