[go: up one dir, main page]

CN114745338A - Flow control method, flow control device, storage medium and server - Google Patents

Flow control method, flow control device, storage medium and server Download PDF

Info

Publication number
CN114745338A
CN114745338A CN202210326272.5A CN202210326272A CN114745338A CN 114745338 A CN114745338 A CN 114745338A CN 202210326272 A CN202210326272 A CN 202210326272A CN 114745338 A CN114745338 A CN 114745338A
Authority
CN
China
Prior art keywords
storage space
flow control
data
quota
data access
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.)
Granted
Application number
CN202210326272.5A
Other languages
Chinese (zh)
Other versions
CN114745338B (en
Inventor
唐德义
徐小伟
何小春
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202210326272.5A priority Critical patent/CN114745338B/en
Publication of CN114745338A publication Critical patent/CN114745338A/en
Application granted granted Critical
Publication of CN114745338B publication Critical patent/CN114745338B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/30Flow control; Congestion control in combination with information about buffer occupancy at either end or at transit nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow 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 application discloses a flow control method, a flow control device, a storage medium and a server, which respond to a data access request and acquire a flow control quota of each storage space and a user flow control quota corresponding to a data access end; controlling each service node to respectively record the generated flow data of each storage space and the generated flow data of the user; and controlling each service node to perform flow control on the data access end according to the flow data of each storage space, the flow data of the user, the flow control quota of each storage space and the flow control quota of the user. According to the method and the device, the flow control quota is configured for the user level and each storage space level of the data access end at the same time, and when the data access end is subjected to flow control, the flow generated by each storage space and all the flows generated under the user account are considered at the same time and are compared with the flow control quotas corresponding to the storage space and the user account, so that the data access end can be subjected to unified flow control of multiple levels finally, and more accurate and stable flow control is realized.

Description

流量控制方法、装置、存储介质以及服务器Flow control method, device, storage medium and server

技术领域technical field

本申请涉及计算机技术领域,尤其涉及一种流量控制方法、装置、存储介质以及服务器。The present application relates to the field of computer technologies, and in particular, to a flow control method, device, storage medium, and server.

背景技术Background technique

随着现代化信息技术的发展,各类使用互联网用户的数据访问需求也不断增长,本地服务器的存储能力和读写能力较差,且不易扩容和优化,那么为了满足用户的数据访问需求,并且加强数据读写模块的整体稳定性,分布式系统服务逐渐应用于人们的日常生活中,而分布式系统同时联机多个服务节点响应多个用户的访问需求,当部分用户的数据流量过大,可能导致影响到其他用户的正常数据操作,甚至影响分布式系统的正常使用。With the development of modern information technology, the data access requirements of various Internet users are also increasing. The storage capacity and reading and writing capabilities of local servers are poor, and it is not easy to expand and optimize. In order to meet users' data access needs, and strengthen The overall stability of the data reading and writing module, distributed system services are gradually applied in people's daily life, and the distributed system connects multiple service nodes at the same time to respond to the access needs of multiple users. When the data traffic of some users is too large, it may be This affects the normal data operations of other users, and even affects the normal use of distributed systems.

发明内容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 system instability in the related art.

第一方面,本申请实施例提供一种流量控制方法,应用于数据被访问端,所述数据被访问端中设置有数据访问端对应的至少两个存储空间,该方法包括:In a first aspect, an embodiment of the present application provides a flow control method, which is applied to a data accessed end, where at least two storage spaces corresponding to the data access end are set in the data accessed end, and the method includes:

响应数据访问请求,为所述数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间的存储空间流控配额以及用户流控配额;Responding to the data access request, allocating at least one service node for the data access request, and obtaining the storage space flow control quota and user flow control quota of each storage space corresponding to the data access terminal;

控制各服务节点分别记录所述数据访问端基于所述数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;Controlling each service node to separately record each storage space traffic data and user traffic data generated when the data access terminal performs data access based on the data access request;

控制各服务节点根据各存储空间流量数据、所述用户流量数据、各存储空间流控配额以及所述用户流控配额,对所述数据访问端进行流量控制。Each service node is controlled to perform flow control on the data access terminal 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, configured 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;

流量记录模块,用于控制各服务节点分别记录所述数据访问端基于所述数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;a traffic recording module, configured to control each service node to record the respective storage space traffic data and user traffic data generated when the data access terminal performs data access based on the data access request;

流量控制模块,用于控制各服务节点根据各存储空间流量数据、所述用户流量数据、各存储空间流控配额以及所述用户流控配额,对所述数据访问端进行流量控制。The flow control module is configured to control each service node to perform flow control on the data access terminal 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, where the computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the steps of the above method.

第四方面,本申请实施例提供一种服务器,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述计算机程序适于由处理器加载并执行上述的方法的步骤。In a fourth aspect, an embodiment of the present application provides a server, including a memory, a processor, and a computer program stored in the memory and running on the processor, the computer program being adapted to be loaded by the processor and execute the above method. step.

本申请一些实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought 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 Record each storage space flow data and user flow data generated when the data access terminal performs data access based on data access requests respectively; control each service node according to each storage space flow data, user flow data, each storage space flow control quota and user flow control Quota to control the flow of data access. In this application, corresponding flow control quotas are configured for both the user level of the data access terminal and each storage space level, and the traffic generated by each storage space and the user account are also considered when the flow control is performed on the data access terminal. All traffic generated under the system is compared with their corresponding flow control quotas, so that the user-level traffic and the traffic of each storage space can be controlled at the same time, and finally, multiple levels of unified flow control can be performed on the data access end to achieve better flow control. Precise and stable flow control.

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative effort.

图1为本申请实施例提供的一种流量控制方法的示例性系统架构图;FIG. 1 is an exemplary system architecture diagram of a flow control method provided by an embodiment of the present application;

图2为本申请实施例提供的一种流量控制方法的流程示意图;2 is a schematic flowchart of a flow control method provided by an embodiment of the present application;

图3为本申请实施例提供的一种流量控制方法的流程结构图;3 is a flowchart structure diagram of a flow control method provided by an embodiment of the present application;

图4为本申请实施例提供的一种流量控制方法的流程示意图;4 is a schematic flowchart of a flow control method provided by an embodiment of the present application;

图5为本申请实施例提供的一种流量控制方法的流程示意图;FIG. 5 is a schematic flowchart of a flow control method provided by an embodiment of the present application;

图6为本申请实施例提供的一种分布式缓存组件的控制流程图;FIG. 6 is a control flowchart of a distributed cache component provided by an embodiment of the present application;

图7为本申请实施例提供的一种上传接口的流量控制结构图;FIG. 7 is a flow control structural diagram of an upload interface provided by an embodiment of the present application;

图8为本申请实施例提供的一种带宽数据的流量控制示意图;FIG. 8 is a schematic diagram of flow control of bandwidth data according to an embodiment of the present application;

图9为本申请实施例提供的一种流量控制装置的结构框图;FIG. 9 is a structural block diagram of a flow control device provided by an embodiment of the present application;

图10为本申请实施例提供的一种服务器的结构示意图。FIG. 10 is a schematic structural diagram of a server according to an embodiment of the present application.

具体实施方式Detailed ways

为使得本申请的特征和优点能够更加的明显和易懂,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而非全部实施例。基于本申请中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the features and advantages of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments It is only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of this application.

下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Where the following description refers to the drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application, as recited in the appended claims.

随着互联网信息技术的蓬勃发展,企业和个人用户的数据访问需求都在不断增长。其中,对数据的存取需求最大,而云存储服务(Cloud storage)是伴随着海量存储需求而兴起的一种数据存取服务,即把数据存放在通常由第三方托管的多台虚拟服务器,而非专属的服务器上,来满足数据存储的需求具有简单可靠、海量安全等特点。从云存储服务的角度考虑,虽然云存储服务向用户提供了海量数据的存储能力,但是系统的读写能力总是可量化的有限的、且不易扩容和优化。因此,为了保证云存储服务的整体稳定性,避免部分用户的异常流量影响到其他用户,甚至引发连锁反应影响到整个系统,需要根据系统的处理能力对用户的异常流量进行流量控制。流量控制在网络传输中是一个常见的基本概念,其主要用于调整发送方传输数据的速度。同样地,在云存储服务的系统中,通过流量控制方法对访问流量进行限制、整形,可以保证系统提供最大化的服务能力,一般系统将会通过拒绝服务超过预期的访问来对异常流量进行处理。With the vigorous development of Internet information technology, the data access needs of enterprises and individual users are constantly increasing. Among them, the demand for data access is the largest, and cloud storage service (Cloud storage) is a data access service emerging with the demand for massive storage, that is, storing data in multiple virtual servers usually hosted by a third party, Instead of a dedicated server, it is simple, reliable, and massively secure to meet the needs of data storage. 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 quantifiably limited, and it is not easy to expand and optimize. Therefore, in order to ensure the overall stability of the cloud storage service and prevent the abnormal traffic of some users from affecting other users, or even triggering a chain reaction affecting the entire system, it is necessary to control the abnormal traffic of users according to the processing capacity of the system. Flow 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 flow control method is used to limit and shape the access traffic, which can ensure that the system can provide the maximum service capability. Generally, the system will process abnormal traffic by denying service beyond the expected access. .

在常见的限流方法中,大致可以分为单机限流和分布式限流。单机限流是指各服务节点在限流策略上是相互独立的,互不影响,各服务节点可能拥有不同的限流策略;而分布式限流采用可扩展的系统结构,利用多台存储服务器分担计算负荷,解决了传统单机限流中系统整体流量不稳定的瓶颈问题,提高了限流系统的可靠性、可用性和扩展性,其中引入了中心化缓存中间件,可以感知系统中各服务节点的流量变化,对系统整体形成统一的限流服务,但对于时间敏感的限流策略需要考虑服务节点与缓存中间件的时间一致性问题,同时也需要考虑访问缓存中间件超时的情况。Among the common current limiting methods, it can be roughly divided into stand-alone current limiting and distributed current limiting. Single-server current limiting means that each service node is independent of each other in terms of current limiting strategies and does not affect each other. Each service node may have different current limiting strategies; while distributed current limiting adopts a scalable system structure and uses multiple storage servers. Share the computing load, solve the bottleneck problem of unstable overall system flow in the traditional single-machine current limiting system, and improve the reliability, availability and scalability of the current limiting system. Centralized cache middleware is introduced, which can sense each service node in the system. However, for the time-sensitive current limiting strategy, the time consistency between the service node and the cache middleware needs to be considered, and the timeout of accessing the cache middleware also needs to be considered.

由于在云存储的系统中,一个用户的账户下一般都拥有多个存储空间,而从目前主要的分布式限流方法来看,各分布式系统中的限流服务通常会对用户的各存储空间分别配置流控配额,或直接对用户分配所有存储空间共用的总配额,但用户具体使用存储空间以及流控配额的情况是无法在系统中预知的,因此单一的基于存储空间级别或单一的基于用户级别来配置流控配额,会使得限流策略无法适用于流量使用情况多样化的大量用户,以及对于系统整体的流量无法进行精确控制,进而导致用户使用受阻,系统不稳定。Because in the cloud storage system, a user's account generally has multiple storage spaces, and from the perspective of the current main distributed current limiting methods, the current limiting services in each distributed system usually affect the user's storage space. The space is configured with flow control quotas, or directly allocates the total quota shared by all storage spaces to users. However, the specific use of storage space and flow control quotas by users cannot be predicted in the system. Therefore, a single storage space level or a single storage space Configuring flow control quotas based on user levels will make the current limiting policy unsuitable for a large number of users with diverse traffic usage conditions, and it will not be possible to precisely control the overall system traffic, which will block users and cause the system to become unstable.

因此本申请实施例提供一种流量控制方法,通过同时对数据访问端的用户流控配额和各存储空间流控配额进行配置,根据存储空间的流量数据是否满足存储空间流控配额,且用户总共使用的流量数据是否满足用户流控配额,来确定对数据访问端进行的流量控制策略,可以解决上述流量控制不精确、系统整体不稳定的技术问题。Therefore, the embodiment of the present application provides a flow control method. By configuring the user flow control quota of the data access end and the flow control quota of each storage space at the same time, according to whether the flow data of the storage space meets the storage space flow control quota, and the user uses a total of Whether the flow data meets the user flow control quota is used to determine the flow control strategy for the data access terminal, which can solve the above technical problems of inaccurate flow control and overall system instability.

请参阅图1,图1为本申请实施例提供的一种流量控制方法的示例性系统架构图。Please refer to FIG. 1. FIG. 1 is an exemplary system architecture diagram of a traffic control method provided by an embodiment of the present application.

如图1所示,系统架构可以包括数据访问端101、网络102和服务器103。网络102用于在数据访问端101和服务器103之间提供通信链路的介质。网络102可以包括各种类型的有线通信链路或无线通信链路,例如:有线通信链路包括光纤、双绞线或同轴电缆的,无线通信链路包括蓝牙通信链路、无线保真(Wireless-Fidelity,Wi-Fi)通信链路或微波通信链路等。As shown in FIG. 1 , the system architecture may include a data access terminal 101 , a network 102 and a server 103 . The network 102 is a medium for providing 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: wired communication links include fiber optic, twisted pair or coaxial cables, wireless communication links include Bluetooth communication links, wireless fidelity ( Wireless-Fidelity, Wi-Fi) communication link or microwave communication link, etc.

数据访问端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 to receive messages sent by other users to the server 103. message or data. The data access terminal 101 may 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 computers, and desktop computers. When the data access terminal 101 is software, it can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules (for example, used to provide distributed services), or 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 composed of multiple servers, or 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, used to provide distributed services), or may be implemented as a single software or software module, which is not specifically limited herein.

应理解,图1中的数据访问端、网络以及服务器的数目仅是示意性的,根据实现需要,可以是任意数量的数据访问端、网络以及服务器。It should be understood that the numbers of data access terminals, networks and servers in FIG. 1 are only illustrative, and may be any number of data access terminals, networks and servers according to implementation requirements.

请参阅图2,图2为本申请实施例提供的一种流量控制方法的流程示意图。本申请实施例的执行主体可以是执行流量控制方法的服务器,可以是执行流量控制方法的服务器中的处理器,还可以是执行流量控制方法的服务器中的流量控制服务。为方便描述,下面以执行主体是服务器中的处理器为例,介绍流量控制方法的具体执行过程。Please refer to FIG. 2 , which is a schematic flowchart of a flow control method provided by an embodiment of the present application. The execution body of the embodiment of the present application may 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 following describes the specific execution process of the flow control method by taking the execution subject being the processor in the server as an example.

如图2所示,流量控制方法应用于数据被访问端,数据被访问端中设置有数据访问端对应的至少两个存储空间,流量控制方法至少可以包括:As shown in Figure 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, and the flow control method may at least include:

S201、响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间的存储空间流控配额以及用户流控配额。S201. In response 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.

可选地,用户在通过互联网互联网中的网站、存储服务、资源数据库等包含大量数据信息的网络服务实现需求时,那么用户端作为数据访问端会向目标服务的服务器发出大量的数据访问请求,这些数据访问请求到达数据被访问端时会产生对应的流量,为了保证数据被访问端的稳定运行,需要对产生的流量进行控制,使得其不至于影响数据被访问端的负载能力和计算能力。Optionally, when a user fulfills a demand through a network service that contains a large amount of data information, such as a website, storage service, resource database, etc. in the Internet, the user terminal, as the data access terminal, will send a large number of data access requests to the server of the target service, When these data access requests reach the data access end, corresponding traffic will be generated. In order to ensure the stable operation of the data access end, the generated traffic needs to be controlled so that it will not affect the load capacity and computing power of the data access end.

可选地,在对用户进行流量使用控制时,可以预先为用户配置其可用的流控配额,而为了满足用户的使用需求,通常在一个数据访问端的用户级别下存在至少两个存储空间,而各存储空间都可以有对应的流量使用配额,那么在配置流控配额时,若直接对数据访问端的各存储空间配置流控配额,那么各存储空间只能使用各自的流控配额无法在其余存储空间的流量较小时使用更多占比的配额,若各存储空间的配额都较小时则无法满足用户的使用需求,各存储空间的配额都较大时则导致用户的总体流控配额较高对系统造成影响,而无法提前预知用户对各存储空间的使用情况,也就不便于对各存储空间配置最合适的配额。Optionally, when the flow usage control is performed on the user, the available flow control quota can be pre-configured for the user, and in order to meet the usage requirements of the user, there are usually at least two storage spaces at the user level of a data access end, and Each storage space can have a corresponding traffic usage quota. When configuring a flow control quota, if you directly configure a flow control quota for each storage space on the data access end, each storage space can only use its own flow control quota and cannot be used in other storage spaces. When the traffic of the space is small, a larger proportion of the quota is used. 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 overall flow control quota of the user will be higher. The system will affect the system, and the user's usage of each storage space cannot be predicted in advance, so 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 the user is also limited, you can configure the flow control quota at the user level while configuring the flow control quota for each storage space. , so that it controls the flow of the data sender 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, you need to configure the flow control quota first. You can configure the user flow control quota of all users and the flow control quota of each storage space in the service and registration components.

进一步地,配置用户流控配额和各存储空间流控配额时,由于有用户流控配额来对数据访问端的总体流量进行限制,那么各存储空间流控配额可以适当较大,具体地,可以配置用户流控配额大于任意一个存储空间流控配额,且用户流控配额小于所有存储空间流控配额之和。例如,当数据访问端对应有存储空间A、存储空间B时,可以将用户流控配额配置为10,存储空间A流控配额配置为5,存储空间B流控配额配置为6,那么当数据访问请求占用了存储空间A中的5个流控配额,那么此时就仅能够使用存储空间B中5个流控配额,在基于存储空间流控配额对产生的流量进行比较之后,再基于用户流控配额对整体产生的流量进行比较,从而实现存储空间和用户两种级别的流量控制。需要注意的是,在示例中用于举例的数值仅表示对应配额的大小关系,不表示实际意义和实际单位。Further, when configuring the user flow control quota and the flow control quota of each storage space, 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, it can be configured The user flow control quota is greater than any one storage space flow control quota, and the user flow control quota is less 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 10, the flow control quota of storage space A to 5, and the flow control quota of storage space B to 6. The access request occupies 5 flow control quotas in storage space A, then only 5 flow control quotas in storage space B can be used at this time. The flow control quota compares the overall generated traffic, so as to implement traffic control at the storage space and user levels. It should be noted that the numerical values used for examples in the examples only represent the size relationship of the corresponding quotas, and do not represent actual meanings and actual units.

可选地,当系统用于给用户提供服务时,用户可通过注册账号来获得自己使用该服务的流控配额,并且为了便于配置,各用户账号下被配置的初始流控配额均相同,而用户可通过升级等操作来修改账号下的流控配额,以获取满足自己使用需求的流控配额,其中通过用户操作获取的流控配额使用优先级高于默认配置的初始流控配额。Optionally, when the system is used to provide services to users, users can obtain their own flow control quotas for using the service by registering an account, and for ease of configuration, the initial flow control quotas configured under each user account are the same, and Users can modify the flow control quota under the account by upgrading and other operations to obtain the flow control quota that meets their own needs. The use priority of the flow control quota obtained through user operations is higher 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 components, in order to facilitate the data access end to receive a data access request, directly based on the flow control quota to the data access end. For flow control, you can set the data access terminal to obtain and save the storage space flow control quota and user flow control quota corresponding to all users from the service and registration components at preset intervals. In a feasible embodiment, an S3 service (Simple Storage Service, S3) component can be selected as the data accessed end, and the S3 service component can provide users with access services, compatible with the S3 protocol interface, and users can use The SDK of the S3 protocol is convenient for data storage operations.

为了方便描述,请参阅图3,图3为本申请实施例提供的一种流量控制方法的流程结构图。如图3所示,流程结构图中包括数据访问端310,服务与注册组件320,S3服务组件330,存储空间流量控制模块340,用户流量控制模块350。For the convenience of description, please refer to FIG. 3 , which is a flowchart structure diagram of a flow control method provided by an embodiment of the present application. As shown in FIG. 3 , the flow structure diagram 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对应的用户流量控制。Wherein, 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 terminal 310 sends When the data access request is sent to the data access end, that is, the S3 service component 330, the S3 service component 330 first responds to the data access request, and then controls the storage space flow corresponding to the data access end 310 through the storage space flow control module 340, and through the storage space flow control module 340. The user flow control module 350 performs user flow control corresponding to the data access terminal 310 .

可选地,为了同时服务来自用户的多个请求,数据被访问端中设置有多个服务节点,进而可以为数据访问请求分配至少一个服务节点,服务节点越多,数据被访问端能够同时响应的数据访问请求就越多,并且服务节点的个数可以进行扩展,便于根据用户体量和请求量进行调整。因此可以先查找到可用的服务节点,将同一数据访问端的所有数据访问请求分配至各服务节点。同时,根据数据访问请求所对应的数据访问端标识,数据被访问端可以从本地直接获取数据访问端对应的各存储空间流控配额以及用户流控配额,以便于后续基于流控配额和产生的流量对数据访问端进行流量控制。Optionally, in order to serve multiple requests from users at the same time, multiple service nodes are set in the data access end, and then at least one service node can be allocated for the data access request. The more service nodes, the more the data access end can respond to at the same time. The more data access requests, and the number of service nodes can be expanded, it is easy to adjust according to the user volume and request volume. Therefore, an available service node 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 each storage space flow control quota and user flow control quota corresponding to the data access terminal locally, so as to facilitate the subsequent flow control quota and generated Traffic controls the flow of data access terminals.

需要注意的是,对于所有服务节点,会定时向各服务节点发送极小的数据包作为心跳信号,用以请求各服务节点在能够正常工作时返回心跳,若服务节点返回心跳的时长超过预设阈值或无法返回心跳,则认为该服务节点无法继续响应数据访问请求,并在服务节点目录中将该服务节点即为不可用服务节点,避免为其继续分发数据访问请求,导致数据访问请求无法正常执行。It should be noted that for all service nodes, a very small data packet will be periodically sent to each service node as a heartbeat signal to request each service node to return a heartbeat when it can work normally. If the service node returns a heartbeat longer than the preset time If the threshold value or the heartbeat cannot be returned, it is considered that the service node cannot continue to respond to data access requests, and the service node is regarded as an unavailable service node in the service node directory, so as to avoid continuing to distribute data access requests for it, resulting in abnormal data access requests. implement.

S202、控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据。S202: Control each service node to respectively record each storage space traffic data and user traffic data generated when the data access terminal performs data access based on the data access request.

可选的,控制各服务节点分别接收到数据访问请求时,能够基于各数据访问请求对应的多种属性来计算数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据并将各流量数据进行分别记录,其中,所有存储空间流量数据之和等于用户流量数据。各服务节点可以记录流量数据和流量数据相关属性,例如可以记录到流量数据对应的存储空间、接口、种类等,这就便于各服务节点基于流量数据的多种属性来判断多方面的流量情况,并针对不同的情况来实行不同的流量控制策略。Optionally, when each service node is controlled to receive a data access request, it can calculate, based on various attributes corresponding to each data access request, each storage space traffic data and user traffic generated when the data access terminal performs data access based on the data access request. data and record each traffic data separately, wherein the sum of all storage space traffic data is equal to user traffic data. Each service node can record traffic data and related attributes of the traffic data, for example, the storage space, interface, type, etc. corresponding to the traffic data can be recorded, which is convenient for each service node to judge various traffic conditions based on various attributes of the traffic data. And according to different situations to implement different flow control strategies.

可选地,为了进行流量控制,各服务节点分别记录到各存储空间流量数据和用户流量数据之后,还需要根据流量数据来更新对应的流控配额,将流控配额更新为使用了相应数据流量的流控余额,并将流控余额用于本轮次流量控制流程中后续访问请求的处理。Optionally, in order to perform traffic control, after each service node records each storage space traffic data and user traffic data respectively, it is also necessary to update the corresponding traffic control quota according to the traffic data, and update the traffic control quota to use the corresponding data traffic. The flow control balance will be used for the processing of subsequent access requests in this round of flow control process.

进一步地,为了便于后续进行流量控制,各服务节点可以依据本节点所产生的流量数据来直接进行流量控制条件判断,还可以基于所有服务节点记录的流量数据进行流量控制条件判断时,此时就可以使用一个中间件来实现记录所有服务节点的流量数据,各服务节点获取所有服务节点统一的流量数据,便于后续基于整体流量数据来分析数据访问端的流量情况。Further, in order to facilitate the subsequent flow control, each service node can directly judge the flow control conditions according to the flow data generated by the node, and can also judge the flow control conditions based on the flow data recorded by all service nodes. A middleware can be used to record the traffic data of all service nodes, and each service node obtains the unified traffic data of all service nodes, which is convenient for subsequent analysis of the traffic situation of the data access terminal based on the overall traffic data.

S203、控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制。S203: Control 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 user flow control quota.

可选地,控制各服务节点分别记录产生的各存储空间流量数据以及用户流量数据之后,就可以基于预先获取到的各存储空间流控配额以及用户流控配额,来判断当前流量使用情况时是否确定对数据访问端进行流量控制。Optionally, after controlling each service node to record the generated storage space flow data and user flow data respectively, it is possible to determine whether the current flow usage is based on the pre-obtained storage space flow control quota and user flow control quota. Determine the flow control on the data access side.

具体地,各存储空间有对应的流控配额和本次数据访问请求产生的流量数据,用户有对应的流控配额和本次数据访问请求产生的流量数据,那么在进行流量控制判断时,可以对各存储空间和用户分别制定流控条件,其中当存储空间流控配额不足够支持其对应的存储空间流量数据时,认为满足第一流控条件,则控制各服务节点对数据访问端进行第一流量控制;当各存储空间流量数据与其对应的存储空间流控配额不满足第一流控条件,且用户流控配额不足够支持用户流量数据时,认为用户流量数据与用户流控配额满足第二流控条件,则控制各服务节点对数据访问端进行第二流量控制。这样将各存储空间级别的流量控制制定为第一流量控制,将用户级别的流量控制制定为不触发各存储空间级别的第一流量控制时的第二流量控制,实现了各存储空间下对所有用户流控配额的共享与统一控制,这样的流量控制结果将更加精确和稳定,不仅嘉庆了系统稳定性,也提高了用户的服务使用体验。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, you can Flow control conditions are formulated for each storage space and user respectively. When the storage space flow control quota is not enough to support its 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. Flow control; 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 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 satisfy the second flow control If the control conditions are met, each service node is controlled to perform second flow control on the data access terminal. In this way, the flow control of each storage space level is set as the first flow control, and the flow control of the user level is set as the second flow control when the first flow control of each storage space level is not triggered, which realizes the control of all storage spaces under each storage space. The sharing and unified control of user flow control quota, such flow control results will be more accurate and stable, which not only improves the system stability, but also improves the service experience of users.

在本申请实施例中,提供一种流量控制方法,响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间流控配额以及用户流控配额;控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制。由于在本申请实施例中,同时对数据访问端的用户级别和各存储空间级别都配置了相应的流控配额,且在对数据访问端进行流量控制时,同时考虑各存储空间所产生的流量以及用户账户下产生的所有流量,并将其与各自对应的流控配额进行对比,这样同时控制用户级别的流量和各存储空间的流量,最终可以对数据访问端进行多个层级的统一流控,实现更精确、稳定的流量控制。In the 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 each storage space flow control quota and user flow control quota corresponding to the data access end; The service node records the storage space flow data and user flow data generated when the data access terminal performs data access based on the data access request. Flow control quota, which controls the flow of data access terminals. Because in the embodiment of the present application, corresponding flow control quotas are configured for both the user level of the data access end and each storage space level, and when the data access end is flow controlled, the traffic generated by each storage space and the All traffic generated under the user account is compared with their corresponding flow control quotas, so that the user-level traffic and the traffic of each storage space can be controlled at the same time, and finally, multiple levels of unified flow control can be performed on the data access end. Achieve more precise and stable flow control.

请参阅图4,图4为本申请实施例提供的一种流量控制方法的流程示意图。Please refer to FIG. 4 , which is a schematic flowchart of a flow control method provided by an embodiment of the present application.

如图4所示,流量控制方法至少可以包括:As shown in FIG. 4 , the flow control method may at least include:

S401、响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间流控配额以及用户流控配额。S401. In response to the data access request, allocate at least one service node for the data access request, and obtain 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 concurrent quota of each storage space and the concurrent quota of the user corresponding to the data access terminal to each service node, and obtain the concurrent quota of each storage space node corresponding to each service node and the concurrent quota of each user node.

可选地,通过上述实施例的介绍可以知道,为了同时响应尽可能多的数据访问请求,为数据访问请求分配了多个服务节点,而为了均衡各服务节点的处理压力,可以将来自同一数据访问端的数据访问请求均摊分配给服务节点,保证各服务节点接收到的数据访问请求数量相同,进而确保各服务节点的处理压力稳定。Optionally, it can be known from the introduction of the above embodiment that in order to respond to as many data access requests as possible at the same time, multiple service nodes are allocated for data access requests, and in order to balance the processing pressure of each service node, data from the same The data access requests of the access end are evenly distributed to the service nodes to ensure that the number of data access requests received by each service node is the same, thereby ensuring that the processing pressure of each service node is stable.

可选地,数据访问请求所产生的流量种类是多种的,其中包括并发流量,同一数据访问端在同一时间发出的多个数据访问请求为并发请求,将数据访问请求均摊给各服务节点时,在各服务节点上会同时进行相同数量的多个并发数据访问请求,为了保证各服务节点能够正常处理接收到的并发数据访问请求,并且不影响各服务节点继续对其他数据访问请求进行响应,在对用户的存储空间流控配额、用户流控配额进行配置时,可以在存储空间流控配额中具体配置存储空间并发配额、在用户流控配额中具体配置用户并发配额,使得各服务节点可以根据各存储空间并发配额和用户并发配额来判断接收到的数据访问请求的并发流量是否满足正常工作条件。Optionally, there are various types of traffic generated by data access requests, including concurrent traffic. Multiple data access requests sent by the same data access terminal at the same time are concurrent requests. When data access requests are evenly distributed to each service node , the same number of concurrent data access requests will be made on each service node at the same time. In order to ensure that each service node can normally process the received concurrent data access request, and does not affect each service node to continue to respond to other data access requests, When configuring the user's storage space flow control quota and user flow control quota, you can configure the storage space concurrent quota in the storage space flow control quota and the user concurrency quota in the user flow control quota, so that each service node can According to the concurrent quota of each storage space and the concurrent quota of users, it is judged whether the concurrent traffic of the received data access request meets the normal working conditions.

进一步地,由于并发的数据访问请求是均摊到各服务节点中的,那么可以将数据访问端对应的各存储空间并发配额以及用户并发配额也均摊至各服务节点,得到各服务节点对应的各存储空间节点并发配额以及各用户节点并发配额,这样各服务节点可以根据本节点产生的并发流量和本节点对应的流控配额直接对数据访问请求的流量情况进行判断。Further, since the concurrent data access requests are evenly distributed to each service node, the concurrent storage space quota and user concurrent quota corresponding to the data access terminal can also be equally distributed to each service node, so as to obtain each storage space corresponding to each service node. The concurrent quota of space nodes and the concurrent quota of each user node, so that each service node can directly judge the traffic situation of data access requests according to the concurrent traffic generated by this node and the corresponding flow control quota of this node.

S403、控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间并发数据以及用户并发数据。S403: Control each service node to separately record the concurrent data of each storage space and the concurrent data of users generated when the data access terminal 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, when receiving the concurrent data access request allocated to this node, to process the generated data for each storage space node. Space concurrent data and user concurrent data are recorded separately.

可选地,由于大多数据访问请求会包含多个线程,例如,一般修改一个代码的值会有3步线程:读取、修改、回写,而在这些线程的处理过程中,可能会出现其他请求的线程突然占用资源,导致原请求无法得到正确的结果,此时,可以基于原子变量来计算各数据访问请求的并发数据,原子变量可以将对一个变量值的读取、修改、回写变成一个不可打断的操作,基于此,就可以通过原子操作来使得对于某一请求就只有一个线程操作它,原子操作中线程不会被切换,线程切换要么在原子操作之前,要么在原子操作完成之后,这样各服务节点中的并发数据都为整值,不会出现中间处理状态,从而避免各服务节点资源不互通的情况下的资源竞争,最终实现稳定的并发资源获取和释放。Optionally, since most data access requests will involve multiple threads, for example, generally modifying the value of a code will have three threads: read, modify, and write back. During the processing of these threads, other threads may appear. The requested thread suddenly occupies resources, so that the original request cannot get the correct result. At this time, the concurrent data of each data access request can be calculated based on the atomic variable. The atomic variable can read, modify, and write back the value of a variable. It becomes an uninterruptible operation. Based on this, atomic operations can be used to make only one thread operate on a request. Threads will not be switched during atomic operations. Thread switching is either before the atomic operation or after the atomic operation. After completion, 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 finally 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, control each service node 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 its corresponding storage space When the node concurrency quota is set, and the concurrent data of any user is greater than its corresponding user node concurrency quota, each service node is controlled to reject and return the data access request to the data access terminal.

可选地,各服务节点获取对应的各存储空间节点并发配额以及各用户节点并发配额,并且记录了产生的各存储空间并发数据以及用户并发数据之后,就可以控制各服务节点基于本节点对应的各存储空间并发数据、各存储空间节点并发配额、用户并发数据、用户节点并发配额,来对存储空间级别下的流量情况进行判断,以及对用户级别下的流量情况进行判断。Optionally, after each service node obtains the corresponding concurrent quota of each storage space node and each user node, and records the generated concurrent data of each storage space and user concurrent data, it can control each service node based on the corresponding data of this node. The concurrent data of each storage space, the concurrent quota of each storage space node, the concurrent data of users, and the concurrent quota of user nodes are used to judge the traffic situation at the storage space level and the traffic situation at the user level.

可选地,各服务节点记录到的并发数据大于对应的并发配额时,则认为当前用户的数据访问请求的并发数量超过用户的配额,而各服务节点都将对数据访问端实行流量控制,具体地,当任一存储空间并发数据大于其对应的存储空间节点并发配额时,则控制各服务节点拒绝并返回数据访问请求至数据访问端;当各存储空间并发数据小于或者等于其对应的存储空间节点并发配额时,且任一用户并发数据大于其对应的用户节点并发配额,则控制各服务节点拒绝并返回数据访问请求至数据访问端。这样可以从各服务节点对数据访问端的并发流量进行精确控制,保证了系统高并发的稳定性。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 data access requests of the current user exceeds the user's quota, and each service node will implement flow control on the data access terminal. When the concurrent data of any storage space is greater than the concurrent quota of its corresponding storage space node, control each service node 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 its corresponding storage space When the node concurrency quota is set, and the concurrent data of any user is greater than its corresponding user node concurrency quota, each service node is controlled to reject and return the data access request to the data access terminal. In this way, the concurrent traffic of the data access terminal can be precisely controlled from each service node, which ensures the high concurrency stability of the system.

可以理解的,当数据访问端的数据访问请求所产生的并发流量信息触发并发流量控制时,各服务节点拒绝并返回数据访问请求至数据访问端时,可以不再对数据访问请求进行响应以及后续处理,而是生成对应的拒绝信息,并将拒绝信息、访问请求以及访问请求携带的数据发送至数据访问端,其中,拒绝信息可以用于提示数据访问端注意流量控制情况,便于数据访问端对数据访问请求进行调整和后续请求操作。It is understandable that when the concurrent flow information generated by the data access request of the data access end triggers concurrent flow control, and each service node rejects and returns the data access request to the data access end, it can no longer respond to the data access request and follow-up processing. , but generates corresponding rejection information, and sends the rejection information, the access request and the data carried by the access request to the data access terminal, where the rejection information can be used to prompt the data access terminal to pay attention to the flow control situation, so that the data access terminal can verify the data Access requests for adjustments and subsequent request actions.

在本申请实施例中,提供一种流量控制方法,首先将数据访问请求均摊给各服务节点,并将各存储空间并发配额以及用户并发配额均摊至各服务节点,各服务节点根据本节点接收到的数据访问请求对应的并发数据和分配给本节点的并发配额,基于原子变量的计算方式,来对本节点的并发资源进行获取和释放,实现了基于存储空间级别和用户级别的两种层级的精确并发流量控制,保证了系统高并发的整体可用性,加强了系统运行的稳定性。In the embodiment of the present application, a flow control method is provided. First, data access requests are equally distributed to each service node, and each storage space concurrent quota and user concurrent quota are equally distributed to each service node. The concurrent data corresponding to the data access request and the concurrent quota allocated to the node, the concurrent resources of the node are acquired and released based on the calculation method of atomic variables, and the accuracy of the two levels based on the storage space level and the user level is realized. Concurrent flow control ensures the overall availability of the system with high concurrency and enhances the stability of the system operation.

请参阅图5,图5为本申请实施例提供的一种流量控制方法的流程示意图。Please refer to FIG. 5 , which is a schematic flowchart of a flow control method provided by an embodiment of the present application.

如图5所示,流量控制方法至少可以包括:As shown in Figure 5, the flow control method may include at least:

S501、响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间流控配额以及用户流控配额。S501. In response to the data access request, assign at least one service node to the data access request, and obtain 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 separately 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 various types of traffic generated by data access requests, including bandwidth traffic, the "highest data rate" that can pass from a certain point in the network to another point in a unit time, that is, in a unit of time. The amount of data that can be transmitted within a time period, the bandwidth and traffic size of the data access request on the data access side will directly affect the processing time of the request. Excessive bandwidth will cause more processing resources to be occupied for a long time, and too small bandwidth will The usage requirements of the data access end cannot be met. Therefore, when configuring the flow control quota of each storage space on the data access end, you can configure the corresponding storage space bandwidth quota. When configuring the user flow control quota, configure the user bandwidth quota to consider data access. The bandwidth traffic generated by the request, and the abnormal bandwidth traffic is controlled.

可选地,带宽流量与请求数量并没有直接关系,在每个请求到达的时间点都计算带宽流量会导致计算非常频繁,因此带宽流量的计算一般是在预设时间窗口内进行统计,这样就允许该时间窗口内的带宽配额可以由数据访问请求分配共享。进而可以在预设时间窗口内,控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间带宽数据以及用户带宽数据。预设时间窗口的设置可以根据数据访问端以及数据访问请求的体量来具体设置,例如,可以以10秒为一个时间窗口,本申请对此不作限定。Optionally, the bandwidth traffic is not directly related to the number of requests. Calculating the bandwidth traffic at the time when each request arrives will result in very frequent calculations. Therefore, the calculation of the bandwidth traffic is generally performed within a preset time window, so that the The bandwidth quota within this time window is allowed to be shared by data access request allocation. Further, within a preset time window, each service node can be controlled to record the respective storage space bandwidth data and user bandwidth data generated when the data access terminal performs data access based on the data access request. The setting of the preset time window may be specifically set according to the data access terminal and the volume of the data access request. For example, 10 seconds may be used as a time window, which is not limited in this application.

进一步地,由于不同数据访问请求所产生的带宽流量数据会不相同,那么由各服务节点来直接对本节点的带宽流量进行分析就会导致数据访问端的带宽资源利用不完全或利用混乱,因此在控制各服务节点进行带宽数据记录时,可以采用一种分布式缓存组件,分布式缓存组件可以支持所有服务节点将自身产生的流量数据记录进分布式缓存组件中,并且对该类流量数据进行统一计算,实现对所有服务节点中接收到的所有数据访问请求所产生流量数据的整体分析。需要注意的是,分布式缓存组件中并不存在所有用户的各存储空间带宽配额以及用户带宽配额,那么各服务节点在初次记录某数据访问端产生的带宽流量时,会将该数据访问端对应的各存储空间带宽配额以及用户带宽配额存储进分布式缓存组件中,便于分布式缓存组件对已使用的流量配额进行记录、对比。Further, since the bandwidth traffic data generated by different data access requests will be different, the direct analysis of the bandwidth traffic of this node by each service node will lead to incomplete or chaotic utilization of bandwidth resources at the data access end. When each service node records 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 calculation on this type of traffic data. , to realize the overall analysis of the traffic data generated by all data access requests received in all service nodes. It should be noted that there is no storage space bandwidth quota and user bandwidth quota for all users in the distributed cache component. When each service node records the bandwidth traffic generated by a data access terminal for the first time, it will correspond to the data access terminal. The bandwidth quota of each storage space and the user bandwidth quota are stored in the distributed cache component, which is convenient for the distributed cache component to record and compare the used traffic quota.

为了方便描述,请参阅图6,图6为本申请实施例提供的一种分布式缓存组件的控制流程图。如图6所示,各服务节点610记录各存储空间带宽数据以及用户带宽数据至分布式缓存组件620中,进而各服务节点610可以在分布式缓存组件620中获知其余服务节点所接收数据访问请求产生的带宽数据,便于后续各服务节点610依据所有数据访问请求的总体带宽使用情况对数据访问端进行流量控制。For convenience of description, please refer to FIG. 6 , which is a control flowchart of a distributed cache component provided by an embodiment of the present application. As shown in FIG. 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 learn the data access requests received by other service nodes in the distributed cache component 620 The generated bandwidth data is convenient for subsequent service nodes 610 to perform flow control on the data access terminal according to the overall bandwidth usage of all data access requests.

可选地,分布式缓存组件可以有多种具体选择,一种可行的实施方式中,可以选择Redis(Remote Dictionary Server,远程数据服务)作为分布式缓存组件进行应用,Redis支持主从同步,数据可以从主服务器向任意数量的从服务器上同步,可以提高网站吞吐量,提高网站运行效率用来减轻对数据库访问压力。Optionally, the distributed cache component can have various specific choices. In a feasible implementation manner, Redis (Remote Dictionary Server, remote data service) can be selected as the distributed cache component for application. Redis supports master-slave synchronization, data It can be synchronized from the master server to any number of slave servers, which can improve website throughput, improve website operation efficiency and reduce the pressure on database access.

另外地,数据访问请求所产生的流量中对系统计算压力影响较大的,还包括每秒请求量(Query Per Second,QPS),对一个特定的查询服务器在规定时间内所处理流量多少的衡量标准,因此数据访问请求所产生的QPS流量也需要要预设时间周期内对所有数据访问请求进行统计,才能够实现一个较好的衡量作用,基于此,可以参照带宽配额以及带宽数据记录的实施方法,在配置数据访问端的各存储空间流控配额时可以具体配置对应的各存储空间每秒请求配额,配置用户流控配额时具体配置用户每秒请求配额,并控制各服务节点将各存储空间每秒请求配额以及用户每秒请求配额存储至分布式缓存组件中,且将产生的各存储空间每秒请求数据以及用户每秒请求数据时记录在分布式缓存组件中。In addition, the traffic generated by data access requests has a greater impact on the computing pressure of the system, including the request per second (Query Per Second, QPS), which is a measure of how much traffic a specific query server handles within a specified time. Therefore, the QPS traffic generated by data access requests also needs to be counted on all data access requests within a preset time period to achieve a better measure. Based on this, you can refer to bandwidth quotas and bandwidth data records. method, when configuring the flow control quota of each storage space on the data access end, you can configure the corresponding request quota per second of each storage space, and when configuring the user flow control quota, configure the user request quota per second, and control each service node to allocate each storage space. The per-second request quota and the user's per-second request quota are stored in the distributed cache component, and the generated data requested per second by each storage space and the time when the user requests data per second are recorded 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 the remaining amount of each storage space bandwidth, and deduct the user bandwidth quota based on each user bandwidth data to obtain the remaining amount of user bandwidth.

可选地,各服务节点分别记录各存储空间带宽数据以及用户带宽数据至分布式缓存组件之后,可以控制各服务节点基于分布式缓存组件中存储的各存储空间带宽数据对各存储空间带宽配额进行扣减,得到各存储空间带宽剩余额,并将各存储空间带宽剩余额作为本时间窗口内下一次服务节点扣减的基准;以及控制各服务节点基于各用户带宽数据对用户带宽配额进行扣减,得到用户带宽剩余额,并将用户带宽剩余额作为本时间窗口内下一次服务节点扣减的基准。Optionally, after each service node records each storage space bandwidth data and user bandwidth data to the distributed cache component respectively, it can control each service node to perform a calculation of each storage space bandwidth quota based on each storage space bandwidth data stored in the distributed cache component. Deduction to obtain the remaining amount of bandwidth of each storage space, and use the remaining amount of bandwidth of each storage space as the benchmark for the next service node deduction within this time window; and control each service node to deduct the user bandwidth quota based on the bandwidth data of each user , obtain the remaining amount of user bandwidth, and use the remaining amount of user bandwidth as the benchmark for the next service node deduction within this time window.

可选地,从上述实施例可以知道,各服务节点对于数据访问请求的每秒请求数据的记录与带宽数据记录流程一样,那么同样的,可以控制各服务节点基于分布式缓存组件中存储的各存储空间每秒请求数据对各存储空间每秒请求配额进行扣减,得到各存储空间每秒请求剩余额,并将各存储空间每秒请求剩余额作为本时间窗口内下一次服务节点扣减的基准;以及控制各服务节点基于各用户每秒请求数据对用户每秒请求配额进行扣减,得到用户每秒请求剩余额,并将用户每秒请求剩余额作为本时间窗口内下一次服务节点扣减的基准。Optionally, it can be known from the above embodiment that the process of recording the requested data per second for data access requests by each service node is the same as that of recording bandwidth data. The data requested per second of the storage space is deducted from the request quota per second of each storage space to obtain the remaining amount of requests per second of each storage space, and the remaining amount of requests per second of each storage space is used as the deduction of the next service node within this time window. Benchmark; and control each service node to deduct the user’s per-second request quota based on the per-second request data of each user, obtain the user’s per-second request balance, and use the user’s per-second request balance as the next service node deduction within this time window. reduced benchmark.

进一步地,每一次服务节点在分布式缓存组件中进行流量数据的记录和扣减时,都会对分布式缓存组件发起访问与请求,那么为了减少对分布式缓存组件的访问压力,可以提前根据数据访问端标识从分布式缓存组件预取一部分的各存储空间流控配额以及用户流控配额至本地内存中,服务节点所产生的流量数据就优先使用预取到本地的流控配额资源,本地预取流控配额资源使用完后,再将流量数据记录到分布式缓存组件中,实现减小分布式缓存组件的访问压力和处理压力。当分布式缓存组件由于网络、流量等不可控原因出现响应超时时,则将数据访问端的各存储空间流控配额以及用户流控配额都进行均摊给各服务节点,由各服务节点进行单机限流,依据本节点的流量数据和配额进行流量控制。Further, each time the service node records and deducts traffic data in the distributed cache component, it will initiate an access and request to the distributed cache component, so in order to reduce the access pressure to the distributed cache component, you can The access terminal identifier prefetches a part of the flow control quota of each storage space and the user flow control quota from the distributed cache component to the local memory, and the traffic data generated by the service node will preferentially use the prefetched local flow control quota resources. After the flow control quota resource is used up, the flow data is recorded in the distributed cache component to reduce the access pressure and processing pressure of the distributed cache component. When the response of the distributed cache component times out due to uncontrollable reasons such as network and traffic, the flow control quota of each storage space and user flow control quota of the data access end are equally distributed to each service node, and each service node performs stand-alone current limiting. , and control the flow according to the flow 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. Due to the limited load capacity of the data access end, the service node receives the request as the data access end and generates a large number of For the interface of traffic, in order to ensure that the traffic entering the service node will not cause excessive system pressure and drag down the overall system of the data accessed end, it is also necessary to control the flow of various interfaces used by users. Interfaces with different functions include various types of interfaces. For example, different functional interfaces include upload interfaces, download interfaces, etc. The upload interfaces include ordinary upload interfaces, copy upload interfaces, slice upload interfaces, form upload interfaces, and other types of upload interfaces. , corresponding to different upload methods.

可选地,为了方便本申请描述,以上传功能接口以及各不同上传方式接口进行说明,其他功能接口的限流方式同理,不再赘述。在通常的上传接口限速中,只能分别对各不同类上传接口分别就进行配额限速,而无法实现统一功能接口下的配额共享,因此在进行流控配额配置时,可以为用户具体配置各存储空间接口配额以及用户接口配额,而在各存储空间接口配额中配置各存储空间当前接口配额和各存储空间统一接口配额,在用户接口配额中配置用户当前接口配额和用户统一接口配额,其中用户和存储空间级别下的当前接口配额与统一接口配额的关系为:统一接口配额大于任一当前接口配额,且各当前接口配额之和大于统一接口配额,而接口的流量控制策略也与用户几杯和存储级别的统一控制相同,各当前接口流量数据大于对应的当前接口流控配额时,进行流量控制;各当前接口流量数据不大于对应的当前接口流控配额,且统一接口流量数据大于统一接口流控配额时,进行流量控制。Optionally, in order to facilitate the description of this application, the upload function interface and the interfaces of different upload methods are used for description, and the current limiting methods of other function interfaces are the same, and will not be described again. In the usual upload interface speed limit, the quota speed limit can only be implemented for different types of upload interfaces respectively, and the quota sharing under the unified function interface cannot be realized. Therefore, when configuring the flow control quota, you can configure it for the user. Each storage space interface quota and user interface quota, and the current interface quota of each storage space and the unified interface quota of each storage space are configured in the interface quota of each storage space, and the current interface quota of the user and the unified interface quota of the user are configured in the user interface quota. The relationship between the current interface quota at the user and storage space level and the unified interface quota 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 traffic control policy of the interface is also different from that of the user. The unified control of the cup and storage levels is the same. When the traffic data of each current interface is greater than the corresponding current interface flow control quota, flow control is performed; the current interface traffic data is not greater than the corresponding current interface flow control quota, and the unified interface traffic data is greater than the unified interface flow control quota. When the interface flow control quota is set, flow control is performed.

进一步地,在具体的流量数据记录过程中,控制各服务节点基于各存储空间带宽数据中的各存储空间接口数据,对各存储空间带宽配额中各存储空间接口配额进行扣减,得到各存储空间接口剩余额;控制各服务节点基于各用户带宽数据中的各用户接口数据对用户带宽配额中的用户接口配额进行扣减,得到用户接口剩余额。其中,各存储空间内的扣减流程为首先扣减存储空间当前接口流控配额,再扣减存储空间统一接口流控配额;用户层级内的扣减流程为首先扣减用户当前接口流控配额,再扣减用户统一接口流控配额。Further, in the specific traffic 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, and obtain each storage space. Interface surplus; control each service node to deduct the user interface quota in the user bandwidth quota based on the user interface data in the user bandwidth data to obtain the user interface surplus. 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 user's current interface flow control quota , and then deduct the user's unified interface flow control quota.

请参阅图7,图7为本申请实施例提供的一种上传接口的流量控制结构图。如图7所示,在接收到数据访问请求流量数据710之后,在存储空间流控单元720进行存储空间流控的过程中,在存储空间级别内部首先在存储空间当前接口流控单元730中进行存储空间当前接口配额检测,确认其满足当前接口流量时,进入存储空间统一接口流控单元740中进行存储空间统一接口配额检测,确认其满足当前接口流量之后,在用户级别内部,用户流控单元750中的用户当前接口流控单元760中进行用户当前接口配额检测,确认其满足当前接口流量时,进入用户统一接口流控单元770中进行用户统一接口配额检测,确认其满足当前接口流量之后,对当前接口的数据访问请求进行响应。Please refer to FIG. 7. FIG. 7 is a flow control structural diagram of an upload interface provided by an embodiment of the present application. As shown in FIG. 7 , after the data access request flow data 710 is received, in the process of the storage space flow control unit 720 performing the storage space flow control, within the storage space level, the storage space current interface flow control unit 730 first performs the The current interface quota detection of the storage space, when it is confirmed that it meets the current interface traffic, enters the storage space unified interface flow control unit 740 to perform storage space unified interface quota detection, and after confirming that it meets the current interface traffic, inside the user level, the user flow control unit In 750, the user's current interface flow control unit 760 performs the user's current interface quota detection, and when it is confirmed that it meets the current interface traffic, it enters the user's unified interface flow control unit 770 to perform the user's unified interface quota detection, and after confirming that it meets the current interface traffic, Respond to data access requests for the current interface.

S504、当任一存储空间带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制;当各存储空间带宽剩余额大于或者等于零,且用户带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制。S504. When the remaining amount of any storage space bandwidth is less than zero, control each service node to perform bandwidth control on the data access terminal; when the remaining amount of each storage space bandwidth is greater than or equal to zero, and the remaining amount of user bandwidth is less than zero, control each service node. Bandwidth control on the data access side.

可选地,控制各服务节点在分布式缓存组件中进行流控配额扣减时,当任一存储空间带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制;当各存储空间带宽剩余额大于或者等于零,且用户带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制。Optionally, when each service node is controlled to deduct the flow control quota in the distributed cache component, when the remaining bandwidth of any storage space is less than zero, each service node is controlled to perform bandwidth control on the data access terminal; If the remaining amount of bandwidth is greater than or equal to zero, and the remaining amount of user bandwidth is less than zero, each service node is controlled to perform bandwidth control on the data access terminal.

具体地,在对数据访问端进行带宽控制时,常见的带宽控制方法对带宽无法通过其配额时,会进行断连处理,直接将其传输过程终止,这导致用户的数据访问请求会直接失败,进而不断发起重连,加重数据被访问端的负载压力。而在本申请实施例中,考虑到用户使用带宽进行数据传输时的流畅性,可以对带宽进行不断连控制,基于TCP(TransmissionCommunication Protocol)协议的Flow Control机制,在数据传输过程中,若是数据传输速度较慢,则在传输层就会有排队,那么还在传输过程中的数据包要被保存在接收缓冲区中,因此,接收缓冲区的空间就会变小,此时,在接收端发回给发送端的ACK(Acknowledgecharacter,确认字符)会表示出接收缓冲区的剩余空间大小,以控制发送端适应性增减发送初的数据以免数据包丢失。Specifically, when bandwidth control is performed on the data access terminal, the common bandwidth control method will perform disconnection processing when the bandwidth cannot pass its quota, and directly terminate the transmission process, which will cause the user's data access request to fail directly. In turn, reconnection is continuously initiated, increasing the load pressure on the accessed end of the data. However, in the embodiment of the present application, considering the fluency when the user uses the 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 If the speed is slow, there will be queues at the transport layer, and the data packets that are still in the transmission process will be stored in the receive buffer. Therefore, the space of the receive buffer will become smaller. At this time, the receiving end sends The ACK (Acknowledge character) returned to the sender will indicate the remaining size of the receiving buffer, so as to control the sender to adaptively increase or decrease the data at the beginning of transmission to avoid packet loss.

可选地,在具体的带宽控制过程中,可以控制各服务节点在数据访问端逐渐占满当前时间窗口的带宽配额时,即向数据访问端发送逐渐减小的ACK,用以提醒数据访问端减少该时间窗口内发送的数据,对数据访问端暂停响应数据访问请求,并确定数据访问请求中还未响应的溢出访问请求,并在下一时间窗口响应溢出数据访问请求,实现不断连式的带宽流量控制。Optionally, in the specific bandwidth control process, each service node can be controlled to send a gradually decreasing ACK to the data access terminal when the data access terminal gradually fills the bandwidth quota of the current time window to remind the data access terminal. Reduce the data sent within this time window, suspend the response to the data access request for the data access end, and determine the overflow access request that has not yet responded to the data access request, and respond to the overflow data access request in the next time window to achieve continuous bandwidth. flow control.

请参阅图8,图8为本申请实施例提供的一种带宽数据的流量控制示意图。如图8所示,在时间轴中,将划分出的单个时间窗口的带宽配额抽象表示为4个矩形,数据访问请求在当前的时间窗口中的4个带宽配额都已使用,那么将其剩下的带宽数据延迟至下一个时间窗口进行处理,并以此类推,直至时间窗口的带宽配额能够满足该数据访问请求剩余的带宽数据,则视为该数据访问请求响应成功,例如,带宽数据为15个矩形的数据访问请求将会经过是3个完整时间窗口以及1个3/4时间窗口实现处理结束。Please refer to FIG. 8. FIG. 8 is a schematic diagram of flow control of bandwidth data according to an embodiment of the present application. As shown in Figure 8, in the timeline, the bandwidth quota of a single time window divided is abstractly represented as 4 rectangles, and the data access request has used all 4 bandwidth quotas in the current time window, then the remaining The bandwidth data below is delayed until the next time window for processing, and so on, until the bandwidth quota of the time window can meet the remaining bandwidth data of the data access request, then the data access request response is deemed successful. For example, the bandwidth data is 15 rectangular data access requests will be processed through 3 full time windows and 1 3/4 time window.

可以理解地,对于数据访问端的每秒请求数据进行流量控制时,每秒请求量过多时,服务节点会直接无法继续工作,那么控制各服务节点在分布式缓存组件中进行流控配额扣减时,当任一存储空间每秒请求剩余额小于零,则控制各服务节点拒绝并返回数据访问请求至数据访问端;当各存储空间每秒请求剩余额大于或者等于零,且用户每秒请求剩余额小于零,则控制各服务节点拒绝并返回数据访问请求至数据访问端。Understandably, when performing flow control on the data requested per second at the data access end, if the number of requests per second is too large, the service node will be unable to continue to work directly, then control 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, control each service node to reject and return the data access request to the data access terminal; when the remaining amount of requests per second of each storage space is greater than or equal to zero, and the user requests the remaining amount per second If it is less than zero, control each service node to reject and return the data access request to the data access terminal.

在本申请实施例中,提供一种流量控制方法,在配置中心配置存储空间带宽配额、存储空间每秒请求配额、用户带宽配额以及用户每秒请求配额,引入分布式缓存组件,由各服务节点分别在分布式缓存组件中记录存储空间带宽数据、存储空间每秒请求数据、用户带宽数据以及用户每秒请求数据,并且在分布式缓存组件中进行配额扣减,根据对应的扣减后的剩余额来实现流量控制判断,其中,在存储空间和用户两种级别下,分别进行当前接口流控和统一接口流控,有效解决不能同时对存储空间和用户限速的问题,也有效解决无法对接口统一流量控制的问题,并且实现了不断连式的带宽限速,改善用户的使用体验。In the 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 per second request quota are configured in a configuration center, a distributed cache component is introduced, and each service node Record storage space bandwidth data, storage space request data per second, user bandwidth data, and user request data per second in the distributed cache component respectively, and perform quota deduction in the distributed cache component. Amount to realize the flow control judgment, among which, at the storage space and user levels, the current interface flow control and the unified interface flow control are respectively carried out, which effectively solves the problem that the storage space and user speed cannot be limited at the same time, and also effectively solves the problem that the storage space and user cannot be limited at the same time. The problem of unified flow control of the interface, and the continuous bandwidth speed limit is realized to improve the user experience.

请参阅图9,图9为本申请实施例提供的一种流量控制装置的结构框图。如图9所示,流量控制装置900包括:Please refer to FIG. 9 , which is a structural block diagram of a flow control apparatus provided by an embodiment of the present application. As shown in FIG. 9, the flow control device 900 includes:

请求响应模块910,用于响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间的存储空间流控配额以及用户流控配额;The request response module 910 is configured 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 terminal;

流量记录模块920,用于控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;The traffic recording module 920 is configured to control each service node to record the respective storage space traffic data and 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 configured to control 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 user flow control quota.

可选地,用户流控配额大于任意一个存储空间流控配额,且用户流控配额小于所有存储空间流控配额之和。Optionally, the user flow control quota is greater than any one 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 further configured to control each service node to perform first flow control on the data access terminal when any storage space flow data and its corresponding storage space flow control quota satisfy the first flow control condition; when 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 user flow control quota meet the second flow control condition, each service node is controlled to perform the second flow on the data access terminal. control.

可选地,各服务节点被分配的数据访问请求的数量相同,且存储空间流控配额中包括存储空间并发配额,用户流控配额中包括用户并发配额;流量控制装置900还包括:配额分配模块,用于将数据访问端对应的各存储空间并发配额以及用户并发配额均摊至各服务节点,得到各服务节点对应的各存储空间节点并发配额以及各用户节点并发配额。Optionally, the number of data access requests allocated to each service node is the same, and the storage space flow control quota includes a storage space concurrent quota, and the user flow control quota includes a user concurrent quota; the flow control apparatus 900 further includes: a quota allocation module. , which is used to evenly distribute the concurrent quota of each storage space and the concurrent quota of users corresponding to the data access end to each service node, and obtain the concurrent quota of each storage space node corresponding to each service node and the concurrent quota of each user node.

可选地,流量记录模块920,还用于控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间并发数据以及用户并发数据。Optionally, the traffic recording module 920 is further configured to control each service node to separately record the concurrent data of each storage space and the concurrent data of users generated when the data access terminal performs data access based on the data access request.

可选地,流量控制模块930,还用于当任一存储空间并发数据大于其对应的存储空间节点并发配额时,则控制各服务节点拒绝并返回数据访问请求至数据访问端;当各存储空间并发数据小于或者等于其对应的存储空间节点并发配额时,且任一用户并发数据大于其对应的用户节点并发配额,则控制各服务节点拒绝并返回数据访问请求至数据访问端。Optionally, the flow control module 930 is further configured 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 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.

可选地,存储空间流控配额中包括存储空间带宽配额,用户流控配额中包括用户带宽配额;流量记录模块920,还用于在预设时间窗口内,控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间带宽数据以及用户带宽数据;控制各服务节点基于各存储空间带宽数据对各存储空间带宽配额进行扣减,得到各存储空间带宽剩余额,以及基于各用户带宽数据对用户带宽配额进行扣减,得到用户带宽剩余额。Optionally, the storage space flow control quota includes storage space bandwidth quota, and the user flow control quota includes user bandwidth quota; the flow recording module 920 is further configured to control each service node to record data access terminals respectively within a preset time window. Each storage space bandwidth data and user bandwidth data generated during data access based on data access requests; control each service node to deduct each storage space bandwidth quota based on each storage space bandwidth data to obtain the remaining amount of each storage space bandwidth, and based on Each user's bandwidth data is deducted from the user's bandwidth quota to obtain the remaining amount of the user's bandwidth.

可选地,流量记录模块920,还用于控制各服务节点基于各存储空间带宽数据中的各存储空间接口数据,对各存储空间带宽配额中各存储空间接口配额进行扣减,得到各存储空间接口剩余额;控制各服务节点基于各用户带宽数据中的各用户接口数据对用户带宽配额中的用户接口配额进行扣减,得到用户接口剩余额。Optionally, the traffic recording module 920 is further configured 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, and obtain each storage space. Interface surplus; control each service node to deduct the user interface quota in the user bandwidth quota based on the user interface data in the user bandwidth data to obtain the user interface surplus.

可选地,流量控制模块930,还用于当任一存储空间带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制;当各存储空间带宽剩余额大于或者等于零,且用户带宽剩余额小于零,则控制各服务节点对数据访问端进行带宽控制。Optionally, the flow control module 930 is further configured to control each service node to perform bandwidth control on the data access terminal when the remaining amount of any storage space bandwidth is less than zero; when the remaining amount of each storage space bandwidth is greater than or equal to zero, and the user bandwidth If the remaining amount is less than zero, each service node is controlled to perform bandwidth control on the data access terminal.

可选地,流量控制模块930,还用于控制各服务节点对数据访问端暂停响应数据访问请求,并确定数据访问请求中还未响应溢出访问请求,并在下一时间窗口响应溢出数据访问请求。Optionally, the flow control module 930 is further configured to control each service node to suspend responding to the data access request to the data access terminal, determine that the overflow access request has not been responded to in the data access request, and respond to the overflow data access request 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 each storage space flow control quota corresponding to the data access end and the user flow control quota; the flow recording module is used to control each service node to 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; the flow control module is used to control each service. The node performs flow control on the data access end according to the flow data of each storage space, the user flow data, the flow control quota of each storage space and the user flow control quota. In this application, corresponding flow control quotas are configured for both the user level of the data access terminal and each storage space level, and the traffic generated by each storage space and the user account are also considered when the flow control is performed on the data access terminal. All traffic generated under the system is compared with their corresponding flow control quotas, so that the user-level traffic and the traffic of each storage space can be controlled at the same time, and finally, multiple levels of unified flow control can be performed on the data access end to achieve better flow control. Precise and stable flow control.

本申请实施例还提供了一种计算机存储介质,计算机存储介质可以存储有多条指令,指令适于由处理器加载并执行如上述实施例中的任一项的方法的步骤。Embodiments of the present application further provide a computer storage medium, where the computer storage medium can store a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the steps of the method in any one of the foregoing embodiments.

请参见图10,图10为本申请实施例提供的一种服务器的结构示意图。如图10所示,服务器1000可以包括:至少一个服务器处理器1001,至少一个网络接口1004,用户接口1003,存储器1005,至少一个通信总线1002。Referring to FIG. 10, FIG. 10 is a schematic structural diagram of a server according to an embodiment of the present application. As shown in FIG. 10 , the server 1000 may include: at least one server processor 1001 , at least one network interface 1004 , user interface 1003 , memory 1005 , and at least one communication bus 1002 .

其中,通信总线1002用于实现这些组件之间的连接通信。Among them, 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接口)。Wherein, the network interface 1004 may optionally include a standard wired interface and a wireless interface (eg, 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中,单独通过一块芯片进行实现。The server processor 1001 may include one or more processing cores. The server processor 1001 uses various interfaces and lines to connect various parts of the entire server 1000, and executes by running or executing the instructions, programs, code sets or instruction sets stored in the memory 1005, and calling the data stored in the memory 1005. Various functions of the server 1000 and processing data. Optionally, the server processor 1001 may use at least one of a digital signal processing (Digital Signal Processing, DSP), a Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and a Programmable Logic Array (Programmable Logic Array, PLA). A hardware form is implemented. The server processor 1001 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), a modem, and the like. Among them, the CPU mainly handles the operating system, user interface, and application programs; the GPU is used to render and draw the content that needs to be displayed on the display screen; the modem is used to handle wireless communication. It can be understood that, the above-mentioned modem may not be integrated into the server processor 1001, and is implemented by a single chip.

其中,存储器1005可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory,ROM)。可选的,该存储器1005包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器1005可用于存储指令、程序、代码、代码集或指令集。存储器1005可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现上述各个方法实施例的指令等;存储数据区可存储上面各个方法实施例中涉及到的数据等。存储器1005可选的还可以是至少一个位于远离前述服务器处理器1001的存储装置。如图10所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及流量控制程序。The memory 1005 may include random access memory (Random Access Memory, RAM), or may include read-only memory (Read-Only Memory, ROM). Optionally, the memory 1005 includes a non-transitory computer-readable storage medium. Memory 1005 may be used to store instructions, programs, codes, sets of codes, or sets of instructions. The memory 1005 may include a stored program area and a stored data area, wherein the stored 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 and the like used to implement the above method embodiments; the storage data area may store the data and the like involved in the above method embodiments. Optionally, the memory 1005 may also be at least one storage device located away from the aforementioned server processor 1001 . As shown in FIG. 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 execute the specific execution Do the following:

响应数据访问请求,为数据访问请求分配至少一个服务节点,以及获取数据访问端对应的各存储空间的存储空间流控配额以及用户流控配额;Responding to the data access request, assigning at least one service node to the data access request, and obtaining the storage space flow control quota and user flow control quota of each storage space corresponding to the data access terminal;

控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据;Controlling each service node to separately record each storage space traffic data and user traffic data generated when the data access terminal performs data access based on the data access request;

控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制。Control 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 user flow control quota.

在一些实施例中,用户流控配额大于任意一个存储空间流控配额,且用户流控配额小于所有存储空间流控配额之和。In some embodiments, the user flow control quota is greater than any one storage space flow control quota, and the user flow control quota is smaller than the sum of all storage space flow control quotas.

在一些实施例中,服务器处理器1001在执行控制各服务节点根据各存储空间流量数据、用户流量数据、各存储空间流控配额以及用户流控配额,对数据访问端进行流量控制时,具体执行以下步骤:当任一存储空间流量数据与其对应的存储空间流控配额满足第一流控条件时,则控制各服务节点对数据访问端进行第一流量控制;当各存储空间流量数据与其对应的存储空间流控配额不满足第一流控条件,且用户流量数据与用户流控配额满足第二流控条件时,则控制各服务节点对数据访问端进行第二流量控制。In some embodiments, when the server processor 1001 executes and 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 user flow control quota, the specific execution is: The following steps: when any storage space flow data and its corresponding storage space flow control quota satisfy the first flow control condition, control each service node to perform first flow control on the data access terminal; when each storage space flow data and its corresponding storage space flow control When the spatial flow control quota does 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 second flow control on the data access terminal.

在一些实施例中,各服务节点被分配的数据访问请求的数量相同,且存储空间流控配额中包括存储空间并发配额,用户流控配额中包括用户并发配额;服务器处理器1001在执行获取数据访问端对应的各存储空间流控配额以及用户流控配额之后,还具体执行以下步骤:将数据访问端对应的各存储空间并发配额以及用户并发配额均摊至各服务节点,得到各服务节点对应的各存储空间节点并发配额以及各用户节点并发配额。In some embodiments, the number of data access requests allocated to each service node is the same, the storage space flow control quota includes storage space concurrency quota, and the user flow control quota includes user concurrency quota; the server processor 1001 executes the data acquisition process. After each storage space flow control quota corresponding to the access end and the user flow control quota, the following steps are also specifically performed: Allocate the concurrent storage space quotas and user concurrent quotas corresponding to the data access end to each service node, and obtain the corresponding service nodes. Concurrent quota of each storage space node and concurrent quota of each user node.

在一些实施例中,服务器处理器1001在执行控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间流量数据以及用户流量数据时,具体执行以下步骤:控制各服务节点分别记录数据访问端基于数据访问请求进行数据访问时产生的各存储空间并发数据以及用户并发数据。In some embodiments, the server processor 1001 specifically executes the following steps when executing the control of each service node to record the respective storage space traffic data and user traffic data generated when the data access terminal performs data access based on the data access request. The nodes respectively record the concurrent data of each storage space and the concurrent data of users generated when the data access terminal performs data access based on the 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 flow data and its corresponding storage space flow control quota satisfy the first flow control condition, The following steps are specifically performed: when the concurrent data of any storage space is greater than the concurrent quota of its corresponding storage space node, control each service node to reject and return the data access request to the data access end; the server processor 1001 is executing when each storage space traffic When the 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, each service node is controlled to perform the second flow control on the data access terminal, specifically: Perform the following steps: 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, control each service node to reject and return the data access request to data access.

在一些实施例中,存储空间流控配额中包括存储空间带宽配额,用户流控配额中包括用户带宽配额;服务器处理器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; the server processor 1001 records that the data access terminal performs data access based on the data access request when executing the control of each service node. When each storage space traffic data and user traffic data are generated at the same time, the following steps are specifically performed: within a preset time window, control each service node to separately record each storage space bandwidth data generated when the data access terminal performs data access based on the data access request. and user bandwidth data; control each service node to deduct each storage space bandwidth quota based on each storage space bandwidth data to obtain the remaining amount of each storage space bandwidth, and deduct the user bandwidth quota based on each user bandwidth data to obtain the user bandwidth remaining amount.

在一些实施例中,服务器处理器1001在执行控制各服务节点基于各存储空间带宽数据对各存储空间带宽配额进行扣减,得到各存储空间带宽剩余额时,具体执行以下步骤:控制各服务节点基于各存储空间带宽数据中的各存储空间接口数据,对各存储空间带宽配额中各存储空间接口配额进行扣减,得到各存储空间接口剩余额;服务器处理器1001在执行基于各用户带宽数据对用户带宽配额进行扣减,得到用户带宽剩余额时,具体执行以下步骤:控制各服务节点基于各用户带宽数据中的各用户接口数据对用户带宽配额中的用户接口配额进行扣减,得到用户接口剩余额。In some embodiments, the server processor 1001 specifically executes the following steps when executing and controlling each service node to deduct each storage space bandwidth quota based on each storage space bandwidth data to obtain the remaining amount of each storage space bandwidth: controlling each service node Based on each storage space interface data in each storage space bandwidth data, deduct each storage space interface quota in each storage space bandwidth quota to obtain the remaining amount of each storage space interface; When the user bandwidth quota is deducted to obtain the remaining amount of user bandwidth, the following steps are specifically performed: control each service node to deduct the user interface quota in the user bandwidth quota based on the user interface data in the user bandwidth data, and obtain the user interface remaining amount.

在一些实施例中,服务器处理器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 flow data and its corresponding storage space flow control quota satisfy the first flow control condition, The following steps are specifically performed: when the remaining amount of any storage space bandwidth is less than zero, control each service node to perform bandwidth control on the data access end; When the first flow control condition is met, and the user flow data and the user flow control quota meet the second flow control condition, then each service node is controlled to perform the second flow control on the data access terminal, and the following steps are specifically performed: when the bandwidth of each storage space remains If the amount is greater than or equal to zero, and the remaining amount of user bandwidth 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 terminal, the server processor 1001 specifically performs the following steps: controlling each service node to suspend responding to the data access request on the data access terminal, and determining that the data access request is in the The overflow access request has not been responded to, and the overflow data access request will be responded to in the next time window.

在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are only illustrative. For example, the division of modules is only a logical function division. In actual implementation, there may be other division methods, for example, multiple modules or components may be combined or integrated. to another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or modules, and may be in electrical, mechanical or other forms.

作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。Modules described as separate components may or may not be physically separated, and components shown as modules may or may not be physical modules, that is, they may be located in one place, or may be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist physically alone, or two or more modules may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules.

集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated modules, if implemented in the form of software functional modules and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in the various embodiments 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), magnetic disk or optical disk and other media that can store program codes .

需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本申请所必须的。It should be noted that, for the convenience of description, the foregoing method embodiments are described as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described action sequence. Because in accordance with the present application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily all necessary for the present application.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may 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 by this application. For those skilled in the art, according to the ideas of the embodiments of this application, there will be changes in the specific implementation and application scope. In conclusion, the content of this specification should not be construed as a limitation on this application.

Claims (13)

1. A flow control method is applied to a data access terminal, wherein at least two storage spaces corresponding to the data access terminal are arranged in the data access terminal, and the method comprises the following steps:
responding to a data access request, distributing at least one service node for the data access request, and acquiring a storage space flow control quota and a user flow control quota of each storage space corresponding to a data access end;
controlling each service node to respectively record each storage space flow data and user flow data generated when the data access terminal accesses data based on the data access request;
and controlling each service node to perform flow control on the data access end according to the flow data of each storage space, the flow data of the user, the flow control quota of each storage space and the flow control quota of the user.
2. The method of claim 1, wherein the user flow control quota is greater than any one of the storage space flow control quotas, and the user flow control quota is less than a sum of all storage space flow control quotas.
3. The method according to claim 1, wherein the controlling 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, includes:
when any storage space flow data and the corresponding storage space flow control quota meet a first flow control condition, controlling each service node to perform first flow control on the data access terminal;
and when the storage space flow control quota corresponding to each piece of storage space flow data does not meet a first flow control condition and the user flow control quota meet a second flow control condition, controlling each service node to perform second flow control on the data access terminal.
4. The method according to claim 3, wherein the number of the data access requests allocated to each service node is the same, and the storage space flow control quota includes a storage space concurrent quota, and the user flow control quota includes a user concurrent quota;
after the obtaining of the storage space flow control quota and the user flow control quota of each storage space corresponding to the data access end, the method further includes:
and uniformly distributing the storage space concurrent quota corresponding to the data access end and the user concurrent quota to each service node to obtain the storage space node concurrent quota corresponding to each service node and the user node concurrent quota.
5. The method according to claim 4, wherein the controlling each service node to record each storage space traffic data and user traffic data generated when the data access terminal performs data access based on the data access request respectively comprises:
and controlling each service node to respectively record the storage space concurrent data and the user concurrent data generated when the data access terminal accesses data based on the data access request.
6. The method according to claim 5, wherein when any storage space traffic data and the storage space flow control quota corresponding to the storage space traffic data satisfy a first flow control condition, controlling each service node to perform first traffic control on the data access terminal includes:
when the concurrent data of any storage space is larger than the concurrent quota of the corresponding storage space node, controlling each service node to generate refusal and return the data access request to the data access end;
when the storage space flow control quota corresponding to each piece of storage space flow data does not satisfy a first flow control condition and the user flow control quota satisfy a second flow control condition, controlling each service node to perform second flow control on the data access terminal, including:
and when the concurrent data of each storage space is less than or equal to the concurrent quota of the corresponding storage space node, and any user concurrent data is greater than the concurrent quota of the corresponding user node, controlling each service node to reject and return the data access request to the data access end.
7. The method of claim 3, wherein the storage space flow control quota comprises a storage space bandwidth quota, and the user flow control quota comprises a user bandwidth quota;
the controlling each service node respectively records each storage space traffic data and user traffic data generated when the data access terminal performs data access based on the data access request, and the method comprises the following steps:
in a preset time window, controlling each service node to respectively record each storage space bandwidth data and user bandwidth data generated when the data access terminal accesses data based on the data access request;
and controlling each service node to deduct the bandwidth quota of each storage space based on the bandwidth data of each storage space to obtain the bandwidth surplus of each storage space, and deducting the bandwidth quota of each user based on the bandwidth data of each user to obtain the bandwidth surplus of each user.
8. The method of claim 7, wherein the controlling each service node to deduct each storage space bandwidth quota based on each storage space bandwidth data to obtain each storage space bandwidth surplus comprises:
controlling each service node to deduct and subtract 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 each storage space interface surplus;
the deducting the user bandwidth quota based on each user bandwidth data to obtain the user bandwidth surplus, including:
and controlling 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 user interface quota.
9. The method according to claim 7, wherein when any storage space traffic data and the storage space flow control quota corresponding to the storage space traffic data satisfy a first flow control condition, controlling each service node to perform first traffic control on the data access terminal includes:
when the surplus of the bandwidth of any storage space is less than zero, controlling each service node to perform bandwidth control on the data access terminal;
when the storage space flow control quota corresponding to each piece of storage space flow data does not satisfy a first flow control condition and the user flow control quota satisfy a second flow control condition, controlling each service node to perform second flow control on the data access terminal, including:
and when the residual bandwidth of each storage space is greater than or equal to zero and the residual bandwidth of the user is less than zero, controlling each service node to perform bandwidth control on the data access terminal.
10. The method of claim 9, wherein controlling each service node to perform bandwidth control on the data access terminal comprises:
and controlling each service node to suspend responding to the data access request to the data access terminal, determining that an overflow access request is not responded in the data access request, and responding to the overflow data access request in the next time window.
11. A flow control device is applied to a data access terminal, wherein at least two storage spaces corresponding to the data access terminal are arranged in the data access terminal, and the device comprises:
the request response module is used for responding to a data access request, distributing at least one service node for the data access request, and acquiring a storage space flow control quota and a user flow control quota of each storage space corresponding to a data access end;
the flow recording module is used for controlling each service node to respectively record each storage space flow data and user flow data generated when the data access terminal accesses data based on the data access request;
and the flow control module is used for controlling each service node to control the flow of the data access end according to the flow data of each storage space, the flow data of the user, the flow control quota of each storage space and the flow control quota of the user.
12. A computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the steps of the method according to any of claims 1 to 10.
13. A server comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method according to any one of claims 1 to 10 when executing the program.
CN202210326272.5A 2022-03-30 2022-03-30 Flow control method, device, storage medium and server Active CN114745338B (en)

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 true CN114745338A (en) 2022-07-12
CN114745338B 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)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115297057A (en) * 2022-07-22 2022-11-04 国网黑龙江省电力有限公司信息通信公司 Network flow control method based on information management platform
CN115766582A (en) * 2022-11-14 2023-03-07 阿里巴巴(中国)有限公司 Flow control method, device and system, medium and computer equipment

Citations (13)

* Cited by examiner, † Cited by third party
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
US20090265458A1 (en) * 2008-04-21 2009-10-22 Microsoft Corporation Dynamic server flow control in a hybrid peer-to-peer network
US7783666B1 (en) * 2007-09-26 2010-08-24 Netapp, Inc. Controlling access to storage resources by using access pattern based quotas
CN105208121A (en) * 2015-09-23 2015-12-30 深圳市深信服电子科技有限公司 File access flow control method and system based on distributed file system
CN110166376A (en) * 2019-06-06 2019-08-23 北京百度网讯科技有限公司 Flow control methods and device, system, server, computer-readable medium
CN110213173A (en) * 2019-06-06 2019-09-06 北京百度网讯科技有限公司 Flow control methods and device, system, server, computer-readable medium
CN110708258A (en) * 2019-09-29 2020-01-17 Oppo广东移动通信有限公司 Flow control method, flow control device, server and storage medium
CN110795230A (en) * 2018-08-03 2020-02-14 Emc Ip控股有限公司 Intelligent solution to support unified distributed real-time quota limit
US20200351207A1 (en) * 2019-04-30 2020-11-05 Wangsu Science & Technology Co., Ltd. Method and system of limiting traffic
CN112751691A (en) * 2019-10-29 2021-05-04 北京金山云网络技术有限公司 Network flow rate limiting method and device, central control equipment and gateway
CN113285883A (en) * 2021-05-25 2021-08-20 挂号网(杭州)科技有限公司 Access request current limiting method and device, electronic equipment and storage medium
CN113301075A (en) * 2020-05-18 2021-08-24 阿里巴巴集团控股有限公司 Flow control method, distributed system, device and storage medium
CN113760940A (en) * 2020-09-24 2021-12-07 北京沃东天骏信息技术有限公司 Quota management method, device, equipment and medium applied to distributed system

Patent Citations (13)

* Cited by examiner, † Cited by third party
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
US20090265458A1 (en) * 2008-04-21 2009-10-22 Microsoft Corporation Dynamic server flow control in a hybrid peer-to-peer network
CN105208121A (en) * 2015-09-23 2015-12-30 深圳市深信服电子科技有限公司 File access flow control method and system based on distributed file system
CN110795230A (en) * 2018-08-03 2020-02-14 Emc Ip控股有限公司 Intelligent solution to support unified distributed real-time quota limit
US20200351207A1 (en) * 2019-04-30 2020-11-05 Wangsu Science & Technology Co., Ltd. Method and system of limiting traffic
CN110166376A (en) * 2019-06-06 2019-08-23 北京百度网讯科技有限公司 Flow control methods and device, system, server, computer-readable medium
CN110213173A (en) * 2019-06-06 2019-09-06 北京百度网讯科技有限公司 Flow control methods and device, system, server, computer-readable medium
CN110708258A (en) * 2019-09-29 2020-01-17 Oppo广东移动通信有限公司 Flow control method, flow control device, server and storage medium
CN112751691A (en) * 2019-10-29 2021-05-04 北京金山云网络技术有限公司 Network flow rate limiting method and device, central control equipment and gateway
CN113301075A (en) * 2020-05-18 2021-08-24 阿里巴巴集团控股有限公司 Flow control method, distributed system, device and storage medium
CN113760940A (en) * 2020-09-24 2021-12-07 北京沃东天骏信息技术有限公司 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

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115297057A (en) * 2022-07-22 2022-11-04 国网黑龙江省电力有限公司信息通信公司 Network flow control method based on information management platform
CN115297057B (en) * 2022-07-22 2024-02-02 国网黑龙江省电力有限公司信息通信公司 Network traffic control method based on information management platform
CN115766582A (en) * 2022-11-14 2023-03-07 阿里巴巴(中国)有限公司 Flow control method, device and system, medium and computer equipment

Also Published As

Publication number Publication date
CN114745338B (en) 2024-09-06

Similar Documents

Publication Publication Date Title
JP7127010B2 (en) Resource allocation methods, apparatus, electronic equipment, computer readable media and computer programs
CN108776934A (en) Distributed data computational methods, device, computer equipment and readable storage medium storing program for executing
US20170126583A1 (en) Method and electronic device for bandwidth allocation based on online media services
CN114745338B (en) Flow control method, device, storage medium and server
CN111224806A (en) A resource allocation method and server
CN111597048B (en) Micro-service scheduling method and system based on service quality and electronic equipment
CN109729113B (en) Method, server system and computer program product for managing dedicated processing resources
CN106385377B (en) Information processing method and system
CN112600761B (en) Resource allocation method, device and storage medium
WO2020259208A1 (en) Memory scheduling method and apparatus, device and storage medium
CN116662020B (en) Dynamic management method and system for application service, electronic equipment and storage medium
US11709707B2 (en) Low latency distributed counters for quotas
CN115017030A (en) Resource allocation method, device, electronic equipment and storage medium
CN111200606A (en) Deep learning model task processing method, system, server and storage medium
CN114489978A (en) Resource scheduling method, device, equipment and storage medium
CN112134964B (en) Controller allocation method, computer equipment, storage media and network business system
CN114265648B (en) Code scheduling method, server, client and system for acquiring remote desktop
CN112104679A (en) Method, apparatus, device and medium for processing hypertext transfer protocol request
WO2023174037A1 (en) Resource scheduling method, apparatus and system, device, medium, and program product
CN114448909B (en) Network card queue polling method and device based on ovs, computer equipment and medium
CN111694670B (en) Resource allocation method, apparatus, device and computer readable medium
CN118963850A (en) Method and electronic device for starting video conference operation
CN115378879A (en) Data control method and related device
CN113271228B (en) Bandwidth resource scheduling method, device, equipment and computer readable storage medium
CN114138427A (en) SLO guarantee method, device, node and storage medium

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