CN114745338B - Flow control method, device, storage medium and server - Google Patents
Flow control method, device, storage medium and server Download PDFInfo
- Publication number
- CN114745338B CN114745338B CN202210326272.5A CN202210326272A CN114745338B CN 114745338 B CN114745338 B CN 114745338B CN 202210326272 A CN202210326272 A CN 202210326272A CN 114745338 B CN114745338 B CN 114745338B
- Authority
- CN
- China
- Prior art keywords
- flow control
- storage space
- data
- quota
- user
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/30—Flow control; Congestion control in combination with information about buffer occupancy at either end or at transit nodes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请公开了一种流量控制方法、装置、存储介质以及服务器,响应数据访问请求,获取数据访问端对应的各存储空间流控配额以及用户流控配额;控制各服务节点分别记录产生的各存储空间流量数据以及用户流量数据;控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制。由于在本申请中,同时对数据访问端的用户级别和各存储空间级别配置了流控配额,且在对数据访问端进行流量控制时,同时考虑各存储空间所产生的流量以及用户账户下产生的所有流量,并将其与各自对应的流控配额进行对比,最终可以对数据访问端进行多个层级的统一流控,实现更精确、稳定的流量控制。
The present application discloses a flow control method, device, storage medium and server, which respond to data access requests, obtain the flow control quotas of each storage space and the user flow control quota corresponding to the data access terminal; control each service node to record the generated flow data of each storage space and the user flow data respectively; control each service node to perform flow control on the data access terminal according to the flow data of each storage space, the user flow data, the flow control quotas of each storage space and the user flow control quota. In the present application, flow control quotas are configured for both the user level and each storage space level of the data access terminal, and when flow control is performed on the data access terminal, the flow generated by each storage space and all the flow generated under the user account are considered at the same time, and compared with the corresponding flow control quotas, the data access terminal can finally be subjected to unified flow control at multiple levels to achieve more accurate and stable flow control.
Description
技术领域Technical Field
本申请涉及计算机技术领域,尤其涉及一种流量控制方法、装置、存储介质以及服务器。The present application relates to the field of computer technology, and in particular to a flow control method, device, storage medium and server.
背景技术Background Art
随着现代化信息技术的发展,各类使用互联网用户的数据访问需求也不断增长,本地服务器的存储能力和读写能力较差,且不易扩容和优化,那么为了满足用户的数据访问需求,并且加强数据读写模块的整体稳定性,分布式系统服务逐渐应用于人们的日常生活中,而分布式系统同时联机多个服务节点响应多个用户的访问需求,当部分用户的数据流量过大,可能导致影响到其他用户的正常数据操作,甚至影响分布式系统的正常使用。With the development of modern information technology, the data access needs of various Internet users are also growing. The storage capacity and read-write capabilities of local servers are poor, and it is not easy to expand and optimize. In order to meet the data access needs of users and enhance the overall stability of data reading and writing modules, distributed system services are gradually applied to people's daily lives. Distributed systems simultaneously connect multiple service nodes to respond to the access needs of multiple users. When the data traffic of some users is too large, it may affect the normal data operations of other users and even affect the normal use of the distributed system.
发明内容Summary of the invention
本申请提供一种流量控制方法、装置、存储介质以及服务器,可以解决相关技术中流量控制不精确、系统不稳定的技术问题。The present application provides a flow control method, device, storage medium and server, which can solve the technical problems of inaccurate flow control and unstable system in related technologies.
第一方面,本申请实施例提供一种流量控制方法,应用于数据被访问端,所述数据被访问端中设置有数据访问端对应的至少两个存储空间,该方法包括:In a first aspect, an embodiment of the present application provides a flow control method, which is applied to a data accessed end, wherein the data accessed end is provided with at least two storage spaces corresponding to a data access end, and the method includes:
响应数据访问请求,为所述数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间的存储空间流控配额以及用户流控配额;In response to a data access request, at least one service node is allocated for the data access request, and a storage space flow control quota and a user flow control quota of each storage space corresponding to the data access end are obtained;
控制各服务节点分别记录所述数据访问端基于所述数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;Control each service node to respectively record each storage space flow data and user flow data generated when the data access end performs data access based on the data access request;
控制各服务节点根据各存储空间流量数据、所述用户流量数据、各存储空间流控配额以及所述用户流控配额,对所述数据访问端进行流量控制。Control each service node to perform flow control on the data access end according to each storage space flow data, the user flow data, each storage space flow control quota and the user flow control quota.
第二方面,本申请实施例提供一种流量控制装置,应用于数据被访问端,所述数据被访问端中设置有数据访问端对应的至少两个存储空间,该装置包括:In a second aspect, an embodiment of the present application provides a flow control device, which is applied to a data accessed end, wherein the data accessed end is provided with at least two storage spaces corresponding to the data access end, and the device includes:
请求响应模块,用于响应数据访问请求,为所述数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间的存储空间流控配额以及用户流控配额;A request response module, used to respond to a data access request, allocate at least one service node for the data access request, and obtain a storage space flow control quota and a user flow control quota for each storage space corresponding to the data access end;
流量记录模块,用于控制各服务节点分别记录所述数据访问端基于所述数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;A traffic recording module, used to control each service node to respectively record the traffic data of each storage space and the user traffic data generated when the data access end performs data access based on the data access request;
流量控制模块,用于控制各服务节点根据各存储空间流量数据、所述用户流量数据、各存储空间流控配额以及所述用户流控配额,对所述数据访问端进行流量控制。The flow control module is used to control each service node to perform flow control on the data access end according to each storage space flow data, the user flow data, each storage space flow control quota and the user flow control quota.
第三方面,本申请实施例提供一种计算机存储介质,所述计算机存储介质存储有多条指令,所述指令适于由处理器加载并执行上述的方法的步骤。In a third aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the steps of the above-mentioned method.
第四方面,本申请实施例提供一种服务器,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述计算机程序适于由处理器加载并执行上述的方法的步骤。In a fourth aspect, an embodiment of the present application provides a server, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is suitable for being loaded by the processor and executing the steps of the above method.
本申请一些实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought about by the technical solutions provided by some embodiments of the present application include at least:
本申请提供一种流量控制方法,响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间的存储空间流控配额以及用户流控配额;控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制。由于在本申请中,同时对数据访问端的用户级别和各存储空间级别都配置了相应的流控配额,且在对数据访问端进行流量控制时,同时考虑各存储空间所产生的流量以及用户账户下产生的所有流量,并将其与各自对应的流控配额进行对比,这样同时控制用户级别的流量和各存储空间的流量,最终可以对数据访问端进行多个层级的统一流控,实现更精确、稳定的流量控制。The present application provides a flow control method, which responds to a data access request, allocates at least one service node for the data access request, and obtains the storage space flow control quota and user flow control quota of each storage space corresponding to the data access terminal; controls each service node to respectively record the storage space flow data and user flow data generated when the data access terminal performs data access based on the data access request; controls each service node to perform flow control on the data access terminal according to the storage space flow data, user flow data, each storage space flow control quota and user flow control quota. Because in the present application, the corresponding flow control quota is configured for both the user level and each storage space level of the data access terminal, and when the data access terminal is flow controlled, the flow generated by each storage space and all the flow generated under the user account are considered at the same time, and compared with their corresponding flow control quotas, so that the user-level flow and the flow of each storage space are controlled at the same time, and finally the data access terminal can be subjected to unified flow control at multiple levels to achieve more accurate and stable flow control.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
图1为本申请实施例提供的一种流量控制方法的示例性系统架构图;FIG1 is an exemplary system architecture diagram of a flow control method provided in an embodiment of the present application;
图2为本申请实施例提供的一种流量控制方法的流程示意图;FIG2 is a flow chart of a flow control method provided in an embodiment of the present application;
图3为本申请实施例提供的一种流量控制方法的流程结构图;FIG3 is a flow chart of a flow control method provided in an embodiment of the present application;
图4为本申请实施例提供的一种流量控制方法的流程示意图;FIG4 is a flow chart of a flow control method provided in an embodiment of the present application;
图5为本申请实施例提供的一种流量控制方法的流程示意图;FIG5 is a flow chart of a flow control method provided in an embodiment of the present application;
图6为本申请实施例提供的一种分布式缓存组件的控制流程图;FIG6 is a control flow chart of a distributed cache component provided in an embodiment of the present application;
图7为本申请实施例提供的一种上传接口的流量控制结构图;FIG7 is a flow control structure diagram of an upload interface provided in an embodiment of the present application;
图8为本申请实施例提供的一种带宽数据的流量控制示意图;FIG8 is a schematic diagram of flow control of bandwidth data provided in an embodiment of the present application;
图9为本申请实施例提供的一种流量控制装置的结构框图;FIG9 is a structural block diagram of a flow control device provided in an embodiment of the present application;
图10为本申请实施例提供的一种服务器的结构示意图。FIG. 10 is a schematic diagram of the structure of a server provided in an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
为使得本申请的特征和优点能够更加的明显和易懂,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而非全部实施例。基于本申请中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the features and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
随着互联网信息技术的蓬勃发展,企业和个人用户的数据访问需求都在不断增长。其中,对数据的存取需求最大,而云存储服务(Cloud storage)是伴随着海量存储需求而兴起的一种数据存取服务,即把数据存放在通常由第三方托管的多台虚拟服务器,而非专属的服务器上,来满足数据存储的需求具有简单可靠、海量安全等特点。从云存储服务的角度考虑,虽然云存储服务向用户提供了海量数据的存储能力,但是系统的读写能力总是可量化的有限的、且不易扩容和优化。因此,为了保证云存储服务的整体稳定性,避免部分用户的异常流量影响到其他用户,甚至引发连锁反应影响到整个系统,需要根据系统的处理能力对用户的异常流量进行流量控制。流量控制在网络传输中是一个常见的基本概念,其主要用于调整发送方传输数据的速度。同样地,在云存储服务的系统中,通过流量控制方法对访问流量进行限制、整形,可以保证系统提供最大化的服务能力,一般系统将会通过拒绝服务超过预期的访问来对异常流量进行处理。With the vigorous development of Internet information technology, the data access needs of enterprises and individual users are growing. Among them, the demand for data access is the largest, and cloud storage service is a data access service that has emerged with the demand for massive storage. That is, data is stored on multiple virtual servers usually hosted by a third party, rather than dedicated servers, to meet the needs of data storage. It has the characteristics of simplicity, reliability, massive security, etc. From the perspective of cloud storage services, although cloud storage services provide users with the storage capacity of massive data, the read and write capabilities of the system are always quantifiable and limited, and it is not easy to expand and optimize. Therefore, in order to ensure the overall stability of cloud storage services, avoid the abnormal traffic of some users affecting other users, and even trigger a chain reaction that affects the entire system, it is necessary to control the abnormal traffic of users according to the processing capacity of the system. Traffic control is a common basic concept in network transmission, which is mainly used to adjust the speed at which the sender transmits data. Similarly, in the cloud storage service system, the access traffic is restricted and shaped by the traffic control method to ensure that the system provides the maximum service capability. Generally, the system will handle abnormal traffic by refusing to serve access that exceeds expectations.
在常见的限流方法中,大致可以分为单机限流和分布式限流。单机限流是指各服务节点在限流策略上是相互独立的,互不影响,各服务节点可能拥有不同的限流策略;而分布式限流采用可扩展的系统结构,利用多台存储服务器分担计算负荷,解决了传统单机限流中系统整体流量不稳定的瓶颈问题,提高了限流系统的可靠性、可用性和扩展性,其中引入了中心化缓存中间件,可以感知系统中各服务节点的流量变化,对系统整体形成统一的限流服务,但对于时间敏感的限流策略需要考虑服务节点与缓存中间件的时间一致性问题,同时也需要考虑访问缓存中间件超时的情况。Among the common current limiting methods, they can be roughly divided into single-machine current limiting and distributed current limiting. Single-machine current limiting means that each service node is independent of each other in terms of current limiting strategy and does not affect each other. Each service node may have a different current limiting strategy; while distributed current limiting adopts an extensible system structure and uses multiple storage servers to share the computing load, which solves the bottleneck problem of unstable overall system traffic in traditional single-machine current limiting and improves the reliability, availability and scalability of the current limiting system. It introduces a centralized cache middleware that can sense the traffic changes of each service node in the system and form a unified current limiting service for the entire system. However, for time-sensitive current limiting strategies, it is necessary to consider the time consistency problem between the service node and the cache middleware, and it is also necessary to consider the timeout of access to the cache middleware.
由于在云存储的系统中,一个用户的账户下一般都拥有多个存储空间,而从目前主要的分布式限流方法来看,各分布式系统中的限流服务通常会对用户的各存储空间分别配置流控配额,或直接对用户分配所有存储空间共用的总配额,但用户具体使用存储空间以及流控配额的情况是无法在系统中预知的,因此单一的基于存储空间级别或单一的基于用户级别来配置流控配额,会使得限流策略无法适用于流量使用情况多样化的大量用户,以及对于系统整体的流量无法进行精确控制,进而导致用户使用受阻,系统不稳定。In cloud storage systems, a user's account generally has multiple storage spaces. From the perspective of the current main distributed flow limiting methods, the flow limiting services in each distributed system usually configure flow control quotas for each user's storage space, or directly allocate a total quota shared by all storage spaces to the user. However, the user's specific use of storage space and flow control quotas cannot be predicted in the system. Therefore, configuring flow control quotas based solely on storage space level or user level will make the flow limiting strategy unsuitable for a large number of users with diverse traffic usage, and the overall system traffic cannot be accurately controlled, which in turn leads to user usage obstruction and system instability.
因此本申请实施例提供一种流量控制方法,通过同时对数据访问端的用户流控配额和各存储空间流控配额进行配置,根据存储空间的流量数据是否满足存储空间流控配额,且用户总共使用的流量数据是否满足用户流控配额,来确定对数据访问端进行的流量控制策略,可以解决上述流量控制不精确、系统整体不稳定的技术问题。Therefore, an embodiment of the present application provides a flow control method, which configures the user flow control quota of the data access end and the flow control quota of each storage space at the same time, and determines the flow control strategy for the data access end according to whether the flow data of the storage space meets the storage space flow control quota and whether the total flow data used by the user meets the user flow control quota. This can solve the above-mentioned technical problems of inaccurate flow control and overall system instability.
请参阅图1,图1为本申请实施例提供的一种流量控制方法的示例性系统架构图。Please refer to FIG. 1 , which is an exemplary system architecture diagram of a flow control method provided in an embodiment of the present application.
如图1所示,系统架构可以包括数据访问端101、网络102和服务器103。网络102用于在数据访问端101和服务器103之间提供通信链路的介质。网络102可以包括各种类型的有线通信链路或无线通信链路,例如:有线通信链路包括光纤、双绞线或同轴电缆的,无线通信链路包括蓝牙通信链路、无线保真(Wireless-Fidelity,Wi-Fi)通信链路或微波通信链路等。As shown in FIG1 , the system architecture may include a data access terminal 101, a network 102, and a server 103. The network 102 is used to provide a medium for a communication link between the data access terminal 101 and the server 103. The network 102 may include various types of wired communication links or wireless communication links, for example, the wired communication link includes an optical fiber, a twisted pair, or a coaxial cable, and the wireless communication link includes a Bluetooth communication link, a Wireless-Fidelity (Wi-Fi) communication link, or a microwave communication link.
数据访问端101可以通过网络102与服务器103交互,以接收来自服务器103的消息或向服务器103发送消息,或者数据访问端101可以通过网络102与服务器103交互,进而接收其他用户向服务器103发送的消息或者数据。数据访问端101可以是硬件,也可以是软件。当数据访问端101为硬件时,可以是各种电子设备,包括但不限于智能手表、智能手机、平板电脑、膝上型便携式计算机和台式计算机等。当数据访问端101为软件时,可以是安装在上述所列举的电子设备中,其可以实现呈多个软件或软件模块(例如:用来提供分布式服务),也可以实现成单个软件或软件模块,在此不作具体限定。The data access terminal 101 can interact with the server 103 through the network 102 to receive messages from the server 103 or send messages to the server 103, or the data access terminal 101 can interact with the server 103 through the network 102, and then receive messages or data sent by other users to the server 103. The data access terminal 101 can be hardware or software. When the data access terminal 101 is hardware, it can be various electronic devices, including but not limited to smart watches, smart phones, tablet computers, laptop portable computers and desktop computers. When the data access terminal 101 is software, it can be installed in the above-mentioned electronic devices, which can be implemented as multiple software or software modules (for example: used to provide distributed services), or it can be implemented as a single software or software module, which is not specifically limited here.
服务器103可以是提供各种服务的业务服务器。需要说明的是,服务器103可以是硬件,也可以是软件。当服务器103为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当服务器103为软件时,可以实现成多个软件或软件模块(例如用来提供分布式服务),也可以实现成单个软件或软件模块,在此不做具体限定。The server 103 may be a business server that provides various services. It should be noted that the server 103 may be hardware or software. When the server 103 is hardware, it may be implemented as a distributed server cluster consisting of multiple servers, or it may be implemented as a single server. When the server 103 is software, it may be implemented as multiple software or software modules (for example, for providing distributed services), or it may be implemented as a single software or software module, which is not specifically limited here.
应理解,图1中的数据访问端、网络以及服务器的数目仅是示意性的,根据实现需要,可以是任意数量的数据访问端、网络以及服务器。It should be understood that the number of data access terminals, networks, and servers in FIG. 1 is merely illustrative, and any number of data access terminals, networks, and servers may be used according to implementation requirements.
请参阅图2,图2为本申请实施例提供的一种流量控制方法的流程示意图。本申请实施例的执行主体可以是执行流量控制方法的服务器,可以是执行流量控制方法的服务器中的处理器,还可以是执行流量控制方法的服务器中的流量控制服务。为方便描述,下面以执行主体是服务器中的处理器为例,介绍流量控制方法的具体执行过程。Please refer to Figure 2, which is a flow chart of a flow control method provided by an embodiment of the present application. The execution subject of the embodiment of the present application can be a server that executes the flow control method, a processor in the server that executes the flow control method, or a flow control service in the server that executes the flow control method. For the convenience of description, the specific execution process of the flow control method is introduced below by taking the execution subject as a processor in the server as an example.
如图2所示,流量控制方法应用于数据被访问端,数据被访问端中设置有数据访问端对应的至少两个存储空间,流量控制方法至少可以包括:As shown in FIG. 2 , the flow control method is applied to the data accessed end, and the data accessed end is provided with at least two storage spaces corresponding to the data access end. The flow control method may at least include:
S201、响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间的存储空间流控配额以及用户流控配额。S201. Respond to a data access request, allocate at least one service node for the data access request, and obtain a storage space flow control quota and a user flow control quota of each storage space corresponding to a data access terminal.
可选地,用户在通过互联网中的网站、存储服务、资源数据库等包含大量数据信息的网络服务实现需求时,那么用户端作为数据访问端会向目标服务的服务器发出大量的数据访问请求,这些数据访问请求到达数据被访问端时会产生对应的流量,为了保证数据被访问端的稳定运行,需要对产生的流量进行控制,使得其不至于影响数据被访问端的负载能力和计算能力。Optionally, when a user meets his needs through network services containing a large amount of data information such as websites, storage services, resource databases, etc. on the Internet, the user end, as the data access end, will send a large number of data access requests to the server of the target service. When these data access requests reach the data accessed end, corresponding traffic will be generated. In order to ensure the stable operation of the data accessed end, the generated traffic needs to be controlled so that it does not affect the load capacity and computing power of the data accessed end.
可选地,在对用户进行流量使用控制时,可以预先为用户配置其可用的流控配额,而为了满足用户的使用需求,通常在一个数据访问端的用户级别下存在至少两个存储空间,而各存储空间都可以有对应的流量使用配额,那么在配置流控配额时,若直接对数据访问端的各存储空间配置流控配额,那么各存储空间只能使用各自的流控配额无法在其余存储空间的流量较小时使用更多占比的配额,若各存储空间的配额都较小时则无法满足用户的使用需求,各存储空间的配额都较大时则导致用户的总体流控配额较高对系统造成影响,而无法提前预知用户对各存储空间的使用情况,也就不便于对各存储空间配置最合适的配额。Optionally, when controlling the user's traffic usage, the available flow control quota can be configured for the user in advance. In order to meet the user's usage needs, there are usually at least two storage spaces under the user level of a data access terminal, and each storage space can have a corresponding traffic usage quota. Then, when configuring the flow control quota, if the flow control quota is directly configured for each storage space of the data access terminal, then each storage space can only use its own flow control quota and cannot use a larger proportion of the quota when the traffic of the remaining storage spaces is small. If the quota of each storage space is small, the user's usage needs cannot be met. When the quota of each storage space is large, the user's overall flow control quota is high, which affects the system. It is impossible to predict the user's usage of each storage space in advance, and it is not convenient to configure the most appropriate quota for each storage space.
可选地,基于此,考虑到用户的所有存储空间能使用的流控配额也是有限的,那么可以在为各存储空间的流控配额进行配置的同时,对用户级别的流控配额也进行配置,使得其从各存储空间以及用户这两个层级来对数据发送端的流量进行控制,进而实现同一用户下各存储空间流控配额的共享。在进行流量控制之前,首先需要对流控配额进行配置,可以在服务与注册组件中对所有用户的用户流控配额以及其各存储空间流控配额进行配置。Optionally, based on this, considering that the flow control quota that can be used by all storage spaces of a user is also limited, the flow control quota at the user level can be configured while configuring the flow control quota for each storage space, so that the flow of the data sender can be controlled from the two levels of each storage space and the user, thereby realizing the sharing of the flow control quota of each storage space under the same user. Before performing flow control, the flow control quota needs to be configured first. The user flow control quota of all users and the flow control quota of each storage space can be configured in the service and registration components.
进一步地,配置用户流控配额和各存储空间流控配额时,由于有用户流控配额来对数据访问端的总体流量进行限制,那么各存储空间流控配额可以适当较大,具体地,可以配置用户流控配额大于任意一个存储空间流控配额,且用户流控配额小于所有存储空间流控配额之和。例如,当数据访问端对应有存储空间A、存储空间B时,可以将用户流控配额配置为10,存储空间A流控配额配置为5,存储空间B流控配额配置为6,那么当数据访问请求占用了存储空间A中的5个流控配额,那么此时就仅能够使用存储空间B中5个流控配额,在基于存储空间流控配额对产生的流量进行比较之后,再基于用户流控配额对整体产生的流量进行比较,从而实现存储空间和用户两种级别的流量控制。需要注意的是,在示例中用于举例的数值仅表示对应配额的大小关系,不表示实际意义和实际单位。Furthermore, when configuring the user flow control quota and each storage space flow control quota, since there is a user flow control quota to limit the overall flow of the data access end, the flow control quota of each storage space can be appropriately larger. Specifically, the user flow control quota can be configured to be larger than any storage space flow control quota, and the user flow control quota can be configured to be smaller than the sum of all storage space flow control quotas. For example, when the data access end corresponds to storage space A and storage space B, the user flow control quota can be configured to be 10, the storage space A flow control quota can be configured to be 5, and the storage space B flow control quota can be configured to be 6. Then, when the data access request occupies 5 flow control quotas in storage space A, only 5 flow control quotas in storage space B can be used at this time. After comparing the generated flow based on the storage space flow control quota, the overall generated flow is compared based on the user flow control quota, thereby realizing flow control at two levels of storage space and user. It should be noted that the numerical values used for example in the example only represent the size relationship of the corresponding quotas, and do not represent the actual meaning and actual unit.
可选地,当系统用于给用户提供服务时,用户可通过注册账号来获得自己使用该服务的流控配额,并且为了便于配置,各用户账号下被配置的初始流控配额均相同,而用户可通过升级等操作来修改账号下的流控配额,以获取满足自己使用需求的流控配额,其中通过用户操作获取的流控配额使用优先级高于默认配置的初始流控配额。Optionally, when the system is used to provide services to users, users can obtain their own flow control quota for using the service by registering an account, and for ease of configuration, the initial flow control quota configured under each user account is the same, and users can modify the flow control quota under their account through operations such as upgrading to obtain a flow control quota that meets their usage needs, where the flow control quota obtained through user operations has a higher usage priority than the initial flow control quota configured by default.
可选地,在服务与注册组件中配置好所有用户的存储空间流控配额和用户流控配额之后,为了方便数据被访问端能够在接收数据访问请求时,直接基于流控配额对数据访问端进行流量控制,可以设置数据访问端每隔预设周期从服务与注册组件中获取并保存所有用户对应的存储空间流控配额和用户流控配额。在一种可行的实施例中,可以选择S3服务(Simple Storage Service,简单存储服务,S3)组件作为数据被访问端,S3服务组件可以为用户提供接入服务,兼容S3协议接口,用户可以使用S3协议的SDK方便的进行数据存储操作。Optionally, after configuring the storage space flow control quota and user flow control quota of all users in the service and registration component, in order to facilitate the data access terminal to directly control the flow of the data access terminal based on the flow control quota when receiving the data access request, the data access terminal can be set to obtain and save the storage space flow control quota and user flow control quota corresponding to all users from the service and registration component every preset period. In a feasible embodiment, the S3 service (Simple Storage Service, Simple Storage Service, S3) component can be selected as the data access terminal. The S3 service component can provide access services for users and is compatible with the S3 protocol interface. Users can use the SDK of the S3 protocol to conveniently perform data storage operations.
为了方便描述,请参阅图3,图3为本申请实施例提供的一种流量控制方法的流程结构图。如图3所示,流程结构图中包括数据访问端310,服务与注册组件320,S3服务组件330,存储空间流量控制模块340,用户流量控制模块350。For the convenience of description, please refer to Figure 3, which is a flow chart of a flow control method provided by an embodiment of the present application. As shown in Figure 3, the flow chart includes a data access terminal 310, a service and registration component 320, an S3 service component 330, a storage space flow control module 340, and a user flow control module 350.
其中,S3服务组件330周期性地从服务与注册组件320中获取所有用户对应的存储空间流控配额和用户流控配额并保存至S3服务组件330的本地内存中,那么当数据访问端310发送数据访问请求至数据被访问端,也即S3服务组件330时,S3服务组件330首先响应数据访问请求,再通过存储空间流量控制模块340进行数据访问端310对应的各存储空间流量控制,以及通过用户流量控制模块350进行数据访问端310对应的用户流量控制。Among them, the S3 service component 330 periodically obtains the storage space flow control quota and user flow control quota corresponding to all users from the service and registration component 320 and saves them in the local memory of the S3 service component 330. Then, when the data access end 310 sends a data access request to the data accessed end, that is, the S3 service component 330, the S3 service component 330 first responds to the data access request, and then performs the storage space flow control corresponding to the data access end 310 through the storage space flow control module 340, and performs the user flow control corresponding to the data access end 310 through the user flow control module 350.
可选地,为了同时服务来自用户的多个请求,数据被访问端中设置有多个服务节点,进而可以为数据访问请求分配至少一个服务节点,服务节点越多,数据被访问端能够同时响应的数据访问请求就越多,并且服务节点的个数可以进行扩展,便于根据用户体量和请求量进行调整。因此可以先查找到可用的服务节点,将同一数据访问端的所有数据访问请求分配至各服务节点。同时,根据数据访问请求所对应的数据访问端标识,数据被访问端可以从本地直接获取数据访问端对应的各存储空间流控配额以及用户流控配额,以便于后续基于流控配额和产生的流量对数据访问端进行流量控制。Optionally, in order to serve multiple requests from users at the same time, multiple service nodes are set in the data access terminal, and at least one service node can be allocated to the data access request. The more service nodes, the more data access requests the data access terminal can respond to at the same time, and the number of service nodes can be expanded to facilitate adjustment according to the user volume and request volume. Therefore, the available service nodes can be found first, and all data access requests of the same data access terminal can be allocated to each service node. At the same time, according to the data access terminal identifier corresponding to the data access request, the data access terminal can directly obtain the storage space flow control quota and user flow control quota corresponding to the data access terminal from the local, so as to facilitate the subsequent flow control of the data access terminal based on the flow control quota and the generated flow.
需要注意的是,对于所有服务节点,会定时向各服务节点发送极小的数据包作为心跳信号,用以请求各服务节点在能够正常工作时返回心跳,若服务节点返回心跳的时长超过预设阈值或无法返回心跳,则认为该服务节点无法继续响应数据访问请求,并在服务节点目录中将该服务节点即为不可用服务节点,避免为其继续分发数据访问请求,导致数据访问请求无法正常执行。It should be noted that for all service nodes, extremely small data packets will be sent to each service node as heartbeat signals at regular intervals to request each service node to return a heartbeat when it is able to work normally. If the time it takes for a service node to return a heartbeat exceeds a preset threshold or fails to return a heartbeat, it is considered that the service node is unable to continue responding to data access requests, and the service node is marked as an unavailable service node in the service node directory to avoid continuing to distribute data access requests to it, resulting in the data access request being unable to execute normally.
S202、控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据。S202: Control each service node to respectively record each storage space flow data and user flow data generated when the data access end performs data access based on the data access request.
可选的,控制各服务节点分别接收到数据访问请求时,能够基于各数据访问请求对应的多种属性来计算数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据并将各流量数据进行分别记录,其中,所有存储空间流量数据之和等于用户流量数据。各服务节点可以记录流量数据和流量数据相关属性,例如可以记录到流量数据对应的存储空间、接口、种类等,这就便于各服务节点基于流量数据的多种属性来判断多方面的流量情况,并针对不同的情况来实行不同的流量控制策略。Optionally, when each service node receives a data access request, it can calculate the storage space traffic data and user traffic data generated when the data access end performs data access based on the data access request based on the multiple attributes corresponding to the data access request, and record each traffic data separately, wherein the sum of all storage space traffic data is equal to the user traffic data. Each service node can record traffic data and traffic data-related attributes, such as the storage space, interface, type, etc. corresponding to the traffic data, which makes it easier for each service node to judge various traffic situations based on the multiple attributes of the traffic data, and implement different traffic control strategies for different situations.
可选地,为了进行流量控制,各服务节点分别记录到各存储空间流量数据和用户流量数据之后,还需要根据流量数据来更新对应的流控配额,将流控配额更新为使用了相应数据流量的流控余额,并将流控余额用于本轮次流量控制流程中后续访问请求的处理。Optionally, in order to perform flow control, after each service node records the flow data of each storage space and the user flow data respectively, it is also necessary to update the corresponding flow control quota based on the flow data, update the flow control quota to the flow control balance using the corresponding data flow, and use the flow control balance for the processing of subsequent access requests in this round of flow control process.
进一步地,为了便于后续进行流量控制,各服务节点可以依据本节点所产生的流量数据来直接进行流量控制条件判断,还可以基于所有服务节点记录的流量数据进行流量控制条件判断时,此时就可以使用一个中间件来实现记录所有服务节点的流量数据,各服务节点获取所有服务节点统一的流量数据,便于后续基于整体流量数据来分析数据访问端的流量情况。Furthermore, in order to facilitate subsequent traffic control, each service node can directly judge the traffic control conditions based on the traffic data generated by the node, and can also judge the traffic control conditions based on the traffic data recorded by all service nodes. At this time, a middleware can be used to record the traffic data of all service nodes. Each service node obtains unified traffic data of all service nodes, which is convenient for subsequent analysis of the traffic situation of the data access end based on the overall traffic data.
S203、控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制。S203: Control each service node to perform flow control on the data access end according to each storage space flow data, user flow data, each storage space flow control quota and user flow control quota.
可选地,控制各服务节点分别记录产生的各存储空间流量数据以及用户流量数据之后,就可以基于预先获取到的各存储空间流控配额以及用户流控配额,来判断当前流量使用情况时是否确定对数据访问端进行流量控制。Optionally, after controlling each service node to record the generated storage space traffic data and user traffic data respectively, it can determine whether to perform traffic control on the data access end based on the pre-acquired storage space flow control quota and user flow control quota when judging the current traffic usage.
具体地,各存储空间有对应的流控配额和本次数据访问请求产生的流量数据,用户有对应的流控配额和本次数据访问请求产生的流量数据,那么在进行流量控制判断时,可以对各存储空间和用户分别制定流控条件,其中当存储空间流控配额不足够支持其对应的存储空间流量数据时,认为满足第一流控条件,则控制各服务节点对数据访问端进行第一流量控制;当各存储空间流量数据与其对应的存储空间流控配额不满足第一流控条件,且用户流控配额不足够支持用户流量数据时,认为用户流量数据与用户流控配额满足第二流控条件,则控制各服务节点对数据访问端进行第二流量控制。这样将各存储空间级别的流量控制制定为第一流量控制,将用户级别的流量控制制定为不触发各存储空间级别的第一流量控制时的第二流量控制,实现了各存储空间下对所有用户流控配额的共享与统一控制,这样的流量控制结果将更加精确和稳定,不仅加强了系统稳定性,也提高了用户的服务使用体验。Specifically, each storage space has a corresponding flow control quota and the flow data generated by this data access request, and the user has a corresponding flow control quota and the flow data generated by this data access request. Then, when making a flow control judgment, flow control conditions can be formulated for each storage space and user respectively. When the storage space flow control quota is not sufficient to support the corresponding storage space flow data, it is considered that the first flow control condition is met, and each service node is controlled to perform the first flow control on the data access terminal; when the flow data of each storage space and its corresponding storage space flow control quota do not meet the first flow control condition, and the user flow control quota is not sufficient to support the user flow data, it is considered that the user flow data and the user flow control quota meet the second flow control condition, and each service node is controlled to perform the second flow control on the data access terminal. In this way, the flow control of each storage space level is formulated as the first flow control, and the flow control of the user level is formulated as the second flow control when the first flow control of each storage space level is not triggered, so as to realize the sharing and unified control of all user flow control quotas under each storage space, and such flow control results will be more accurate and stable, which not only enhances the system stability, but also improves the user's service experience.
在本申请实施例中,提供一种流量控制方法,响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间流控配额以及用户流控配额;控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制。由于在本申请实施例中,同时对数据访问端的用户级别和各存储空间级别都配置了相应的流控配额,且在对数据访问端进行流量控制时,同时考虑各存储空间所产生的流量以及用户账户下产生的所有流量,并将其与各自对应的流控配额进行对比,这样同时控制用户级别的流量和各存储空间的流量,最终可以对数据访问端进行多个层级的统一流控,实现更精确、稳定的流量控制。In an embodiment of the present application, a flow control method is provided, which responds to a data access request, allocates at least one service node for the data access request, and obtains the flow control quotas of each storage space and the user flow control quota corresponding to the data access terminal; controls each service node to respectively record the flow data of each storage space and the user flow data generated when the data access terminal performs data access based on the data access request; controls each service node to perform flow control on the data access terminal according to the flow data of each storage space, the user flow data, the flow control quotas of each storage space and the user flow control quota. Because in an embodiment of the present application, corresponding flow control quotas are configured for both the user level and each storage space level of the data access terminal, and when the flow control is performed on the data access terminal, the flow generated by each storage space and all the flow generated under the user account are considered at the same time, and compared with their corresponding flow control quotas, so that the flow of the user level and the flow of each storage space are controlled at the same time, and finally the data access terminal can be subjected to unified flow control at multiple levels, so as to achieve more accurate and stable flow control.
请参阅图4,图4为本申请实施例提供的一种流量控制方法的流程示意图。Please refer to FIG. 4 , which is a flow chart of a flow control method provided in an embodiment of the present application.
如图4所示,流量控制方法至少可以包括:As shown in FIG4 , the flow control method may at least include:
S401、响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间流控配额以及用户流控配额。S401, responding to a data access request, allocating at least one service node for the data access request, and obtaining each storage space flow control quota and user flow control quota corresponding to the data access end.
关于步骤S401,请参阅步骤S201中的详细记载,此处不再赘述。Regarding step S401, please refer to the detailed description in step S201, which will not be repeated here.
S402、将数据访问端对应的各存储空间并发配额以及用户并发配额均摊至各服务节点,得到各服务节点对应的各存储空间节点并发配额以及各用户节点并发配额。S402: Allocate the storage space concurrency quota and user concurrency quota corresponding to the data access end to each service node, and obtain the storage space node concurrency quota and user node concurrency quota corresponding to each service node.
可选地,通过上述实施例的介绍可以知道,为了同时响应尽可能多的数据访问请求,为数据访问请求分配了多个服务节点,而为了均衡各服务节点的处理压力,可以将来自同一数据访问端的数据访问请求均摊分配给服务节点,保证各服务节点接收到的数据访问请求数量相同,进而确保各服务节点的处理压力稳定。Optionally, from the introduction of the above embodiments, it can be known that in order to respond to as many data access requests as possible at the same time, multiple service nodes are allocated to the data access requests, and in order to balance the processing pressure of each service node, data access requests from the same data access end can be evenly distributed to the service nodes, ensuring that each service node receives the same number of data access requests, thereby ensuring that the processing pressure of each service node is stable.
可选地,数据访问请求所产生的流量种类是多种的,其中包括并发流量,同一数据访问端在同一时间发出的多个数据访问请求为并发请求,将数据访问请求均摊给各服务节点时,在各服务节点上会同时进行相同数量的多个并发数据访问请求,为了保证各服务节点能够正常处理接收到的并发数据访问请求,并且不影响各服务节点继续对其他数据访问请求进行响应,在对用户的存储空间流控配额、用户流控配额进行配置时,可以在存储空间流控配额中具体配置存储空间并发配额、在用户流控配额中具体配置用户并发配额,使得各服务节点可以根据各存储空间并发配额和用户并发配额来判断接收到的数据访问请求的并发流量是否满足正常工作条件。Optionally, there are multiple types of traffic generated by data access requests, including concurrent traffic. Multiple data access requests issued by the same data access terminal at the same time are concurrent requests. When the data access requests are evenly distributed to each service node, the same number of multiple concurrent data access requests will be made simultaneously on each service node. In order to ensure that each service node can normally process the received concurrent data access requests and does not affect the service nodes from continuing to respond to other data access requests, when configuring the user's storage space flow control quota and user flow control quota, the storage space concurrency quota can be specifically configured in the storage space flow control quota, and the user concurrency quota can be specifically configured in the user flow control quota, so that each service node can judge whether the concurrent traffic of the received data access requests meets normal working conditions based on the storage space concurrency quota and the user concurrency quota.
进一步地,由于并发的数据访问请求是均摊到各服务节点中的,那么可以将数据访问端对应的各存储空间并发配额以及用户并发配额也均摊至各服务节点,得到各服务节点对应的各存储空间节点并发配额以及各用户节点并发配额,这样各服务节点可以根据本节点产生的并发流量和本节点对应的流控配额直接对数据访问请求的流量情况进行判断。Furthermore, since concurrent data access requests are evenly distributed among each service node, the concurrent quotas of each storage space and user concurrent quotas corresponding to the data access end can also be evenly distributed among each service node to obtain the concurrent quotas of each storage space node and the concurrent quotas of each user node corresponding to each service node. In this way, each service node can directly judge the traffic situation of the data access request based on the concurrent traffic generated by this node and the flow control quota corresponding to this node.
S403、控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间并发数据以及用户并发数据。S403, controlling each service node to respectively record the concurrent data of each storage space and the concurrent data of the user generated when the data access end performs data access based on the data access request.
可选地,各服务节点获取到对应的各存储空间节点并发配额以及各用户节点并发配额之后,就可以控制各服务节点在接收到分配至本节点的并发数据访问请求时,对产生的各存储空间并发数据以及用户并发数据进行分别记录。Optionally, after each service node obtains the corresponding concurrent quota of each storage space node and the concurrent quota of each user node, it can control each service node to separately record the generated concurrent data of each storage space and the concurrent data of the user when receiving the concurrent data access request allocated to this node.
可选地,由于大多数据访问请求会包含多个线程,例如,一般修改一个代码的值会有3步线程:读取、修改、回写,而在这些线程的处理过程中,可能会出现其他请求的线程突然占用资源,导致原请求无法得到正确的结果,此时,可以基于原子变量来计算各数据访问请求的并发数据,原子变量可以将对一个变量值的读取、修改、回写变成一个不可打断的操作,基于此,就可以通过原子操作来使得对于某一请求就只有一个线程操作它,原子操作中线程不会被切换,线程切换要么在原子操作之前,要么在原子操作完成之后,这样各服务节点中的并发数据都为整值,不会出现中间处理状态,从而避免各服务节点资源不互通的情况下的资源竞争,最终实现稳定的并发资源获取和释放。Optionally, since most data access requests will contain multiple threads, for example, generally modifying the value of a code will involve three threads: reading, modifying, and writing back. During the processing of these threads, threads of other requests may suddenly occupy resources, resulting in the original request being unable to obtain the correct result. At this time, the concurrent data of each data access request can be calculated based on atomic variables. Atomic variables can turn the reading, modifying, and writing back of a variable value into an uninterruptible operation. Based on this, atomic operations can be used to ensure that only one thread operates a certain request, and the thread will not be switched during the atomic operation. The thread switching is either before the atomic operation or after the atomic operation is completed. In this way, the concurrent data in each service node is an integer value, and there will be no intermediate processing state, thereby avoiding resource competition when the resources of each service node are not interoperable, and ultimately achieving stable concurrent resource acquisition and release.
S404、当任一存储空间并发数据大于其对应的存储空间节点并发配额时,则控制各服务节点拒绝并返回数据访问请求至数据访问端;当各存储空间并发数据小于或者等于其对应的存储空间节点并发配额时,且任一用户并发数据大于其对应的用户节点并发配额,则控制各服务节点拒绝并返回数据访问请求至数据访问端。S404. When the concurrent data of any storage space is greater than the concurrent quota of its corresponding storage space node, each service node is controlled to reject and return the data access request to the data access end; when the concurrent data of each storage space is less than or equal to the concurrent quota of its corresponding storage space node, and the concurrent data of any user is greater than the concurrent quota of its corresponding user node, each service node is controlled to reject and return the data access request to the data access end.
可选地,各服务节点获取对应的各存储空间节点并发配额以及各用户节点并发配额,并且记录了产生的各存储空间并发数据以及用户并发数据之后,就可以控制各服务节点基于本节点对应的各存储空间并发数据、各存储空间节点并发配额、用户并发数据、用户节点并发配额,来对存储空间级别下的流量情况进行判断,以及对用户级别下的流量情况进行判断。Optionally, after each service node obtains the corresponding concurrency quota of each storage space node and the concurrency quota of each user node, and records the generated storage space concurrency data and user concurrency data, each service node can be controlled to judge the traffic situation at the storage space level and the traffic situation at the user level based on the storage space concurrency data, storage space node concurrency quota, user concurrency data, and user node concurrency quota corresponding to the node.
可选地,各服务节点记录到的并发数据大于对应的并发配额时,则认为当前用户的数据访问请求的并发数量超过用户的配额,而各服务节点都将对数据访问端实行流量控制,具体地,当任一存储空间并发数据大于其对应的存储空间节点并发配额时,则控制各服务节点拒绝并返回数据访问请求至数据访问端;当各存储空间并发数据小于或者等于其对应的存储空间节点并发配额时,且任一用户并发数据大于其对应的用户节点并发配额,则控制各服务节点拒绝并返回数据访问请求至数据访问端。这样可以从各服务节点对数据访问端的并发流量进行精确控制,保证了系统高并发的稳定性。Optionally, when the concurrent data recorded by each service node is greater than the corresponding concurrent quota, it is considered that the concurrent number of the current user's data access request exceeds the user's quota, and each service node will implement flow control on the data access terminal. Specifically, when the concurrent data of any storage space is greater than the concurrent quota of its corresponding storage space node, each service node is controlled to reject and return the data access request to the data access terminal; when the concurrent data of each storage space is less than or equal to the concurrent quota of its corresponding storage space node, and the concurrent data of any user is greater than the concurrent quota of its corresponding user node, each service node is controlled to reject and return the data access request to the data access terminal. In this way, the concurrent flow of the data access terminal can be accurately controlled from each service node, ensuring the stability of the high concurrency of the system.
可以理解的,当数据访问端的数据访问请求所产生的并发流量信息触发并发流量控制时,各服务节点拒绝并返回数据访问请求至数据访问端时,可以不再对数据访问请求进行响应以及后续处理,而是生成对应的拒绝信息,并将拒绝信息、访问请求以及访问请求携带的数据发送至数据访问端,其中,拒绝信息可以用于提示数据访问端注意流量控制情况,便于数据访问端对数据访问请求进行调整和后续请求操作。It can be understood that when the concurrent traffic information generated by the data access request of the data access end triggers concurrent traffic control, when each service node rejects and returns the data access request to the data access end, it may no longer respond to the data access request and perform subsequent processing, but instead generate corresponding rejection information, and send the rejection information, the access request, and the data carried by the access request to the data access end. The rejection information can be used to prompt the data access end to pay attention to the traffic control situation, so as to facilitate the data access end to adjust the data access request and subsequent request operations.
在本申请实施例中,提供一种流量控制方法,首先将数据访问请求均摊给各服务节点,并将各存储空间并发配额以及用户并发配额均摊至各服务节点,各服务节点根据本节点接收到的数据访问请求对应的并发数据和分配给本节点的并发配额,基于原子变量的计算方式,来对本节点的并发资源进行获取和释放,实现了基于存储空间级别和用户级别的两种层级的精确并发流量控制,保证了系统高并发的整体可用性,加强了系统运行的稳定性。In an embodiment of the present application, a flow control method is provided, in which data access requests are first evenly distributed to each service node, and each storage space concurrency quota and user concurrency quota are evenly distributed to each service node. Each service node acquires and releases the concurrent resources of the node based on the concurrent data corresponding to the data access request received by the node and the concurrency quota allocated to the node, based on the calculation method of atomic variables, thereby realizing precise concurrent flow control based on two levels of storage space level and user level, ensuring the overall high concurrency availability of the system, and enhancing the stability of system operation.
请参阅图5,图5为本申请实施例提供的一种流量控制方法的流程示意图。Please refer to FIG. 5 , which is a flow chart of a flow control method provided in an embodiment of the present application.
如图5所示,流量控制方法至少可以包括:As shown in FIG5 , the flow control method may at least include:
S501、响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间流控配额以及用户流控配额。S501, responding to a data access request, allocating at least one service node for the data access request, and obtaining each storage space flow control quota and user flow control quota corresponding to the data access end.
关于步骤S501,请参阅步骤S201中的详细记载,此处不再赘述。Regarding step S501, please refer to the detailed description in step S201, which will not be repeated here.
S502、在预设时间窗口内,控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间带宽数据以及用户带宽数据。S502: within a preset time window, control each service node to respectively record each storage space bandwidth data and user bandwidth data generated when the data access terminal performs data access based on the data access request.
可选地,数据访问请求所产生的流量种类是多种的,其中还包括带宽流量,在单位时间内从网络中的某一点到另一点所能通过的“最高数据率”,也即在单位时间内能传输的数据量,那么数据访问端的数据访问请求的带宽流量大小会直接影响请求的处理时间,那么过大的带宽会导致在较长时间内占较多处理资源,过小的带宽又无法满足数据访问端的使用需求,因此在配置数据访问端的各存储空间流控配额时可以具体配置对应的各存储空间带宽配额,配置用户流控配额时具体配置用户带宽配额,以此来考量数据访问请求产生的带宽流量,并对异常带宽流量进行控制。Optionally, there are many types of traffic generated by data access requests, including bandwidth traffic, which is the "maximum data rate" that can be transmitted from one point in the network to another point in unit time, that is, the amount of data that can be transmitted in unit time. Then the bandwidth traffic size of the data access request of the data access end will directly affect the processing time of the request. Then, too large a bandwidth will cause more processing resources to be occupied for a longer period of time, and too small a bandwidth cannot meet the usage requirements of the data access end. Therefore, when configuring the flow control quota of each storage space of the data access end, the corresponding bandwidth quota of each storage space can be specifically configured, and when configuring the user flow control quota, the user bandwidth quota can be specifically configured, so as to consider the bandwidth traffic generated by the data access request and control abnormal bandwidth traffic.
可选地,带宽流量与请求数量并没有直接关系,在每个请求到达的时间点都计算带宽流量会导致计算非常频繁,因此带宽流量的计算一般是在预设时间窗口内进行统计,这样就允许该时间窗口内的带宽配额可以由数据访问请求分配共享。进而可以在预设时间窗口内,控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间带宽数据以及用户带宽数据。预设时间窗口的设置可以根据数据访问端以及数据访问请求的体量来具体设置,例如,可以以10秒为一个时间窗口,本申请对此不作限定。Optionally, bandwidth flow is not directly related to the number of requests. Calculating bandwidth flow at each time point when a request arrives will result in very frequent calculations. Therefore, the calculation of bandwidth flow is generally performed within a preset time window, which allows the bandwidth quota within the time window to be allocated and shared by data access requests. Furthermore, within the preset time window, each service node can be controlled to separately record the storage space bandwidth data and user bandwidth data generated when the data access terminal accesses data based on the data access request. The setting of the preset time window can be specifically set according to the data access terminal and the volume of the data access request. For example, 10 seconds can be used as a time window, and this application does not limit this.
进一步地,由于不同数据访问请求所产生的带宽流量数据会不相同,那么由各服务节点来直接对本节点的带宽流量进行分析就会导致数据访问端的带宽资源利用不完全或利用混乱,因此在控制各服务节点进行带宽数据记录时,可以采用一种分布式缓存组件,分布式缓存组件可以支持所有服务节点将自身产生的流量数据记录进分布式缓存组件中,并且对该类流量数据进行统一计算,实现对所有服务节点中接收到的所有数据访问请求所产生流量数据的整体分析。需要注意的是,分布式缓存组件中并不存在所有用户的各存储空间带宽配额以及用户带宽配额,那么各服务节点在初次记录某数据访问端产生的带宽流量时,会将该数据访问端对应的各存储空间带宽配额以及用户带宽配额存储进分布式缓存组件中,便于分布式缓存组件对已使用的流量配额进行记录、对比。Furthermore, since the bandwidth traffic data generated by different data access requests will be different, if each service node directly analyzes the bandwidth traffic of the node, it will lead to incomplete or chaotic utilization of the bandwidth resources of the data access terminal. Therefore, when controlling each service node to record bandwidth data, a distributed cache component can be used. The distributed cache component can support all service nodes to record the traffic data generated by themselves into the distributed cache component, and perform unified calculations on such traffic data to achieve an overall analysis of the traffic data generated by all data access requests received in all service nodes. It should be noted that the distributed cache component does not have the storage space bandwidth quotas and user bandwidth quotas of all users. Therefore, when each service node first records the bandwidth traffic generated by a data access terminal, it will store the storage space bandwidth quotas and user bandwidth quotas corresponding to the data access terminal in the distributed cache component, so that the distributed cache component can record and compare the used traffic quotas.
为了方便描述,请参阅图6,图6为本申请实施例提供的一种分布式缓存组件的控制流程图。如图6所示,各服务节点610记录各存储空间带宽数据以及用户带宽数据至分布式缓存组件620中,进而各服务节点610可以在分布式缓存组件620中获知其余服务节点所接收数据访问请求产生的带宽数据,便于后续各服务节点610依据所有数据访问请求的总体带宽使用情况对数据访问端进行流量控制。For the convenience of description, please refer to Figure 6, which is a control flow chart of a distributed cache component provided in an embodiment of the present application. As shown in Figure 6, each service node 610 records each storage space bandwidth data and user bandwidth data to the distributed cache component 620, and then each service node 610 can obtain the bandwidth data generated by the data access request received by the other service nodes in the distributed cache component 620, so that each service node 610 can subsequently control the flow of the data access end according to the overall bandwidth usage of all data access requests.
可选地,分布式缓存组件可以有多种具体选择,一种可行的实施方式中,可以选择Redis(Remote Dictionary Server,远程数据服务)作为分布式缓存组件进行应用,Redis支持主从同步,数据可以从主服务器向任意数量的从服务器上同步,可以提高网站吞吐量,提高网站运行效率用来减轻对数据库访问压力。Optionally, there may be a variety of specific options for the distributed cache component. In one feasible implementation, Redis (Remote Dictionary Server) may be selected as a distributed cache component for application. Redis supports master-slave synchronization, and data may be synchronized from the master server to any number of slave servers, which may improve website throughput and website operating efficiency to reduce pressure on database access.
另外地,数据访问请求所产生的流量中对系统计算压力影响较大的,还包括每秒请求量(Query Per Second,QPS),对一个特定的查询服务器在规定时间内所处理流量多少的衡量标准,因此数据访问请求所产生的QPS流量也需要要预设时间周期内对所有数据访问请求进行统计,才能够实现一个较好的衡量作用,基于此,可以参照带宽配额以及带宽数据记录的实施方法,在配置数据访问端的各存储空间流控配额时可以具体配置对应的各存储空间每秒请求配额,配置用户流控配额时具体配置用户每秒请求配额,并控制各服务节点将各存储空间每秒请求配额以及用户每秒请求配额存储至分布式缓存组件中,且将产生的各存储空间每秒请求数据以及用户每秒请求数据时记录在分布式缓存组件中。In addition, the traffic generated by data access requests that has a greater impact on the system computing pressure also includes the number of requests per second (Query Per Second, QPS), which is a measure of the amount of traffic processed by a specific query server within a specified time. Therefore, the QPS traffic generated by data access requests also needs to be counted for all data access requests within a preset time period in order to achieve a better measurement effect. Based on this, you can refer to the implementation method of bandwidth quotas and bandwidth data recording. When configuring the flow control quota of each storage space at the data access end, you can specifically configure the corresponding request quota per second for each storage space, and when configuring the user flow control quota, specifically configure the user request quota per second, and control each service node to store the request quota per second for each storage space and the request quota per second for the user in the distributed cache component, and record the generated request data per second for each storage space and the request data per second for the user in the distributed cache component.
S503、控制各服务节点基于各存储空间带宽数据对各存储空间带宽配额进行扣减,得到各存储空间带宽剩余额,以及基于各用户带宽数据对用户带宽配额进行扣减,得到用户带宽剩余额。S503: Control each service node to deduct each storage space bandwidth quota based on each storage space bandwidth data to obtain each storage space bandwidth surplus, and deduct the user bandwidth quota based on each user bandwidth data to obtain the user bandwidth surplus.
可选地,各服务节点分别记录各存储空间带宽数据以及用户带宽数据至分布式缓存组件之后,可以控制各服务节点基于分布式缓存组件中存储的各存储空间带宽数据对各存储空间带宽配额进行扣减,得到各存储空间带宽剩余额,并将各存储空间带宽剩余额作为本时间窗口内下一次服务节点扣减的基准;以及控制各服务节点基于各用户带宽数据对用户带宽配额进行扣减,得到用户带宽剩余额,并将用户带宽剩余额作为本时间窗口内下一次服务节点扣减的基准。Optionally, after each service node records the storage space bandwidth data and the user bandwidth data to the distributed cache component respectively, each service node can be controlled to deduct each storage space bandwidth quota based on the storage space bandwidth data stored in the distributed cache component to obtain the remaining amount of each storage space bandwidth, and use the remaining amount of each storage space bandwidth as the basis for the next service node deduction within the current time window; and each service node can be controlled to deduct the user bandwidth quota based on the user bandwidth data to obtain the remaining amount of user bandwidth, and use the remaining amount of user bandwidth as the basis for the next service node deduction within the current time window.
可选地,从上述实施例可以知道,各服务节点对于数据访问请求的每秒请求数据的记录与带宽数据记录流程一样,那么同样的,可以控制各服务节点基于分布式缓存组件中存储的各存储空间每秒请求数据对各存储空间每秒请求配额进行扣减,得到各存储空间每秒请求剩余额,并将各存储空间每秒请求剩余额作为本时间窗口内下一次服务节点扣减的基准;以及控制各服务节点基于各用户每秒请求数据对用户每秒请求配额进行扣减,得到用户每秒请求剩余额,并将用户每秒请求剩余额作为本时间窗口内下一次服务节点扣减的基准。Optionally, it can be known from the above embodiments that the recording of the request data per second of the data access request by each service node is the same as the bandwidth data recording process. Then, similarly, each service node can be controlled to deduct the request quota per second of each storage space based on the request data per second of each storage space stored in the distributed cache component to obtain the remaining request amount per second of each storage space, and use the remaining request amount per second of each storage space as the basis for the next service node deduction within the current time window; and each service node can be controlled to deduct the user's request quota per second based on the user's request data per second to obtain the remaining request amount per second of the user, and use the remaining request amount per second of the user as the basis for the next service node deduction within the current time window.
进一步地,每一次服务节点在分布式缓存组件中进行流量数据的记录和扣减时,都会对分布式缓存组件发起访问与请求,那么为了减少对分布式缓存组件的访问压力,可以提前根据数据访问端标识从分布式缓存组件预取一部分的各存储空间流控配额以及用户流控配额至本地内存中,服务节点所产生的流量数据就优先使用预取到本地的流控配额资源,本地预取流控配额资源使用完后,再将流量数据记录到分布式缓存组件中,实现减小分布式缓存组件的访问压力和处理压力。当分布式缓存组件由于网络、流量等不可控原因出现响应超时时,则将数据访问端的各存储空间流控配额以及用户流控配额都进行均摊给各服务节点,由各服务节点进行单机限流,依据本节点的流量数据和配额进行流量控制。Furthermore, every time a service node records and deducts traffic data in a distributed cache component, it will initiate access and requests to the distributed cache component. In order to reduce the access pressure on the distributed cache component, a portion of the storage space flow control quota and user flow control quota can be pre-fetched from the distributed cache component to the local memory according to the data access end identifier in advance. The traffic data generated by the service node will give priority to the pre-fetched local flow control quota resources. After the local pre-fetched flow control quota resources are used up, the traffic data will be recorded in the distributed cache component to reduce the access pressure and processing pressure of the distributed cache component. When the distributed cache component responds timeout due to uncontrollable reasons such as network and traffic, the storage space flow control quota and user flow control quota of the data access end will be evenly distributed to each service node, and each service node will perform single-machine flow limiting and perform flow control based on the traffic data and quota of this node.
具体地,数据访问端在发起数据访问请求时,是通过调用服务节点作为接口来进行具体的访问处理,由于数据被访问端的负载能力有限,那么服务节点作为数据被访问端中接收请求而产生大量流量的接口,为了保证进入服务节点的流量不会造成系统压力过大而拖垮数据被访问端整体系统,还需要对用户所使用的各类接口进行流量控制,而在接口层级来说,各不同功能的接口包括多种类型的接口,例如,不同功能接口有上传接口、下载接口等,其中上传接口包括普通上传接口、复制上传接口、分片上传接口、表单上传接口等不同类别的上传接口,分别对应不同的上传方式。Specifically, when the data access end initiates a data access request, it performs specific access processing by calling the service node as an interface. Since the load capacity of the data accessed end is limited, the service node serves as an interface for receiving requests from the data accessed end and generates a large amount of traffic. In order to ensure that the traffic entering the service node does not cause excessive system pressure and drag down the overall system of the data accessed end, it is also necessary to control the traffic of various interfaces used by users. At the interface level, interfaces with different functions include multiple types of interfaces. For example, different functional interfaces include upload interfaces, download interfaces, etc., among which upload interfaces include different categories of upload interfaces such as ordinary upload interfaces, copy upload interfaces, shard upload interfaces, form upload interfaces, etc., which correspond to different upload methods.
可选地,为了方便本申请描述,以上传功能接口以及各不同上传方式接口进行说明,其他功能接口的限流方式同理,不再赘述。在通常的上传接口限速中,只能分别对各不同类上传接口分别就进行配额限速,而无法实现统一功能接口下的配额共享,因此在进行流控配额配置时,可以为用户具体配置各存储空间接口配额以及用户接口配额,而在各存储空间接口配额中配置各存储空间当前接口配额和各存储空间统一接口配额,在用户接口配额中配置用户当前接口配额和用户统一接口配额,其中用户和存储空间级别下的当前接口配额与统一接口配额的关系为:统一接口配额大于任一当前接口配额,且各当前接口配额之和大于统一接口配额,而接口的流量控制策略也与用户级别和存储级别的统一控制相同,各当前接口流量数据大于对应的当前接口流控配额时,进行流量控制;各当前接口流量数据不大于对应的当前接口流控配额,且统一接口流量数据大于统一接口流控配额时,进行流量控制。Optionally, to facilitate the description of this application, the upload function interface and various upload method interfaces are used for explanation, and the current limiting methods of other function interfaces are similar and will not be repeated. In the usual upload interface speed limit, quota speed limits can only be set for different types of upload interfaces separately, and quota sharing under the unified functional interface cannot be achieved. Therefore, when configuring flow control quotas, you can configure specific storage space interface quotas and user interface quotas for users, and configure the current interface quotas of each storage space and the unified interface quotas of each storage space in each storage space interface quota, and configure the user current interface quota and the user unified interface quota in the user interface quota. The relationship between the current interface quota and the unified interface quota at the user and storage space levels is: the unified interface quota is greater than any current interface quota, and the sum of the current interface quotas is greater than the unified interface quota, and the interface flow control strategy is the same as the unified control of the user level and storage level. When the flow data of each current interface is greater than the corresponding current interface flow control quota, flow control is performed; when the flow data of each current interface is not greater than the corresponding current interface flow control quota, and the flow data of the unified interface is greater than the unified interface flow control quota, flow control is performed.
进一步地,在具体的流量数据记录过程中,控制各服务节点基于各存储空间带宽数据中的各存储空间接口数据,对各存储空间带宽配额中各存储空间接口配额进行扣减,得到各存储空间接口剩余额;控制各服务节点基于各用户带宽数据中的各用户接口数据对用户带宽配额中的用户接口配额进行扣减,得到用户接口剩余额。其中,各存储空间内的扣减流程为首先扣减存储空间当前接口流控配额,再扣减存储空间统一接口流控配额;用户层级内的扣减流程为首先扣减用户当前接口流控配额,再扣减用户统一接口流控配额。Furthermore, in the specific flow data recording process, each service node is controlled to deduct each storage space interface quota in each storage space bandwidth quota based on each storage space interface data in each storage space bandwidth data, so as to obtain each storage space interface remaining amount; each service node is controlled to deduct the user interface quota in the user bandwidth quota based on each user interface data in each user bandwidth data, so as to obtain the user interface remaining amount. Among them, the deduction process in each storage space is to first deduct the current interface flow control quota of the storage space, and then deduct the unified interface flow control quota of the storage space; the deduction process in the user level is to first deduct the current interface flow control quota of the user, and then deduct the unified interface flow control quota of the user.
请参阅图7,图7为本申请实施例提供的一种上传接口的流量控制结构图。如图7所示,在接收到数据访问请求流量数据710之后,在存储空间流控单元720进行存储空间流控的过程中,在存储空间级别内部首先在存储空间当前接口流控单元730中进行存储空间当前接口配额检测,确认其满足当前接口流量时,进入存储空间统一接口流控单元740中进行存储空间统一接口配额检测,确认其满足当前接口流量之后,在用户级别内部,用户流控单元750中的用户当前接口流控单元760中进行用户当前接口配额检测,确认其满足当前接口流量时,进入用户统一接口流控单元770中进行用户统一接口配额检测,确认其满足当前接口流量之后,对当前接口的数据访问请求进行响应。Please refer to Figure 7, which is a flow control structure diagram of an upload interface provided by an embodiment of the present application. As shown in Figure 7, after receiving the data access request flow data 710, in the process of storage space flow control in the storage space flow control unit 720, the storage space current interface quota detection is first performed in the storage space current interface flow control unit 730 within the storage space level. When it is confirmed that it meets the current interface flow, it enters the storage space unified interface flow control unit 740 to perform the storage space unified interface quota detection. After confirming that it meets the current interface flow, within the user level, the user current interface quota detection is performed in the user current interface flow control unit 760 in the user flow control unit 750. When it is confirmed that it meets the current interface flow, it enters the user unified interface flow control unit 770 to perform the user unified interface quota detection. After confirming that it meets the current interface flow, the data access request of the current interface is responded to.
S504、当任一存储空间带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制;当各存储空间带宽剩余额大于或者等于零,且用户带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制。S504. When the remaining amount of bandwidth of any storage space is less than zero, control each service node to perform bandwidth control on the data access terminal; when the remaining amount of bandwidth of each storage space is greater than or equal to zero, and the remaining amount of user bandwidth is less than zero, control each service node to perform bandwidth control on the data access terminal.
可选地,控制各服务节点在分布式缓存组件中进行流控配额扣减时,当任一存储空间带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制;当各存储空间带宽剩余额大于或者等于零,且用户带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制。Optionally, when controlling each service node to perform flow control quota deduction in the distributed cache component, when the remaining bandwidth of any storage space is less than zero, control each service node to perform bandwidth control on the data access end; when the remaining bandwidth of each storage space is greater than or equal to zero, and the remaining bandwidth of the user is less than zero, control each service node to perform bandwidth control on the data access end.
具体地,在对数据访问端进行带宽控制时,常见的带宽控制方法对带宽无法通过其配额时,会进行断连处理,直接将其传输过程终止,这导致用户的数据访问请求会直接失败,进而不断发起重连,加重数据被访问端的负载压力。而在本申请实施例中,考虑到用户使用带宽进行数据传输时的流畅性,可以对带宽进行不断连控制,基于TCP(TransmissionCommunication Protocol)协议的Flow Control机制,在数据传输过程中,若是数据传输速度较慢,则在传输层就会有排队,那么还在传输过程中的数据包要被保存在接收缓冲区中,因此,接收缓冲区的空间就会变小,此时,在接收端发回给发送端的ACK(Acknowledgecharacter,确认字符)会表示出接收缓冲区的剩余空间大小,以控制发送端适应性增减发送出的数据以免数据包丢失。Specifically, when bandwidth control is performed on the data access end, the common bandwidth control method will disconnect the data when the bandwidth cannot pass its quota, and directly terminate its transmission process, which causes the user's data access request to fail directly, and then continuously initiates reconnection, increasing the load pressure on the data access end. In the embodiment of the present application, considering the smoothness of the user's use of bandwidth for data transmission, the bandwidth can be continuously controlled. Based on the Flow Control mechanism of the TCP (Transmission Communication Protocol) protocol, during the data transmission process, if the data transmission speed is slow, there will be a queue at the transport layer, and the data packets still in the transmission process will be stored in the receiving buffer. Therefore, the space of the receiving buffer will become smaller. At this time, the ACK (Acknowledge character) sent back to the sending end at the receiving end will indicate the remaining space size of the receiving buffer, so as to control the sending end to adaptively increase or decrease the data sent to avoid data packet loss.
可选地,在具体的带宽控制过程中,可以控制各服务节点在数据访问端逐渐占满当前时间窗口的带宽配额时,即向数据访问端发送逐渐减小的ACK,用以提醒数据访问端减少该时间窗口内发送的数据,对数据访问端暂停响应数据访问请求,并确定数据访问请求中还未响应的溢出访问请求,并在下一时间窗口响应溢出访问请求,实现不断连式的带宽流量控制。Optionally, in a specific bandwidth control process, each service node can be controlled to send a gradually decreasing ACK to the data access end when the bandwidth quota of the current time window is gradually filled up by the data access end, so as to remind the data access end to reduce the data sent within the time window, suspend responding to data access requests from the data access end, determine the overflow access requests that have not yet been responded to in the data access requests, and respond to the overflow access requests in the next time window, so as to realize uninterrupted bandwidth flow control.
请参阅图8,图8为本申请实施例提供的一种带宽数据的流量控制示意图。如图8所示,在时间轴中,将划分出的单个时间窗口的带宽配额抽象表示为4个矩形,数据访问请求在当前的时间窗口中的4个带宽配额都已使用,那么将其剩下的带宽数据延迟至下一个时间窗口进行处理,并以此类推,直至时间窗口的带宽配额能够满足该数据访问请求剩余的带宽数据,则视为该数据访问请求响应成功,例如,带宽数据为15个矩形的数据访问请求将会经过是3个完整时间窗口以及1个3/4时间窗口实现处理结束。Please refer to Figure 8, which is a flow control diagram of bandwidth data provided by an embodiment of the present application. As shown in Figure 8, in the timeline, the bandwidth quota of a single time window is abstractly represented as 4 rectangles. If the 4 bandwidth quotas of the data access request in the current time window have been used, the remaining bandwidth data will be delayed to the next time window for processing, and so on, until the bandwidth quota of the time window can satisfy the remaining bandwidth data of the data access request, then the data access request is deemed to have successfully responded. For example, a data access request with bandwidth data of 15 rectangles will be processed through 3 complete time windows and 1 3/4 time window.
可以理解地,对于数据访问端的每秒请求数据进行流量控制时,每秒请求量过多时,服务节点会直接无法继续工作,那么控制各服务节点在分布式缓存组件中进行流控配额扣减时,当任一存储空间每秒请求剩余额小于零,则控制各服务节点拒绝并返回数据访问请求至数据访问端;当各存储空间每秒请求剩余额大于或者等于零,且用户每秒请求剩余额小于零,则控制各服务节点拒绝并返回数据访问请求至数据访问端。It can be understood that when flow control is performed on the request data per second of the data access end, if the number of requests per second is too large, the service node will be unable to continue working directly. Then, when controlling each service node to deduct the flow control quota in the distributed cache component, when the remaining amount of requests per second of any storage space is less than zero, each service node is controlled to reject and return the data access request to the data access end; when the remaining amount of requests per second of each storage space is greater than or equal to zero, and the remaining amount of requests per second of the user is less than zero, each service node is controlled to reject and return the data access request to the data access end.
在本申请实施例中,提供一种流量控制方法,在配置中心配置存储空间带宽配额、存储空间每秒请求配额、用户带宽配额以及用户每秒请求配额,引入分布式缓存组件,由各服务节点分别在分布式缓存组件中记录存储空间带宽数据、存储空间每秒请求数据、用户带宽数据以及用户每秒请求数据,并且在分布式缓存组件中进行配额扣减,根据对应的扣减后的剩余额来实现流量控制判断,其中,在存储空间和用户两种级别下,分别进行当前接口流控和统一接口流控,有效解决不能同时对存储空间和用户限速的问题,也有效解决无法对接口统一流量控制的问题,并且实现了不断连式的带宽限速,改善用户的使用体验。In an embodiment of the present application, a flow control method is provided, in which a storage space bandwidth quota, a storage space request quota per second, a user bandwidth quota and a user request quota per second are configured in a configuration center, and a distributed cache component is introduced, and each service node records the storage space bandwidth data, the storage space request quota per second, the user bandwidth data and the user request data per second in the distributed cache component, and deducts the quota in the distributed cache component, and realizes the flow control judgment according to the corresponding remaining amount after deduction, wherein, at the storage space and user levels, current interface flow control and unified interface flow control are respectively performed, which effectively solves the problem of not being able to limit the speed of storage space and users at the same time, and also effectively solves the problem of not being able to unify the flow control of the interface, and realizes continuous bandwidth speed limiting, thereby improving the user experience.
请参阅图9,图9为本申请实施例提供的一种流量控制装置的结构框图。Please refer to FIG. 9 , which is a structural block diagram of a flow control device provided in an embodiment of the present application.
如图9所示,流量控制装置900包括:As shown in FIG9 , the flow control device 900 includes:
请求响应模块910,用于响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间的存储空间流控配额以及用户流控配额;The request response module 910 is used to respond to the data access request, allocate at least one service node for the data access request, and obtain the storage space flow control quota and user flow control quota of each storage space corresponding to the data access end;
流量记录模块920,用于控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;The traffic recording module 920 is used to control each service node to respectively record the traffic data of each storage space and the user traffic data generated when the data access terminal performs data access based on the data access request;
流量控制模块930,用于控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制。The flow control module 930 is used to control each service node to perform flow control on the data access end according to each storage space flow data, user flow data, each storage space flow control quota and user flow control quota.
可选地,用户流控配额大于任意一个存储空间流控配额,且用户流控配额小于所有存储空间流控配额之和。Optionally, the user flow control quota is greater than any storage space flow control quota, and the user flow control quota is less than the sum of all storage space flow control quotas.
可选地,流量控制模块930,还用于当任一存储空间流量数据与其对应的存储空间流控配额满足第一流控条件时,则控制各服务节点对数据访问端进行第一流量控制;当各存储空间流量数据与其对应的存储空间流控配额不满足第一流控条件,且用户流量数据与用户流控配额满足第二流控条件时,则控制各服务节点对数据访问端进行第二流量控制。Optionally, the flow control module 930 is also used to control each service node to perform a first flow control on the data access end when any storage space flow data and its corresponding storage space flow control quota meet a first flow control condition; when each storage space flow data and its corresponding storage space flow control quota do not meet the first flow control condition, and the user flow data and the user flow control quota meet the second flow control condition, then control each service node to perform a second flow control on the data access end.
可选地,各服务节点被分配的数据访问请求的数量相同,且存储空间流控配额中包括存储空间并发配额,用户流控配额中包括用户并发配额;流量控制装置900还包括:配额分配模块,用于将数据访问端对应的各存储空间并发配额以及用户并发配额均摊至各服务节点,得到各服务节点对应的各存储空间节点并发配额以及各用户节点并发配额。Optionally, each service node is allocated the same number of data access requests, and the storage space flow control quota includes a storage space concurrency quota, and the user flow control quota includes a user concurrency quota; the flow control device 900 also includes: a quota allocation module, which is used to allocate the storage space concurrency quotas and user concurrency quotas corresponding to the data access end to each service node, and obtain the storage space node concurrency quota and user node concurrency quota corresponding to each service node.
可选地,流量记录模块920,还用于控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间并发数据以及用户并发数据。Optionally, the traffic recording module 920 is further used to control each service node to respectively record the concurrent data of each storage space and the concurrent data of the user generated when the data access terminal performs data access based on the data access request.
可选地,流量控制模块930,还用于当任一存储空间并发数据大于其对应的存储空间节点并发配额时,则控制各服务节点拒绝并返回数据访问请求至数据访问端;当各存储空间并发数据小于或者等于其对应的存储空间节点并发配额时,且任一用户并发数据大于其对应的用户节点并发配额,则控制各服务节点拒绝并返回数据访问请求至数据访问端。Optionally, the traffic control module 930 is also used to control each service node to reject and return the data access request to the data access end when the concurrent data of any storage space is greater than the concurrent quota of its corresponding storage space node; when the concurrent data of each storage space is less than or equal to the concurrent quota of its corresponding storage space node, and the concurrent data of any user is greater than the concurrent quota of its corresponding user node, then control each service node to reject and return the data access request to the data access end.
可选地,存储空间流控配额中包括存储空间带宽配额,用户流控配额中包括用户带宽配额;流量记录模块920,还用于在预设时间窗口内,控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间带宽数据以及用户带宽数据;控制各服务节点基于各存储空间带宽数据对各存储空间带宽配额进行扣减,得到各存储空间带宽剩余额,以及基于各用户带宽数据对用户带宽配额进行扣减,得到用户带宽剩余额。Optionally, the storage space flow control quota includes a storage space bandwidth quota, and the user flow control quota includes a user bandwidth quota; the traffic recording module 920 is also used to control each service node to record, within a preset time window, the storage space bandwidth data and user bandwidth data generated when the data access terminal accesses data based on a data access request; control each service node to deduct each storage space bandwidth quota based on each storage space bandwidth data to obtain each storage space bandwidth surplus, and to deduct the user bandwidth quota based on each user bandwidth data to obtain the user bandwidth surplus.
可选地,流量记录模块920,还用于控制各服务节点基于各存储空间带宽数据中的各存储空间接口数据,对各存储空间带宽配额中各存储空间接口配额进行扣减,得到各存储空间接口剩余额;控制各服务节点基于各用户带宽数据中的各用户接口数据对用户带宽配额中的用户接口配额进行扣减,得到用户接口剩余额。Optionally, the traffic recording module 920 is also used to control each service node to deduct each storage space interface quota in each storage space bandwidth quota based on each storage space interface data in each storage space bandwidth data to obtain the remaining amount of each storage space interface; and control each service node to deduct the user interface quota in the user bandwidth quota based on each user interface data in each user bandwidth data to obtain the remaining amount of the user interface.
可选地,流量控制模块930,还用于当任一存储空间带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制;当各存储空间带宽剩余额大于或者等于零,且用户带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制。Optionally, the traffic control module 930 is also used to control each service node to perform bandwidth control on the data access terminal when the remaining bandwidth of any storage space is less than zero; when the remaining bandwidth of each storage space is greater than or equal to zero, and the remaining bandwidth of the user is less than zero, then control each service node to perform bandwidth control on the data access terminal.
可选地,流量控制模块930,还用于控制各服务节点对数据访问端暂停响应数据访问请求,并确定数据访问请求中还未响应溢出访问请求,并在下一时间窗口响应溢出访问请求。Optionally, the flow control module 930 is further used to control each service node to suspend responding to data access requests from the data access end, determine that overflow access requests have not been responded to in the data access requests, and respond to the overflow access requests in the next time window.
在本申请实施例中,提供一种流量控制装置,其中,请求响应模块,用于响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间流控配额以及用户流控配额;流量记录模块,用于控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;流量控制模块,用于控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制。由于在本申请中,同时对数据访问端的用户级别和各存储空间级别都配置了相应的流控配额,且在对数据访问端进行流量控制时,同时考虑各存储空间所产生的流量以及用户账户下产生的所有流量,并将其与各自对应的流控配额进行对比,这样同时控制用户级别的流量和各存储空间的流量,最终可以对数据访问端进行多个层级的统一流控,实现更精确、稳定的流量控制。In an embodiment of the present application, a flow control device is provided, wherein a request response module is used to respond to a data access request, allocate at least one service node for the data access request, and obtain the flow control quotas of each storage space and the user flow control quota corresponding to the data access terminal; a flow recording module is used to control each service node to respectively record the flow data of each storage space and the user flow data generated when the data access terminal performs data access based on the data access request; and a flow control module is used to control each service node to perform flow control on the data access terminal according to the flow data of each storage space, the user flow data, the flow control quotas of each storage space and the user flow control quota. Because in the present application, the corresponding flow control quotas are configured for both the user level and each storage space level of the data access terminal, and when the flow control is performed on the data access terminal, the flow generated by each storage space and all the flow generated under the user account are considered at the same time, and compared with the corresponding flow control quotas, so that the flow of the user level and the flow of each storage space are controlled at the same time, and finally the data access terminal can be subjected to unified flow control at multiple levels to achieve more accurate and stable flow control.
本申请实施例还提供了一种计算机存储介质,计算机存储介质可以存储有多条指令,指令适于由处理器加载并执行如上述实施例中的任一项的方法的步骤。An embodiment of the present application further provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded by a processor and executing the steps of any method in the above embodiments.
请参见图10,图10为本申请实施例提供的一种服务器的结构示意图。如图10所示,服务器1000可以包括:至少一个服务器处理器1001,至少一个网络接口1004,用户接口1003,存储器1005,至少一个通信总线1002。Please refer to Figure 10, which is a schematic diagram of the structure of a server provided in an embodiment of the present application. As shown in Figure 10, the server 1000 may include: at least one server processor 1001, at least one network interface 1004, a user interface 1003, a memory 1005, and at least one communication bus 1002.
其中,通信总线1002用于实现这些组件之间的连接通信。The communication bus 1002 is used to realize the connection and communication between these components.
其中,用户接口1003可以包括显示屏(Display)、摄像头(Camera),可选用户接口1003还可以包括标准的有线接口、无线接口。The user interface 1003 may include a display screen (Display) and a camera (Camera), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
其中,网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
其中,服务器处理器1001可以包括一个或者多个处理核心。服务器处理器1001利用各种接口和线路连接整个服务器1000内的各个部分,通过运行或执行存储在存储器1005内的指令、程序、代码集或指令集,以及调用存储在存储器1005内的数据,执行服务器1000的各种功能和处理数据。可选的,服务器处理器1001可以采用数字信号处理(DigitalSignal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。服务器处理器1001可集成中央处理器(Central Processing Unit,CPU)、图像处理器(GraphicsProcessing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示屏所需要显示的内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到服务器处理器1001中,单独通过一块芯片进行实现。Among them, the server processor 1001 may include one or more processing cores. The server processor 1001 uses various interfaces and lines to connect various parts within the entire server 1000, and executes various functions and processes data of the server 1000 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1005, and calling data stored in the memory 1005. Optionally, the server processor 1001 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The server processor 1001 can integrate one or more combinations of a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the server processor 1001, and it can be implemented separately through a chip.
其中,存储器1005可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory,ROM)。可选的,该存储器1005包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器1005可用于存储指令、程序、代码、代码集或指令集。存储器1005可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现上述各个方法实施例的指令等;存储数据区可存储上面各个方法实施例中涉及到的数据等。存储器1005可选的还可以是至少一个位于远离前述服务器处理器1001的存储装置。如图10所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及流量控制程序。Among them, the memory 1005 may include a random access memory (Random Access Memory, RAM), and may also include a read-only memory (Read-Only Memory, ROM). Optionally, the memory 1005 includes a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1005 may include a storage program area and a storage data area, wherein the storage program area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the storage data area may store data involved in the above various method embodiments, etc. The memory 1005 may also be at least one storage device located away from the aforementioned server processor 1001. As shown in Figure 10, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a flow control program.
在图10所示的服务器1000中,用户接口1003主要用于为用户提供输入的接口,获取用户输入的数据;而服务器处理器1001可以用于调用存储器1005中存储的流量控制程序,并具体执行以下操作:In the server 1000 shown in FIG. 10 , the user interface 1003 is mainly used to provide an input interface for the user and obtain the data input by the user; and the server processor 1001 can be used to call the flow control program stored in the memory 1005 and specifically perform the following operations:
响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间的存储空间流控配额以及用户流控配额;Respond to the data access request, allocate at least one service node for the data access request, and obtain the storage space flow control quota and user flow control quota of each storage space corresponding to the data access end;
控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;Control each service node to respectively record the storage space traffic data and user traffic data generated when the data access end performs data access based on the data access request;
控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制。Control each service node to perform flow control on the data access end according to each storage space flow data, user flow data, each storage space flow control quota and user flow control quota.
在一些实施例中,用户流控配额大于任意一个存储空间流控配额,且用户流控配额小于所有存储空间流控配额之和。In some embodiments, the user flow control quota is greater than any storage space flow control quota, and the user flow control quota is less than the sum of all storage space flow control quotas.
在一些实施例中,服务器处理器1001在执行控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制时,具体执行以下步骤:当任一存储空间流量数据与其对应的存储空间流控配额满足第一流控条件时,则控制各服务节点对数据访问端进行第一流量控制;当各存储空间流量数据与其对应的存储空间流控配额不满足第一流控条件,且用户流量数据与用户流控配额满足第二流控条件时,则控制各服务节点对数据访问端进行第二流量控制。In some embodiments, when the server processor 1001 controls each service node to perform flow control on the data access terminal according to each storage space flow data, user flow data, each storage space flow control quota and the user flow control quota, it specifically performs the following steps: when any storage space flow data and its corresponding storage space flow control quota meet the first flow control condition, each service node is controlled to perform the first flow control on the data access terminal; when each storage space flow data and its corresponding storage space flow control quota do not meet the first flow control condition, and the user flow data and the user flow control quota meet the second flow control condition, each service node is controlled to perform the second flow control on the data access terminal.
在一些实施例中,各服务节点被分配的数据访问请求的数量相同,且存储空间流控配额中包括存储空间并发配额,用户流控配额中包括用户并发配额;服务器处理器1001在执行获取数据访问端对应的各存储空间流控配额以及用户流控配额之后,还具体执行以下步骤:将数据访问端对应的各存储空间并发配额以及用户并发配额均摊至各服务节点,得到各服务节点对应的各存储空间节点并发配额以及各用户节点并发配额。In some embodiments, each service node is allocated the same number of data access requests, and the storage space flow control quota includes a storage space concurrency quota, and the user flow control quota includes a user concurrency quota; after the server processor 1001 obtains the storage space flow control quotas and user flow control quotas corresponding to the data access end, it also specifically performs the following steps: allocating the storage space concurrency quotas and user concurrency quotas corresponding to the data access end to each service node, and obtaining the storage space node concurrency quota and user node concurrency quota corresponding to each service node.
在一些实施例中,服务器处理器1001在执行控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据时,具体执行以下步骤:控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间并发数据以及用户并发数据。In some embodiments, when the server processor 1001 controls each service node to respectively record the storage space traffic data and user traffic data generated when the data access terminal accesses data based on a data access request, it specifically performs the following steps: control each service node to respectively record the storage space concurrent data and user concurrent data generated when the data access terminal accesses data based on a data access request.
在一些实施例中,服务器处理器1001在执行当任一存储空间流量数据与其对应的存储空间流控配额满足第一流控条件时,则控制各服务节点对数据访问端进行第一流量控制时,具体执行以下步骤:当任一存储空间并发数据大于其对应的存储空间节点并发配额时,则控制各服务节点拒绝并返回数据访问请求至数据访问端;服务器处理器1001在执行当各存储空间流量数据与其对应的存储空间流控配额不满足第一流控条件,且用户流量数据与用户流控配额满足第二流控条件时,则控制各服务节点对数据访问端进行第二流量控制时,具体执行以下步骤:当各存储空间并发数据小于或者等于其对应的存储空间节点并发配额时,且任一用户并发数据大于其对应的用户节点并发配额,则控制各服务节点拒绝并返回数据访问请求至数据访问端。In some embodiments, when the server processor 1001 controls each service node to perform the first flow control on the data access terminal when any storage space traffic data and its corresponding storage space flow control quota satisfy the first flow control condition, the server processor 1001 specifically performs the following steps: when any storage space concurrent data is greater than its corresponding storage space node concurrent quota, the server processor 1001 controls each service node to reject and return the data access request to the data access terminal; when the server processor 1001 controls each service node to perform the second flow control on the data access terminal when each storage space traffic data and its corresponding storage space flow control quota do not satisfy the first flow control condition, and the user traffic data and the user flow control quota satisfy the second flow control condition, the server processor 1001 specifically performs the following steps: when each storage space concurrent data is less than or equal to its corresponding storage space node concurrent quota, and any user concurrent data is greater than its corresponding user node concurrent quota, the server processor 1001 controls each service node to reject and return the data access request to the data access terminal.
在一些实施例中,存储空间流控配额中包括存储空间带宽配额,用户流控配额中包括用户带宽配额;服务器处理器1001在执行控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据时,具体执行以下步骤:在预设时间窗口内,控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间带宽数据以及用户带宽数据;控制各服务节点基于各存储空间带宽数据对各存储空间带宽配额进行扣减,得到各存储空间带宽剩余额,以及基于各用户带宽数据对用户带宽配额进行扣减,得到用户带宽剩余额。In some embodiments, the storage space flow control quota includes a storage space bandwidth quota, and the user flow control quota includes a user bandwidth quota; when the server processor 1001 controls each service node to respectively record the storage space traffic data and user traffic data generated when the data access terminal accesses data based on a data access request, it specifically performs the following steps: within a preset time window, control each service node to respectively record the storage space bandwidth data and user bandwidth data generated when the data access terminal accesses data based on a data access request; control each service node to deduct each storage space bandwidth quota based on each storage space bandwidth data to obtain each storage space bandwidth surplus, and deduct the user bandwidth quota based on each user bandwidth data to obtain the user bandwidth surplus.
在一些实施例中,服务器处理器1001在执行控制各服务节点基于各存储空间带宽数据对各存储空间带宽配额进行扣减,得到各存储空间带宽剩余额时,具体执行以下步骤:控制各服务节点基于各存储空间带宽数据中的各存储空间接口数据,对各存储空间带宽配额中各存储空间接口配额进行扣减,得到各存储空间接口剩余额;服务器处理器1001在执行基于各用户带宽数据对用户带宽配额进行扣减,得到用户带宽剩余额时,具体执行以下步骤:控制各服务节点基于各用户带宽数据中的各用户接口数据对用户带宽配额中的用户接口配额进行扣减,得到用户接口剩余额。In some embodiments, when the server processor 1001 controls each service node to deduct each storage space bandwidth quota based on each storage space bandwidth data to obtain each storage space bandwidth surplus, it specifically performs the following steps: controls each service node to deduct each storage space interface quota from each storage space bandwidth quota based on each storage space interface data in each storage space bandwidth data to obtain each storage space interface surplus; when the server processor 1001 controls the user bandwidth quota based on each user bandwidth data to obtain the user bandwidth surplus, it specifically performs the following steps: controls each service node to deduct the user interface quota from the user bandwidth quota based on each user interface data in each user bandwidth data to obtain the user interface surplus.
在一些实施例中,服务器处理器1001在执行当任一存储空间流量数据与其对应的存储空间流控配额满足第一流控条件时,则控制各服务节点对数据访问端进行第一流量控制时,具体执行以下步骤:当任一存储空间带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制;服务器处理器1001在执行当各存储空间流量数据与其对应的存储空间流控配额不满足第一流控条件,且用户流量数据与用户流控配额满足第二流控条件时,则控制各服务节点对数据访问端进行第二流量控制时,具体执行以下步骤:当各存储空间带宽剩余额大于或者等于零,且用户带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制。In some embodiments, when the server processor 1001 controls each service node to perform first flow control on the data access terminal when any storage space traffic data and its corresponding storage space flow control quota meet the first flow control condition, the server processor 1001 specifically performs the following steps: when any storage space bandwidth remaining amount is less than zero, each service node is controlled to perform bandwidth control on the data access terminal; when the server processor 1001 controls each service node to perform second flow control on the data access terminal when each storage space traffic data and its corresponding storage space flow control quota do not meet the first flow control condition, and the user traffic data and the user flow control quota meet the second flow control condition, the server processor 1001 specifically performs the following steps: when each storage space bandwidth remaining amount is greater than or equal to zero, and the user bandwidth remaining amount is less than zero, each service node is controlled to perform bandwidth control on the data access terminal.
在一些实施例中,服务器处理器1001在执行控制各服务节点对数据访问端进行带宽控制时,具体执行以下步骤:控制各服务节点对数据访问端暂停响应数据访问请求,并确定数据访问请求中还未响应溢出访问请求,并在下一时间窗口响应溢出访问请求。In some embodiments, when the server processor 1001 controls each service node to perform bandwidth control on the data access end, it specifically performs the following steps: controls each service node to suspend responding to data access requests from the data access end, determines that an overflow access request has not been responded to in the data access request, and responds to the overflow access request in the next time window.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本申请所必须的。It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
以上为对本申请所提供的一种流量控制方法、装置、存储介质以及服务器的描述,对于本领域的技术人员,依据本申请实施例的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。The above is a description of a flow control method, device, storage medium and server provided in the present application. For technicians in this field, according to the ideas of the embodiments of the present application, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210326272.5A CN114745338B (en) | 2022-03-30 | 2022-03-30 | Flow control method, device, storage medium and server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210326272.5A CN114745338B (en) | 2022-03-30 | 2022-03-30 | Flow control method, device, storage medium and server |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114745338A CN114745338A (en) | 2022-07-12 |
CN114745338B true CN114745338B (en) | 2024-09-06 |
Family
ID=82279144
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210326272.5A Active CN114745338B (en) | 2022-03-30 | 2022-03-30 | Flow control method, device, storage medium and server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114745338B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115297057B (en) * | 2022-07-22 | 2024-02-02 | 国网黑龙江省电力有限公司信息通信公司 | Network traffic control method based on information management platform |
CN115766582B (en) * | 2022-11-14 | 2025-06-17 | 阿里巴巴(中国)有限公司 | Flow control method, device and system, medium and computer equipment |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105208121A (en) * | 2015-09-23 | 2015-12-30 | 深圳市深信服电子科技有限公司 | File access flow control method and system based on distributed file system |
Family Cites Families (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5946686A (en) * | 1997-07-11 | 1999-08-31 | International Business Machines Corporation | Parallel file system and method with quota allocation |
US7783666B1 (en) * | 2007-09-26 | 2010-08-24 | Netapp, Inc. | Controlling access to storage resources by using access pattern based quotas |
US8015281B2 (en) * | 2008-04-21 | 2011-09-06 | Microsoft Corporation | Dynamic server flow control in a hybrid peer-to-peer network |
CN110795230A (en) * | 2018-08-03 | 2020-02-14 | Emc Ip控股有限公司 | Intelligent solution to support unified distributed real-time quota limit |
CN110138756B (en) * | 2019-04-30 | 2021-05-25 | 网宿科技股份有限公司 | Current limiting method and system |
CN110166376B (en) * | 2019-06-06 | 2022-11-01 | 北京百度网讯科技有限公司 | Flow control method and device, system, server and computer readable medium |
CN110213173B (en) * | 2019-06-06 | 2023-03-24 | 北京百度网讯科技有限公司 | Flow control method and device, system, server and computer readable medium |
CN110708258B (en) * | 2019-09-29 | 2023-04-07 | Oppo广东移动通信有限公司 | Flow control method, device, server and storage medium |
CN112751691B (en) * | 2019-10-29 | 2022-03-15 | 北京金山云网络技术有限公司 | Rate limiting method, device, central control device and gateway for network traffic |
CN113301075B (en) * | 2020-05-18 | 2022-09-13 | 阿里巴巴集团控股有限公司 | Flow control method, distributed system, device and storage medium |
CN113760940B (en) * | 2020-09-24 | 2024-10-18 | 北京沃东天骏信息技术有限公司 | Quota management method, device, equipment and medium applied to distributed system |
CN113285883A (en) * | 2021-05-25 | 2021-08-20 | 挂号网(杭州)科技有限公司 | Access request current limiting method and device, electronic equipment and storage medium |
-
2022
- 2022-03-30 CN CN202210326272.5A patent/CN114745338B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105208121A (en) * | 2015-09-23 | 2015-12-30 | 深圳市深信服电子科技有限公司 | File access flow control method and system based on distributed file system |
Also Published As
Publication number | Publication date |
---|---|
CN114745338A (en) | 2022-07-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021254330A1 (en) | Memory management method and system, client, server and storage medium | |
CN111694646B (en) | Resource scheduling method, device, electronic equipment and computer readable storage medium | |
CN114745338B (en) | Flow control method, device, storage medium and server | |
CN102325148B (en) | A method of invoking WebService service | |
JP7100154B2 (en) | Processor core scheduling method, equipment, terminals and storage media | |
WO2019228344A1 (en) | Resource configuration method and apparatus, and terminal and storage medium | |
US9519490B2 (en) | Adaptive data synchronization | |
CN109889576B (en) | A game theory-based optimization method for mobile cloud game resources | |
CN111224806A (en) | A resource allocation method and server | |
CN114867065B (en) | Base station calculation load balancing method, equipment and storage medium | |
CN112260853A (en) | Disaster recovery switching method and device, storage medium and electronic equipment | |
CN113849312A (en) | Data processing task allocation method and device, electronic equipment and storage medium | |
CN114205762A (en) | Short message flow control method, equipment and storage medium | |
CN115378879A (en) | Data control method and related device | |
CN109002364A (en) | Optimization method, electronic device and the readable storage medium storing program for executing of interprocess communication | |
CN112600761A (en) | Resource allocation method, device and storage medium | |
WO2023226948A1 (en) | Traffic control method and apparatus, electronic device and readable storage medium | |
CN115017030A (en) | Resource allocation method, device, electronic equipment and storage medium | |
CN112104679A (en) | Method, apparatus, device and medium for processing hypertext transfer protocol request | |
CN117407159A (en) | Memory space management method and device, equipment and storage medium | |
WO2023174037A1 (en) | Resource scheduling method, apparatus and system, device, medium, and program product | |
CN111597041A (en) | Calling method and device of distributed system, terminal equipment and server | |
CN113328906B (en) | Flow real-time monitoring method and device, storage medium and electronic equipment | |
WO2025103006A1 (en) | Serverless computing-based data processing methods and electronic device | |
CN110109865A (en) | A kind of date storage method, device, equipment and readable storage medium storing program for executing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |