CN115733801A - Access request processing method and device and server - Google Patents
Access request processing method and device and server Download PDFInfo
- Publication number
- CN115733801A CN115733801A CN202110997001.8A CN202110997001A CN115733801A CN 115733801 A CN115733801 A CN 115733801A CN 202110997001 A CN202110997001 A CN 202110997001A CN 115733801 A CN115733801 A CN 115733801A
- Authority
- CN
- China
- Prior art keywords
- access
- target data
- access request
- rule
- information
- 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.)
- Pending
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域technical field
本发明涉及数据处理技术领域,尤其是涉及一种访问请求的处理方法、装置和服务器。The present invention relates to the technical field of data processing, in particular to an access request processing method, device and server.
背景技术Background technique
随着互联网技术的高速发展,网络恶意攻击已成为业界不可忽视的问题,比如,在一段时间内,客户端不断地向服务器发送请求,由于这些请求非常密集,而服务器处理能力有限,大量的并发访问给服务器的处理能力和运行成本带来了巨大的压力,为了在保证系统安全稳定运行的同时,避免对服务器资源的浪费,可以对应用系统或服务进行限流,即可以通过限制对API(Application Programming Interface,应用程序接口)的调用频率,以实现限流;相关技术中,公有云对象存储数据库的不同用户通过各自对应的业务服务器接收客户端的数据访问请求,将数据访问请求转发至公有云对象存储数据库对应的服务器,以访问公有云对象存储数据库中的数据,该方式需要每个用户单独开发限流程序,并部署到各自对应的业务服务器上,通过业务服务器中部署的限流程序实现对API调用频率的限制,以实现限流,由于需要每个用户单独开发限流程序,并为每个用户部署对应的业务服务器,用户的开发成本和维护成本比较高。With the rapid development of Internet technology, network malicious attacks have become a problem that cannot be ignored in the industry. For example, within a period of time, the client sends requests to the server continuously. Because these requests are very intensive and the server's processing capacity is limited, a large number of concurrent Access has brought enormous pressure on the processing capacity and operating costs of the server. In order to ensure the safe and stable operation of the system and avoid waste of server resources, the application system or service can be restricted, that is, the API ( Application Programming Interface, application programming interface) call frequency, in order to realize current limiting; In related technologies, different users of the public cloud object storage database receive the data access request of the client through their corresponding business servers, and forward the data access request to the public cloud The server corresponding to the object storage database is used to access the data in the public cloud object storage database. This method requires each user to independently develop a current limiting program and deploy it to their respective business servers. The current limiting program deployed in the business server is implemented Limit the frequency of API calls to achieve current limiting. Since each user needs to develop a separate current limiting program and deploy a corresponding business server for each user, the user's development and maintenance costs are relatively high.
发明内容Contents of the invention
本发明的目的在于提供访问请求的处理方法、装置和服务器,以降低用户的开发成本和维护成本。The purpose of the present invention is to provide a processing method, device and server for access requests, so as to reduce the development cost and maintenance cost of users.
本发明提供的一种访问请求的处理方法,方法应用于对象存储服务器;目标数据存储在对象存储服务器中;方法包括:如果接收到针对目标数据的访问请求,判断访问请求是否符合目标数据的访问规则;其中,访问规则基于指定用户输入的规则信息生成;规则信息由指定用户通过对象存储服务器提供的规则输入接口输入;如果访问请求符合目标数据的访问规则,处理访问请求。A method for processing an access request provided by the present invention, the method is applied to an object storage server; the target data is stored in the object storage server; the method includes: if an access request for the target data is received, judging whether the access request meets the access requirements for the target data Rules; wherein, the access rule is generated based on the rule information input by the specified user; the rule information is input by the specified user through the rule input interface provided by the object storage server; if the access request conforms to the access rule of the target data, the access request is processed.
进一步的,如果接收到针对目标数据的访问请求,判断访问请求是否符合目标数据的访问规则的步骤包括:如果接收到针对目标数据的访问请求,基于访问请求更新目标数据的访问信息;其中,访问信息包括:在指定时间段内的读访问次数、读访问频率或写访问频率;判断访问信息是否符合目标数据的访问规则。Further, if an access request for the target data is received, the step of judging whether the access request complies with the access rules for the target data includes: if an access request for the target data is received, updating the access information of the target data based on the access request; wherein, the access The information includes: the number of read accesses, the frequency of read accesses or the frequency of write accesses within a specified period of time; it is judged whether the access information complies with the access rules of the target data.
进一步的,访问规则包括至少一个指定来源地址;如果接收到针对目标数据的访问请求,基于访问请求更新目标数据的访问信息的步骤包括:如果接收到针对目标数据的访问请求,判断发送访问请求的地址是否属于指定来源地址;如果属于指定来源地址,基于访问请求更新目标数据的访问信息。Further, the access rule includes at least one specified source address; if an access request for the target data is received, the step of updating the access information of the target data based on the access request includes: if an access request for the target data is received, judging whether the access request is sent Whether the address belongs to the specified source address; if it belongs to the specified source address, update the access information of the target data based on the access request.
进一步的,访问规则包括:至少一个指定用户代理信息;如果接收到针对目标数据的访问请求,基于访问请求更新目标数据的访问信息的步骤包括:如果接收到针对目标数据的访问请求,判断访问请求的请求头中是否包括指定用户代理信息;如果包括指定用户代理信息,基于访问请求更新目标数据的访问信息。Further, the access rule includes: at least one specified user agent information; if an access request for the target data is received, the step of updating the access information of the target data based on the access request includes: if an access request for the target data is received, judging the access request Whether the specified user agent information is included in the request header; if the specified user agent information is included, the access information of the target data is updated based on the access request.
进一步的,访问规则还包括:目标数据的数据名称中需要包含的指定字符;如果接收到针对目标数据的访问请求,基于访问请求更新当前访问信息的步骤包括:如果接收到针对目标数据的访问请求,判断目标数据的数据名称中是否包含指定字符;如果目标数据的数据名称中包含指定字符,基于访问请求更新当前访问信息。Further, the access rule also includes: specified characters that need to be included in the data name of the target data; if an access request for the target data is received, the step of updating the current access information based on the access request includes: if the access request for the target data is received , to determine whether the data name of the target data contains specified characters; if the data name of the target data contains specified characters, update the current access information based on the access request.
进一步的,判断访问信息是否符合目标数据的访问规则的步骤包括:判断访问信息中的读访问频率是否在访问规则的读访问频率阈值范围内;或者,判断访问信息中的写访问频率是否在访问规则的写访问频率阈值范围内;或者,判断访问信息中的读访问次数是否在访问规则的读访问次数阈值范围内。Further, the step of judging whether the access information conforms to the access rule of the target data includes: judging whether the read access frequency in the access information is within the threshold range of the read access frequency of the access rule; or judging whether the write access frequency in the access information is within the access rule The write access frequency threshold range of the rule; or, determine whether the read access times in the access information is within the read access frequency threshold range of the access rule.
进一步的,如果访问请求符合目标数据的访问规则,处理访问请求的步骤包括:如果访问请求符合目标数据的访问规则,基于访问请求处理目标数据。Further, if the access request conforms to the access rule of the target data, the step of processing the access request includes: if the access request conforms to the access rule of the target data, processing the target data based on the access request.
进一步的,访问规则通过下述方式生成:接收指定用户通过规则输入接口输入的规则信息;基于规则信息生成访问规则。Further, the access rule is generated in the following manner: receiving rule information input by a specified user through the rule input interface; and generating an access rule based on the rule information.
进一步的,对象存储服务器包括至少一个存储桶,目标数据存储在目标存储桶中;如果接收到针对目标数据的访问请求,判断访问请求是否符合目标数据的访问规则的步骤包括:如果接收到针对目标数据的访问请求,获取目标存储桶对应的目标数据的访问规则;判断访问请求是否符合访问规则。Further, the object storage server includes at least one storage bucket, and the target data is stored in the target storage bucket; if an access request for the target data is received, the step of judging whether the access request complies with the access rules for the target data includes: For data access requests, obtain the access rules of the target data corresponding to the target bucket; determine whether the access requests comply with the access rules.
本发明提供的一种访问请求的处理装置,装置设置于对象存储服务器;目标数据存储在对象存储服务器中;装置包括:判断模块,用于如果接收到针对目标数据的访问请求,判断访问请求是否符合目标数据的访问规则;其中,访问规则基于指定用户输入的规则信息生成;规则信息由指定用户通过对象存储服务器提供的规则输入接口输入;处理模块,用于如果访问请求符合目标数据的访问规则,处理访问请求。An access request processing device provided by the present invention is provided in an object storage server; the target data is stored in the object storage server; the device includes: a judging module, used to judge whether the access request is received if an access request for the target data is received An access rule conforming to the target data; wherein, the access rule is generated based on the rule information input by the designated user; the rule information is input by the designated user through the rule input interface provided by the object storage server; the processing module is used for if the access request conforms to the access rule of the target data , to process the access request.
本发明提供的一种服务器,包括处理器和存储器,存储器存储有能够被处理器执行的机器可执行指令,处理器执行机器可执行指令以实现上述访问请求的处理方法。A server provided by the present invention includes a processor and a memory, the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above access request processing method.
本发明提供的一种机器可读存储介质,机器可读存储介质存储有机器可执行指令,机器可执行指令在被处理器调用和执行时,机器可执行指令促使处理器实现上述访问请求的处理方法。The present invention provides a machine-readable storage medium. The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the processing of the above-mentioned access request. method.
本发明提供的访问请求的处理方法、装置和服务器,方法应用于对象存储服务器;目标数据存储在对象存储服务器中;如果接收到针对目标数据的访问请求,判断访问请求是否符合目标数据的访问规则;该访问规则基于指定用户输入的规则信息生成;规则信息由指定用户通过对象存储服务器提供的规则输入接口输入;如果访问请求符合目标数据的访问规则,处理访问请求。该方式中,用户可以直接通过对象存储服务器提供的规则输入接口输入规则信息,以生成访问规则,对象存储服务器接收到针对目标数据的访问请求后,可以直接判断该访问请求是否符合访问规则,不需要用户部署业务服务器,并在业务服务器上部署限流程序,降低了用户的开发成本和维护成本。The access request processing method, device and server provided by the present invention, the method is applied to the object storage server; the target data is stored in the object storage server; if an access request for the target data is received, it is judged whether the access request conforms to the access rules of the target data ; The access rule is generated based on the rule information input by the specified user; the rule information is input by the specified user through the rule input interface provided by the object storage server; if the access request conforms to the access rule of the target data, process the access request. In this method, users can directly input rule information through the rule input interface provided by the object storage server to generate access rules. After receiving an access request for target data, the object storage server can directly determine whether the access request complies with the access rules. Users are required to deploy a business server, and a flow limiting program is deployed on the business server, which reduces the user's development cost and maintenance cost.
附图说明Description of drawings
为了更清楚地说明本发明具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the specific implementation of the present invention or the technical solutions in the prior art, the following will briefly introduce the accompanying drawings that need to be used in the specific implementation or description of the prior art. Obviously, the accompanying drawings in the following description The drawings show some implementations of the present invention, and those skilled in the art can obtain other drawings based on these drawings without any creative work.
图1为本发明实施例提供的一种访问请求的处理方法的流程图;FIG. 1 is a flowchart of a method for processing an access request provided by an embodiment of the present invention;
图2为本发明实施例提供的另一种访问请求的处理方法的流程图;FIG. 2 is a flow chart of another access request processing method provided by an embodiment of the present invention;
图3为本发明实施例提供的另一种访问请求的处理方法的流程图;FIG. 3 is a flow chart of another access request processing method provided by an embodiment of the present invention;
图4为本发明实施例提供的一种创建存储桶访问次数管理规则界面示意图;FIG. 4 is a schematic diagram of an interface for creating storage bucket access times management rules provided by an embodiment of the present invention;
图5为本发明实施例提供的另一种创建存储桶访问次数管理规则界面示意图;FIG. 5 is a schematic diagram of another interface for creating storage bucket access times management rules provided by an embodiment of the present invention;
图6为本发明实施例提供的一种访问请求的处理装置的结构示意图;FIG. 6 is a schematic structural diagram of an access request processing device provided by an embodiment of the present invention;
图7为本发明实施例提供的一种服务器的结构示意图。FIG. 7 is a schematic structural diagram of a server provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合实施例对本发明的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
随着互联网技术的高速发展,网络恶意攻击已成为业界不可忽视的问题,比如,在一段时间内,客户端不断地向服务器发送请求,由于这些请求非常密集,而服务器处理能力有限,或者该服务能力由第三方提供,大量的并发访问对服务器的处理能力提出了更高的要求,服务器的运行成本也更高。为了保证系统安全同时,避免对服务器资源的浪费,可以对应用系统或服务进行限流。限流可以理解为,限制对API的调用频率;每一次调用API,都需要耗费服务器的资源,因此很多API不会对用户无限次地开放,请求达到某个次数后就不再允许访问了,或者一段时间内,最多只允许访问API指定次数。通过对接口或服务限流,可以防止接口被恶意用户刷爆。With the rapid development of Internet technology, network malicious attacks have become a problem that cannot be ignored in the industry. For example, for a period of time, the client sends requests to the server continuously. Because these requests are very intensive and the processing capacity of the server is limited, or the service The capacity is provided by a third party, and a large number of concurrent accesses puts forward higher requirements on the processing capacity of the server, and the operating cost of the server is also higher. In order to ensure system security and avoid waste of server resources, the flow of application systems or services can be limited. Current limiting can be understood as limiting the frequency of API calls; every call to an API requires server resources, so many APIs will not be open to users indefinitely, and access will no longer be allowed after a certain number of requests. Or within a period of time, only the specified number of accesses to the API is allowed at most. By limiting the flow of the interface or service, the interface can be prevented from being maxed out by malicious users.
相关技术只能由自身实现业务侧限流,即公有云对象存储数据库的不同用户通过各自对应的业务服务器接收客户端的数据访问请求,将数据访问请求转发至公有云对象存储数据库对应的服务器,以访问公有云对象存储数据库中的数据,该方式需要每个用户单独开发限流程序,并部署到各自对应的业务服务器上,通过业务服务器中部署的限流程序实现对API调用频率的限制,以实现限流,该方式需要每个用户单独开发限流程序,用户需要重复实现类似的程序。同时直接上传或者下载云端数据时候,必须通过用户对应的业务服务器实现限流,导致直接使用云端存储时,必须为每个用户部署对应的业务服务器,用户的开发成本和维护成本比较高。Related technologies can only realize business-side flow limitation by themselves, that is, different users of the public cloud object storage database receive data access requests from clients through their corresponding business servers, and forward the data access requests to the servers corresponding to the public cloud object storage database, so as to To access the data in the public cloud object storage database, this method requires each user to independently develop a flow-limiting program and deploy it to their respective business servers. To achieve current limiting, this method requires each user to develop a separate current limiting program, and users need to implement similar programs repeatedly. At the same time, when directly uploading or downloading cloud data, the user's corresponding business server must be used to implement current limiting. As a result, when directly using cloud storage, a corresponding business server must be deployed for each user, and the user's development and maintenance costs are relatively high.
基于此,本发明实施例提供了一种访问请求的处理方法、装置和服务器,该技术可以应用于对应用系统或服务进行限流的应用中。Based on this, embodiments of the present invention provide a method, device, and server for processing access requests, and the technology can be applied to applications that limit the flow of application systems or services.
为便于对本实施例进行理解,首先对本发明实施例所公开的一种访问请求的处理方法进行详细介绍;该方法应用于对象存储服务器,目标数据存储在对象存储服务器中;如图1所示,该方法包括如下步骤:In order to facilitate the understanding of this embodiment, a method for processing an access request disclosed in the embodiment of the present invention is firstly introduced in detail; the method is applied to an object storage server, and target data is stored in the object storage server; as shown in FIG. 1 , The method comprises the steps of:
步骤S102,如果接收到针对目标数据的访问请求,判断访问请求是否符合目标数据的访问规则;其中,访问规则基于指定用户输入的规则信息生成;规则信息由指定用户通过对象存储服务器提供的规则输入接口输入。Step S102, if an access request for the target data is received, judge whether the access request complies with the access rules of the target data; wherein, the access rules are generated based on the rule information input by the specified user; the rule information is input by the specified user through the rules provided by the object storage server interface input.
上述目标数据通常是用户需要访问的数据,该数据可以是单个数据,也可以是批量数据;上述访问请求可以理解为用户需要访问对象存储服务器中的目标数据时所发出的请求,比如,请求对目标数据进行读操作或写操作等;上述规则信息可以理解为,为了对目标数据的访问进行限流,所输入的限流相关信息,比如,该规则信息可以是用户输入的在指定时间段内,针对目标数据的读访问次数频率阈值或写访问频率阈值等;上述规则输入接口可以是图形化界面或API方式,指定用户通过该图形化界面或API方式输入规则信息后即可生成该访问规则;在实际实现时,为了对目标数据的访问进行限流,用户可以预先输入规则信息以生成针对该目标数据的访问规则,当对象存储服务器接收到针对该目标数据的访问请求后,可以判断该访问请求是否符合预先生成的该目标数据的访问规则。The above-mentioned target data is usually the data that the user needs to access, and the data can be single data or batch data; the above-mentioned access request can be understood as a request sent by the user when he needs to access the target data in the object storage server, for example, a request for The target data is read or written, etc.; the above rule information can be understood as the information related to the current limit entered in order to limit the access to the target data. For example, the rule information can be entered by the user within a specified time period , the read access frequency threshold or write access frequency threshold for the target data, etc.; the above rule input interface can be a graphical interface or an API method, and the specified user can generate the access rule after inputting rule information through the graphical interface or API method ; In actual implementation, in order to limit the access to the target data, the user can input rule information in advance to generate an access rule for the target data. When the object storage server receives the access request for the target data, it can judge the Whether the access request complies with the pre-generated access rules for the target data.
步骤S104,如果访问请求符合目标数据的访问规则,处理访问请求。Step S104, if the access request complies with the access rule of the target data, process the access request.
如果对象存储服务器判断该访问请求符合目标数据的访问规则,可以进一步处理该访问请求,比如,如果该访问请求为请求读取目标数据,则可以将该目标数据发送至发起该访问请求的客户端。If the object storage server judges that the access request conforms to the access rules of the target data, it can further process the access request. For example, if the access request is a request to read the target data, it can send the target data to the client that initiated the access request .
上述访问请求的处理方法,应用于对象存储服务器;目标数据存储在对象存储服务器中;如果接收到针对目标数据的访问请求,判断访问请求是否符合目标数据的访问规则;该访问规则基于指定用户输入的规则信息生成;规则信息由指定用户通过对象存储服务器提供的规则输入接口输入;如果访问请求符合目标数据的访问规则,处理访问请求。该方式中,用户可以直接通过对象存储服务器提供的规则输入接口输入规则信息,以生成访问规则,对象存储服务器接收到针对目标数据的访问请求后,可以直接判断该访问请求是否符合访问规则,不需要用户部署业务服务器,并在业务服务器上部署限流程序,降低了用户的开发成本和维护成本。The above access request processing method is applied to the object storage server; the target data is stored in the object storage server; if an access request for the target data is received, it is judged whether the access request conforms to the access rules of the target data; the access rules are based on the specified user input The rule information is generated; the rule information is input by the designated user through the rule input interface provided by the object storage server; if the access request conforms to the access rules of the target data, the access request is processed. In this method, users can directly input rule information through the rule input interface provided by the object storage server to generate access rules. After receiving an access request for target data, the object storage server can directly determine whether the access request complies with the access rules. Users are required to deploy a business server, and a flow limiting program is deployed on the business server, which reduces the user's development cost and maintenance cost.
本发明实施例提供了另一种访问请求的处理方法,该方法在上述实施例方法的基础上实现,该方法重点描述如果接收到针对目标数据的访问请求,判断访问请求是否符合目标数据的访问规则的具体过程,如图2所示,该方法包括如下步骤:The embodiment of the present invention provides another access request processing method, which is implemented on the basis of the methods in the above embodiments. This method focuses on the description of whether the access request meets the access requirements of the target data if an access request for the target data is received. The specific process of the rule, as shown in Figure 2, the method includes the following steps:
步骤S202,如果接收到针对目标数据的访问请求,基于访问请求更新目标数据的访问信息;其中,访问信息包括:在指定时间段内的读访问次数、读访问频率或写访问频率。Step S202, if an access request for the target data is received, update the access information of the target data based on the access request; where the access information includes: read access times, read access frequency or write access frequency within a specified time period.
上述指定时间段可以根据实际需求进行设置,比如,该指定时间段可以是每分钟或每小时等;上述读访问次数可以理解为,在指定时间段内,截止当前时刻所统计的对目标数据进行读请求的总次数;上述读访问频率可以按QPM(Queries Per Minute)的方式进行设置,即每分钟的读请求次数,或者,可以按QPS(Queries Per Second)的方式进行设置,即每秒钟的读请求次数等;上述写访问频率也可以按QPM(Queries Per Minute)的方式进行设置,即每分钟的写请求次数,或者,也可以按QPS(Queries Per Second)的方式进行设置,即每秒钟的写请求次数等;在实际实现时,如果接收到针对目标数据的访问请求,可以基于该访问请求更新目标数据的访问信息,比如,如果接收到针对目标数据的一次读访问请求,可以在当前所统计的目标数据的读访问次数基础上增加1,以更新该目标数据的读访问次数。The above specified time period can be set according to actual needs. For example, the specified time period can be per minute or hour; The total number of read requests; the above-mentioned read access frequency can be set according to QPM (Queries Per Minute), that is, the number of read requests per minute, or it can be set according to QPS (Queries Per Second), that is, every second The number of read requests, etc.; the above-mentioned write access frequency can also be set according to QPM (Queries Per Minute), that is, the number of write requests per minute, or it can also be set according to QPS (Queries Per Second), that is, every The number of write requests per second, etc.; in actual implementation, if an access request for the target data is received, the access information of the target data can be updated based on the access request. For example, if a read access request for the target data is received, you can Add 1 to the currently counted number of read accesses of the target data to update the number of read accesses of the target data.
如果访问规则包括至少一个指定来源地址,该步骤S202可以通过下述步骤一和步骤二实现:If the access rule includes at least one specified source address, step S202 can be implemented through the following steps 1 and 2:
步骤一,如果接收到针对目标数据的访问请求,判断发送访问请求的地址是否属于指定来源地址。Step 1, if an access request for the target data is received, it is judged whether the address sending the access request belongs to the specified source address.
上述来源地址可以理解为发送访问请求的客户端的IP(Internet Protocol,网际互连协议)地址,该IP地址可以是公网IP地址,也可以是内网IP地址;上述指定来源地址可以是用户通过对象存储服务器提供的规则输入接口所设置的一个或多个IP地址;如果在访问规则中包括一个或多个指定来源地址,多个IP地址是或的关系,可以理解为,需要对来自该指定来源地址的客户端发送的针对目标数据的访问请求进行限速处理;在实际实现时,当接收到针对目标数据的访问请求时,需要判断发送该访问请求的客户端的IP地址是否属于访问规则中所设置的指定来源地址。The above-mentioned source address can be understood as the IP (Internet Protocol, Internet Protocol) address of the client that sends the access request, and this IP address can be a public network IP address or an intranet IP address; One or more IP addresses set by the rule input interface provided by the object storage server; if one or more specified source addresses are included in the access rule, the relationship between multiple IP addresses is OR, it can be understood that it is necessary to The access request for the target data sent by the client at the source address is subjected to rate-limiting processing; in actual implementation, when an access request for the target data is received, it is necessary to determine whether the IP address of the client sending the access request belongs to the access rule The specified source address set.
步骤二,如果属于指定来源地址,基于访问请求更新目标数据的访问信息。Step 2, if it belongs to the specified source address, update the access information of the target data based on the access request.
如果发送访问请求的地址属于指定来源地址,可以理解为,需要对来自该指定来源地址的客户端发送的针对目标数据的访问请求进行限速处理,这时,可以基于该访问请求更新目标数据的访问信息,比如,更新目标数据的读访问次数、读访问频率或写访问频率。If the address that sends the access request belongs to the specified source address, it can be understood that the access request for the target data sent by the client from the specified source address needs to be speed-limited. At this time, the target data can be updated based on the access request. Access information such as the number of read accesses, read access frequency, or write access frequency to update target data.
如果访问规则包括至少一个指定用户代理信息,该步骤S202可以通过下述步骤三和步骤四实现:If the access rule includes at least one specified user agent information, step S202 can be implemented through the following steps 3 and 4:
步骤三,如果接收到针对目标数据的访问请求,判断访问请求的请求头中是否包括指定用户代理信息。Step 3: If an access request for the target data is received, it is judged whether the request header of the access request includes the specified user agent information.
上述用户代理可以是User Agent(简称UA),该用户代理通常是Http协议中的一部分,属于头域的组成部分,它是一个特殊字符串头,是一种可以向访问网站提供用户所使用的浏览器类型及版本、操作系统及版本、浏览器内核等信息的标识;通过这个标识,服务网站可以显示不同的排版,从而为用户提供更好的体验或者进行信息统计;例如,用手机访问谷歌与使用电脑访问谷歌时,服务网站所显示的排版通常是不一样的。上述指定用户代理信息可以是用户通过对象存储服务器提供的规则输入接口所设置的一个或多个用户代理信息;如果在访问规则中包括一个或多个指定用户代理信息,多个指定用户代理是或的关系,可以理解为,需要对访问请求的请求头中包含该指定用户代理信息的客户端所发送的,针对目标数据的访问请求进行限速处理;在实际实现时,当接收到针对目标数据的访问请求时,需要判断访问请求的请求头中是否包括访问规则中所设置的指定用户代理信息。The above-mentioned user agent can be User Agent (abbreviated as UA). The user agent is usually a part of the Http protocol and belongs to the header field. The identification of browser type and version, operating system and version, browser kernel and other information; through this identification, the service website can display different layouts, so as to provide users with a better experience or carry out information statistics; for example, access Google with a mobile phone The typography displayed on the service's website is usually different from that displayed when accessing Google on a computer. The above designated user agent information may be one or more user agent information set by the user through the rule input interface provided by the object storage server; if one or more designated user agent information is included in the access rule, the multiple designated user agents are or It can be understood that it is necessary to limit the rate of the access request for the target data sent by the client that contains the specified user agent information in the request header of the access request; in actual implementation, when receiving the target data When accessing an access request, it is necessary to determine whether the request header of the access request includes the specified user agent information set in the access rule.
步骤四,如果包括指定用户代理信息,基于访问请求更新目标数据的访问信息。Step 4, if the specified user agent information is included, update the access information of the target data based on the access request.
如果访问请求的请求头中包括指定用户代理信息,可以理解为,需要对发起该访问请求的客户端所发送的,针对目标数据的访问请求进行限速处理,这时,可以基于该访问请求更新目标数据的访问信息,比如,更新目标数据的读访问次数、读访问频率或写访问频率。If the request header of the access request includes the specified user agent information, it can be understood that it is necessary to limit the rate of the access request for the target data sent by the client that initiated the access request. At this time, it can be updated based on the access request Access information of the target data, for example, the number of read accesses, read access frequency, or write access frequency to update the target data.
如果访问规则包括目标数据的数据名称中需要包含的指定字符,该步骤S202可以通过下述步骤五和步骤六实现:If the access rule includes specified characters that need to be included in the data name of the target data, this step S202 can be realized through the following steps five and six:
步骤五,如果接收到针对目标数据的访问请求,判断目标数据的数据名称中是否包含指定字符。Step 5, if an access request for the target data is received, it is judged whether the data name of the target data contains specified characters.
上述指定字符可以是数据名称中包含的指定前缀或指定后缀等,其中,该指定前缀可以用于指示数据的存储路径或存储目录等;指定后缀可以用于指示数据所属的数据类型等;不同数据的数据名称中所包含的指定字符可能相同,也可能不相同;用户可以通过对象存储服务器提供的规则输入接口设置一个或多个指定字符;在实际实现时,用户可以选择针对对象存储服务器中存储的所有数据的访问请求都进行限速处理,也可以选择只针对部分数据的访问请求进行限速处理,具体的,用户可以根据实际需求,选择对数据名称中包含指定字符的数据进行限速处理;比如,如果需要对数据名称中包含固定前缀的数据进行限速处理,且该固定前缀指示该数据的存储目录,则可以理解为需要对该固定前缀所对应的存储目录下的所有文件的访问进行限速处理;在实际实现时,当接收到针对目标数据的访问请求时,需要判断目标数据的数据名称中是否包含访问规则中所设置的指定字符。The above-mentioned specified characters may be a specified prefix or a specified suffix contained in the data name, where the specified prefix may be used to indicate the storage path or directory of the data, etc.; the specified suffix may be used to indicate the data type to which the data belongs, etc.; different data The specified characters contained in the data name of the object storage server may or may not be the same; the user can set one or more specified characters through the rule input interface provided by the object storage server; All data access requests are subject to rate-limit processing, and you can also choose to perform rate-limit processing only for partial data access requests. Specifically, users can choose to perform rate-limit processing on data whose data names contain specified characters according to actual needs. ; For example, if it is necessary to limit the speed of data containing a fixed prefix in the data name, and the fixed prefix indicates the storage directory of the data, it can be understood that all files under the storage directory corresponding to the fixed prefix need to be accessed Perform speed limit processing; in actual implementation, when receiving an access request for the target data, it is necessary to determine whether the data name of the target data contains the specified characters set in the access rules.
步骤六,如果目标数据的数据名称中包含指定字符,基于访问请求更新当前访问信息。Step six, if the data name of the target data contains specified characters, update the current access information based on the access request.
如果目标数据的数据名称中包含指定字符,可以理解为,需要对该目标数据的访问请求进行限速处理,这时,可以基于该访问请求更新目标数据的访问信息,比如,更新目标数据的读访问次数、读访问频率或写访问频率。If the data name of the target data contains specified characters, it can be understood that the access request for the target data needs to be processed at a rate limit. At this time, the access information of the target data can be updated based on the access request, for example, the read Access count, read access frequency, or write access frequency.
步骤S204,判断访问信息是否符合目标数据的访问规则。Step S204, judging whether the access information conforms to the access rules of the target data.
当基于访问请求更新目标数据的访问信息后,可以进一步判断该更新后的访问信息是否符合目标数据的访问规则。After the access information of the target data is updated based on the access request, it may be further determined whether the updated access information complies with the access rules of the target data.
该步骤S204具体可以包括:判断访问信息中的读访问频率是否在访问规则的读访问频率阈值范围内;或者,判断访问信息中的写访问频率是否在访问规则的写访问频率阈值范围内;或者,判断访问信息中的读访问次数是否在访问规则的读访问次数阈值范围内。This step S204 may specifically include: judging whether the read access frequency in the access information is within the read access frequency threshold range of the access rule; or, judging whether the write access frequency in the access information is within the write access frequency threshold range of the access rule; or , to determine whether the number of read accesses in the access information is within the threshold range of the number of read accesses in the access rule.
在实际实现时,如果限速方式采用的是QPM的方式,则在访问规则中可以只设置读访问频率阈值,或者,只设置写访问频率阈值,或者,可以同时设置读访问频率阈值和写访问频率阈值;比如,如果并同时设置了读访问频率阈值和写访问频率阈值,当接收到针对目标数据的读访问请求后,可以更新访问信息中的读访问频率,并判断更新后的读访问频率是否在所设置的读访问频率阈值范围内,如果在该读访问频率阈值范围内,可以理解为该访问请求符合目标数据的访问规则;当接收到针对目标数据的写访问请求后,可以更新访问信息中的写访问频率,并判断更新后的写访问频率是否在所设置的写访问频率阈值范围内,如果在该写访问频率阈值范围内,可以理解为该访问请求符合目标数据的访问规则。In actual implementation, if the speed limit method adopts the QPM method, only the read access frequency threshold can be set in the access rule, or only the write access frequency threshold can be set, or both the read access frequency threshold and the write access can be set at the same time Frequency threshold; for example, if both the read access frequency threshold and the write access frequency threshold are set, when a read access request for the target data is received, the read access frequency in the access information can be updated and the updated read access frequency can be judged Whether it is within the set read access frequency threshold range, if it is within the read access frequency threshold range, it can be understood that the access request complies with the access rules of the target data; when a write access request for the target data is received, the access can be updated Write access frequency in the information, and judge whether the updated write access frequency is within the set write access frequency threshold range, if it is within the write access frequency threshold range, it can be understood that the access request complies with the access rules of the target data.
如果限速方式采用的是固定访问次数的方式,则在访问规则中通常只设置读访问次数阈值,比如,当接收到针对目标数据的读访问请求后,可以更新访问信息中的读访问次数,并判断更新后的读访问次数是否在所设置的读访问次数阈值范围内,如果在该读访问次数阈值范围内,可以理解为该访问请求符合目标数据的访问规则。用户可以根据实际需求选择适合的限速方式,并基于所选择的限速方式设置合适的阈值。If the speed limit method adopts a fixed number of access times, usually only the threshold of read access times is set in the access rules. For example, when a read access request for the target data is received, the number of read access times in the access information can be updated. And judge whether the updated read access times is within the set read access times threshold range, if it is within the read access times threshold range, it can be understood that the access request complies with the access rules of the target data. Users can choose a suitable speed limit method according to actual needs, and set an appropriate threshold based on the selected speed limit method.
步骤S206,如果访问请求符合目标数据的访问规则,处理访问请求。Step S206, if the access request conforms to the access rule of the target data, process the access request.
上述访问请求的处理方法,如果接收到针对目标数据的访问请求,基于访问请求更新目标数据的访问信息;判断访问信息是否符合目标数据的访问规则。如果访问请求符合目标数据的访问规则,处理访问请求。该方式中,用户可以直接通过对象存储服务器提供的规则输入接口输入规则信息,以生成访问规则,对象存储服务器接收到针对目标数据的访问请求后,可以直接判断该访问请求是否符合访问规则,不需要用户部署业务服务器,并在业务服务器上部署限流程序,降低了用户的开发成本和维护成本。In the above access request processing method, if the access request for the target data is received, the access information of the target data is updated based on the access request; and whether the access information conforms to the access rules of the target data is judged. If the access request matches the access rules of the target data, process the access request. In this method, users can directly input rule information through the rule input interface provided by the object storage server to generate access rules. After receiving an access request for target data, the object storage server can directly determine whether the access request complies with the access rules. Users are required to deploy a business server, and a flow limiting program is deployed on the business server, which reduces the user's development cost and maintenance cost.
本发明实施例提供了另一种访问请求的处理方法,该方法在上述实施例方法的基础上实现,该方法重点描述如果访问请求符合目标数据的访问规则,处理访问请求的具体过程,以及访问规则的生成过程;该方法中,对象存储服务器包括至少一个存储桶,目标数据存储在目标存储桶中;该存储桶是数据的载体,可以理解为存放数据的“容器”,且该“容器”无容量上限;对象存储服务器中通常包括多个存储桶。如图3所示,该方法包括如下步骤:The embodiment of the present invention provides another access request processing method, which is implemented on the basis of the methods in the above embodiments. This method focuses on describing the specific process of processing the access request if the access request conforms to the access rules of the target data, and the access The process of generating rules; in this method, the object storage server includes at least one storage bucket, and the target data is stored in the target storage bucket; the storage bucket is the carrier of data, which can be understood as a "container" for storing data, and the "container" No upper limit on capacity; object storage servers typically include multiple buckets. As shown in Figure 3, the method includes the following steps:
步骤S302,如果接收到针对目标数据的访问请求,获取目标存储桶对应的目标数据的访问规则。Step S302, if an access request for the target data is received, acquire an access rule for the target data corresponding to the target bucket.
在实际实现时,可以以存储桶为单位设置访问规则,即可以对每个存储桶设置该存储桶对应的访问规则;如果接收到针对目标数据的访问请求,由于该目标数据存储在目标存储桶中,可以获取该目标存储桶对应的目标数据的访问规则。具体的,上述访问规则通过下述步骤A和步骤B生成:In actual implementation, access rules can be set in units of buckets, that is, access rules corresponding to the bucket can be set for each bucket; if an access request for target data is received, since the target data is stored in the target bucket , you can get the access rules of the target data corresponding to the target bucket. Specifically, the above access rules are generated through the following steps A and B:
步骤A,接收指定用户通过规则输入接口输入的规则信息。Step A, receiving rule information input by a specified user through the rule input interface.
上述规则输入接口可以是图形化界面或API方式,指定用户可以通过该图形化界面或API方式输入规则信息,比如,在限速维度方面,可以选择输入一个或多个指定来源IP,也可以选择输入一个或多个指定用户代理信息,或者两种限速维度可以配合使用;在限速方式方面,可以选择QPM方式或者选择固定访问次数的方式,并基于所选择的限速方式设置对应的阈值等。The above-mentioned rule input interface can be a graphical interface or an API, through which a designated user can input rule information. For example, in terms of the speed limit dimension, one or more specified source IPs can be selected, or Enter one or more specified user agent information, or two speed limit dimensions can be used together; in terms of speed limit method, you can choose the QPM method or the method of fixed number of visits, and set the corresponding threshold based on the selected speed limit method wait.
步骤B,基于规则信息生成访问规则。Step B, generating an access rule based on the rule information.
在接收到指定用户输入的上述规则信息后,即可基于该规则信息生成访问规则。After receiving the above rule information input by the designated user, an access rule can be generated based on the rule information.
步骤S304,判断访问请求是否符合访问规则。Step S304, judging whether the access request complies with the access rule.
步骤S306,如果访问请求符合目标数据的访问规则,基于访问请求处理目标数据。Step S306, if the access request conforms to the access rule of the target data, process the target data based on the access request.
如果访问请求符合目标数据的访问规则,则可以访问该目标数据,比如,如果访问请求是针对目标数据的读访问请求,则可以将该目标数据发送至请求访问该目标数据的客户端;如果访问请求是针对目标数据的写访问请求,例如,用户通过客户端对目标数据进行了修改,需要将修改后的目标数据存储至对象存储服务器,则可以接收并保存该修改后的目标数据。If the access request conforms to the access rules of the target data, the target data can be accessed. For example, if the access request is a read access request for the target data, the target data can be sent to the client requesting to access the target data; if the access The request is a write access request for the target data. For example, if the user modifies the target data through the client and needs to store the modified target data in the object storage server, the modified target data can be received and saved.
上述访问请求的处理方法,如果接收到针对目标数据的访问请求,获取目标存储桶对应的目标数据的访问规则。判断访问请求是否符合访问规则。如果访问请求符合目标数据的访问规则,基于访问请求处理目标数据。该方式中,用户可以直接通过对象存储服务器提供的规则输入接口输入规则信息,以生成访问规则,对象存储服务器接收到针对目标数据的访问请求后,可以直接判断该访问请求是否符合访问规则,不需要用户部署业务服务器,并在业务服务器上部署限流程序,降低了用户的开发成本和维护成本。并且,该方式可以以存储桶为单位设置访问规则,细化了对访问请求的控制粒度,提高了控制的灵活性和控制精度。In the above method for processing the access request, if an access request for the target data is received, the access rule of the target data corresponding to the target bucket is obtained. Determine whether the access request complies with the access rules. If the access request complies with the access rules of the target data, the target data is processed based on the access request. In this method, users can directly input rule information through the rule input interface provided by the object storage server to generate access rules. After receiving an access request for target data, the object storage server can directly determine whether the access request complies with the access rules. Users are required to deploy a business server, and a flow limiting program is deployed on the business server, which reduces the user's development cost and maintenance cost. Moreover, in this way, access rules can be set in units of storage buckets, which refines the control granularity of access requests, and improves control flexibility and control precision.
为进一步理解上述实施例,下面提供如图4所示的一种创建存储桶访问次数管理规则界面示意图,其中包括:策略匹配、限速维度和限速方式三种限速配置项,在策略匹配这一配置项中,可以选择全部文件,也可以选择固定前缀的文件,即该限速规则(对应上述访问规则)的配置生效范围可以支持对整个存储桶中的文件生效,也可以支持对固定前缀的文件生效。如果选择对固定前缀的文件生效,通常会为输入的固定前缀的数量设置一个最大值,比如,支持最多100个固定前缀,可以达到对某个目录下文件的访问进行限速的目的,如果输入多个固定前缀,多个固定前缀不能有重叠部分,比如,配置固定前缀123/456后,不能再配置固定前缀123/,并且,两种匹配策略互斥,只可以选择全部文件或者选择固定前缀的文件,不能同时选择。In order to further understand the above embodiment, the following provides a schematic diagram of an interface for creating storage bucket access times management rules as shown in Figure 4, which includes three rate limit configuration items: policy matching, rate limit dimension and rate limit mode. In this configuration item, you can select all files or files with a fixed prefix, that is, the configuration effective range of the rate limit rule (corresponding to the above access rules) can support the effect on files in the entire storage bucket, and can also support fixed The files with the prefix take effect. If you choose to take effect on files with fixed prefixes, a maximum value is usually set for the number of input fixed prefixes. For example, a maximum of 100 fixed prefixes are supported, which can achieve the purpose of limiting the access speed of files in a certain directory. If you enter Multiple fixed prefixes, multiple fixed prefixes cannot overlap. For example, after configuring the fixed prefix 123/456, you cannot configure the fixed prefix 123/, and the two matching strategies are mutually exclusive. You can only select all files or select the fixed prefix files cannot be selected at the same time.
在限速维度这一配置项中,如果选择来源IP这一限速维度,则可以在来源IP对应的配置栏中输入一个或多个需要限制访问的IP地址,比如,可以设置最多100个IP地址;如果选择User Agent这一限速维度,则可以在User Agent对应的配置栏中输入一个或多个需要限制访问的User Agent,比如,可以设置最多100个User Agent;这两种限速维度也可以同时选择搭配使用,这时来源IP和User Agent是逻辑与的关系,即需要对同时满足两种限速维度的访问请求进行限速处理;比如,来源IP中包括一IP地址110.10.0.1,User Agent中包括Mozilla/5.0(Linux Android 4.2.1;M040),则需要对来自该IP地址,并且访问请求的请求头中包括Mozilla/5.0(Linux Android 4.2.1;M040)这一字符信息的访问请求进行限速处理。图4中的限速方式选择的是QPM方式,可以分别配置读操作对应的阈值(读访问频率阈值)和写操作对应的阈值(写访问频率阈值),图4中对两种阈值均设置为1000次,即超过1000次就拒绝访问,另外,为了更便于用户管理限速规则,增加限速规则的可读性,还可以在备注这一配置项中对限速规则作进一步补充说明,如“针对X业务进行限速保护”,表示该限速规则针对的是X业务。In the configuration item of the speed limit dimension, if the source IP is selected as the speed limit dimension, you can enter one or more IP addresses that need to restrict access in the configuration column corresponding to the source IP. For example, you can set up to 100 IPs Address; if you choose User Agent as the speed limit dimension, you can enter one or more User Agents whose access needs to be restricted in the configuration column corresponding to User Agent. For example, you can set up to 100 User Agents; these two speed limit dimensions You can also choose to use it together. At this time, the source IP and the User Agent are in a logical AND relationship, that is, it is necessary to perform speed limit processing on access requests that satisfy both speed limit dimensions; for example, the source IP includes an IP address 110.10.0.1 , the User Agent includes Mozilla/5.0 (Linux Android 4.2.1; M040), then it is necessary to include the character information of Mozilla/5.0 (Linux Android 4.2.1; M040) in the request header of the access request from this IP address rate-limited access requests. The speed limit mode in Figure 4 is the QPM mode, and the threshold corresponding to the read operation (read access frequency threshold) and the threshold corresponding to the write operation (write access frequency threshold) can be configured separately. In Figure 4, both thresholds are set to 1000 times, that is, if more than 1000 times, the access will be denied. In addition, in order to make it easier for users to manage the speed limit rules and increase the readability of the speed limit rules, you can also make further supplementary instructions on the speed limit rules in the configuration item Remarks, such as "Speed limit protection for X business" indicates that the speed limit rule is for X business.
参见图5所示的另一种创建存储桶访问次数管理规则界面示意图,其中策略匹配和限速维度可以参考针对图4的相关描述,图5中的限速方式采用的是固定次数方式,即,对某种资源的请求次数是固定的,该方式可以配置读操作对应的阈值,如图5中对该阈值设置为1000次。表示在指定时间段内,仅能对某个文件的下载操作进行1000次,超过1000次即拒绝访问。Refer to Figure 5 for another schematic diagram of the interface for creating bucket access times management rules, in which policy matching and speed limit dimensions can refer to the relevant descriptions in Figure 4, and the speed limit method in Figure 5 adopts a fixed number of times, that is, , the number of requests for a certain resource is fixed. In this method, the threshold corresponding to the read operation can be configured. As shown in Figure 5, the threshold is set to 1000 times. It means that within the specified time period, only 1000 download operations can be performed on a certain file, and access will be denied if the download operation exceeds 1000 times.
存储桶访问次数管理规则设置后通常需要等待一段时间才能生效,比如设置后需要2分钟生效,因为该功能需要依托对象存储服务器基于用户单桶维度与文件前缀维度的访问监控实现,规则下发全局的实时访问监控系统,并初始访问统计生效需要2分钟以内的时间,限速规则生效后,对象存储服务器的实时访问监控系统,会获取实时访问情况分析,对满足访问次数管理的存储桶,进行访问次数的监控。Bucket access times management rules usually take a while to take effect after being set, for example, it takes 2 minutes to take effect after setting, because this function needs to rely on the object storage server to implement access monitoring based on the user single bucket dimension and file prefix dimension, and the rules are issued globally It takes less than 2 minutes for the initial access statistics to take effect. After the rate limit rule takes effect, the real-time access monitoring system of the object storage server will obtain real-time access analysis and perform Monitoring of visits.
对象存储服务器可能包括多个存储桶,每个存储桶都可以支持配置多条限速规则,比如,最多可以支持单个存储桶配置20条限速规则。参见表1所示的一种存储桶访问次数管理规则列表,该列表中针对存储桶X配置了4条限速规则,每条限速规则中配置有各自对应的策略匹配、限速维度、限速方式、创建时间和备注信息;另外,存储桶访问次数管理功能支持用户修改限流规则,具体可以选择表1中操作一栏中的“编辑”选项,以对限流规则进行修改,还可以支持终结限流规则,具体可以选择表1中操作一栏中的“删除”选项,以删除某条限速规则,同样规则缓存与新规则的刷新操作也需要耗时约2分钟生效。An object storage server may include multiple storage buckets, and each storage bucket can support the configuration of multiple rate-limiting rules. For example, a single storage bucket can support up to 20 rate-limiting rules. See Table 1 for a list of bucket access times management rules. In this list, four rate limit rules are configured for bucket X. Each rate limit rule is configured with its corresponding policy matching, rate limit dimension, limit speed mode, creation time, and remarks; in addition, the storage bucket access times management function supports users to modify the current limiting rules. Specifically, you can select the "Edit" option in the operation column in Table 1 to modify the current limiting rules. It supports the termination of rate limiting rules. Specifically, you can select the "Delete" option in the operation column in Table 1 to delete a certain rate limiting rule. It also takes about 2 minutes for the rule cache and the refresh operation of the new rule to take effect.
表1Table 1
若访问请求触发了限速规则,比如,触发了表1中的规则一,对123开头的文件,下载(读操作)访问次数到达了100次,则以后再对123开头的文件将被公有云对象存储服务器拒绝,返回403,访问被拒绝,错误信息为Trigger bucket current limiting,即触发存储空间限流策略。If the access request triggers the rate limit rule, for example, rule 1 in Table 1 is triggered, and the number of downloads (read operations) for files starting with 123 reaches 100 times, then the files starting with 123 will be deleted by the public cloud in the future. The object storage server refuses, returns 403, access is denied, and the error message is Trigger bucket current limiting, that is, the storage space current limiting policy is triggered.
相关技术中,对象存储服务器对外提供数据存取与管理数据的接口,但是并不支持用户根据自身的需要对接口或服务限流,公有云对象存储服务器无法提供灵活的限流方式,需要每个用户单独开发限流程序,并部署到各自对应的业务服务器上,通过业务服务器中部署的限流程序实现对API调用频率的限制,以实现限流,不同的用户需要重复实现类似的限流程序;本申请中的限速配置方式中,公有云对象存储服务器将限速功能抽象出通用的逻辑,支持对固定来源IP或者User Agent设置访问QPM或固定次数限制,即可以支持三种限速维度管理和两种限速方式配置,并且,支持用户针对公有云端数据存储桶进行访问频次配置:用户可以根据实际需求搭配组成存储桶限速规则,即,访问规则可以设置在存储桶维度,可以支持整个存储桶或者存储桶中固定前缀的文件进行细粒度的控制。In related technologies, the object storage server provides external data access and data management interfaces, but does not support users to limit the flow of interfaces or services according to their own needs. The public cloud object storage server cannot provide flexible flow limitation methods, and each Users independently develop current limiting programs and deploy them on their corresponding business servers. The frequency of API calls is restricted through the current limiting programs deployed in the business servers to achieve current limiting. Different users need to implement similar current limiting programs repeatedly. ;In the speed limit configuration method in this application, the public cloud object storage server abstracts the speed limit function out of general logic, and supports setting access QPM or fixed times limit for fixed source IP or User Agent, that is, it can support three speed limit dimensions Management and two speed limit configurations, and support users to configure access frequency for public cloud data storage buckets: users can combine bucket speed limit rules according to actual needs, that is, access rules can be set in the bucket dimension, which can support Fine-grained control over the entire bucket or files with a fixed prefix in the bucket.
另外,本申请中的限速配置方式可通过在图形化界面或API方式简单设置规则后便可生效,业务侧限速功能由云端对象存储服务器来实现,不需要用户在业务侧实现限流,不需要用户重复类似的限流逻辑。若业务侧是直接上传或者下载云端数据,如果需要实现限流功能,可通过云端对象存储服务器实现,无需增加用户业务服务器,也不需要在业务服务器上部署限流程序,从而可以节约用户的开发成本和维护成本。In addition, the speed limit configuration method in this application can take effect after simply setting rules on the graphical interface or API. The speed limit function on the business side is realized by the cloud object storage server, which does not require users to implement traffic limit on the business side. There is no need for users to repeat similar current limiting logic. If the business side is directly uploading or downloading cloud data, if the current limiting function needs to be implemented, it can be implemented through the cloud object storage server, without adding user business servers, and without deploying current limiting programs on the business servers, which can save users' development costs and maintenance costs.
本发明实施例提供了一种访问请求的处理装置,装置设置于对象存储服务器;目标数据存储在对象存储服务器中;如图6所示,该装置包括:判断模块60,用于如果接收到针对目标数据的访问请求,判断访问请求是否符合目标数据的访问规则;其中,访问规则基于指定用户输入的规则信息生成;规则信息由指定用户通过对象存储服务器提供的规则输入接口输入;处理模块61,用于如果访问请求符合目标数据的访问规则,处理访问请求。An embodiment of the present invention provides an access request processing device, which is set in an object storage server; target data is stored in the object storage server; as shown in FIG. The access request of the target data, judging whether the access request conforms to the access rules of the target data; wherein, the access rules are generated based on the rule information input by the specified user; the rule information is input by the specified user through the rule input interface provided by the object storage server; the
上述访问请求的处理装置,设置于对象存储服务器;目标数据存储在对象存储服务器中;如果接收到针对目标数据的访问请求,判断访问请求是否符合目标数据的访问规则;该访问规则基于指定用户输入的规则信息生成;规则信息由指定用户通过对象存储服务器提供的规则输入接口输入;如果访问请求符合目标数据的访问规则,处理访问请求。该装置中,用户可以直接通过对象存储服务器提供的规则输入接口输入规则信息,以生成访问规则,对象存储服务器接收到针对目标数据的访问请求后,可以直接判断该访问请求是否符合访问规则,不需要用户部署业务服务器,并在业务服务器上部署限流程序,降低了用户的开发成本和维护成本。The above-mentioned access request processing device is set in the object storage server; the target data is stored in the object storage server; if an access request for the target data is received, it is judged whether the access request conforms to the access rules of the target data; the access rules are based on the specified user input The rule information is generated; the rule information is input by the designated user through the rule input interface provided by the object storage server; if the access request conforms to the access rules of the target data, the access request is processed. In this device, users can directly input rule information through the rule input interface provided by the object storage server to generate access rules. After receiving an access request for target data, the object storage server can directly determine whether the access request complies with the access rules. Users are required to deploy a business server, and a flow limiting program is deployed on the business server, which reduces the user's development cost and maintenance cost.
进一步的,判断模块还用于:如果接收到针对目标数据的访问请求,基于访问请求更新目标数据的访问信息;其中,访问信息包括:在指定时间段内的读访问次数、读访问频率或写访问频率;判断访问信息是否符合目标数据的访问规则。Further, the judging module is also used for: if an access request for the target data is received, update the access information of the target data based on the access request; wherein, the access information includes: the number of read accesses, the frequency of read access or the number of write accesses within a specified time period Access frequency; determine whether the access information complies with the access rules of the target data.
进一步的,访问规则包括至少一个指定来源地址;判断模块还用于:如果接收到针对目标数据的访问请求,判断发送访问请求的地址是否属于指定来源地址;如果属于指定来源地址,基于访问请求更新目标数据的访问信息。Further, the access rule includes at least one specified source address; the judging module is also used to: if an access request for the target data is received, determine whether the address sending the access request belongs to the specified source address; if it belongs to the specified source address, update the address based on the access request Access information for the target data.
进一步的,访问规则包括:至少一个指定用户代理信息;判断模块还用于:如果接收到针对目标数据的访问请求,判断访问请求的请求头中是否包括指定用户代理信息;如果包括指定用户代理信息,基于访问请求更新目标数据的访问信息。Further, the access rule includes: at least one specified user agent information; the judging module is also used to: if an access request for the target data is received, determine whether the specified user agent information is included in the request header of the access request; if the specified user agent information is included , update the access information of the target data based on the access request.
进一步的,访问规则还包括:目标数据的数据名称中需要包含的指定字符;判断模块还用于:如果接收到针对目标数据的访问请求,判断目标数据的数据名称中是否包含指定字符;如果目标数据的数据名称中包含指定字符,基于访问请求更新当前访问信息。Further, the access rule also includes: specified characters that need to be included in the data name of the target data; the judging module is also used to: if an access request for the target data is received, determine whether the data name of the target data contains specified characters; The data name of the data contains specified characters, and the current access information is updated based on the access request.
进一步的,判断模块还用于:判断访问信息中的读访问频率是否在访问规则的读访问频率阈值范围内;或者,判断访问信息中的写访问频率是否在访问规则的写访问频率阈值范围内;或者,判断访问信息中的读访问次数是否在访问规则的读访问次数阈值范围内。Further, the judging module is also used to: judge whether the read access frequency in the access information is within the read access frequency threshold range of the access rule; or judge whether the write access frequency in the access information is within the write access frequency threshold range of the access rule ; Or, determine whether the number of read accesses in the access information is within the threshold range of the number of read accesses in the access rule.
进一步的,处理模块还用于:如果访问请求符合目标数据的访问规则,基于访问请求处理目标数据。Further, the processing module is further configured to: if the access request conforms to the access rule of the target data, process the target data based on the access request.
进一步的,装置还包括生成模块,访问规则通过生成模块生成:接收指定用户通过规则输入接口输入的规则信息;基于规则信息生成访问规则。Further, the device further includes a generation module, through which access rules are generated: receiving rule information input by a specified user through a rule input interface; and generating access rules based on the rule information.
进一步的,对象存储服务器包括至少一个存储桶,目标数据存储在目标存储桶中;判断模块还用于:如果接收到针对目标数据的访问请求,获取目标存储桶对应的目标数据的访问规则;判断访问请求是否符合访问规则。Further, the object storage server includes at least one storage bucket, and the target data is stored in the target storage bucket; the judging module is also used to: if an access request for the target data is received, obtain the access rule of the target data corresponding to the target storage bucket; judge Whether the access request complies with the access rules.
本发明实施例所提供的访问请求的处理装置,其实现原理及产生的技术效果和前述访问请求的处理方法实施例相同,为简要描述,访问请求的处理装置实施例部分未提及之处,可参考前述访问请求的处理方法实施例中相应内容。The implementation principle and technical effect of the access request processing device provided by the embodiment of the present invention are the same as the aforementioned access request processing method embodiment. For a brief description, the part of the access request processing device embodiment that is not mentioned, Reference may be made to the corresponding content in the foregoing access request processing method embodiments.
本发明实施例还提供了一种服务器,参见图7所示,该服务器包括处理器130和存储器131,该存储器131存储有能够被处理器130执行的机器可执行指令,该处理器130执行机器可执行指令以实现上述访问请求的处理方法。The embodiment of the present invention also provides a server, as shown in FIG. 7, the server includes a
进一步地,图7所示的服务器还包括总线132和通信接口133,处理器130、通信接口133和存储器131通过总线132连接。Further, the server shown in FIG. 7 also includes a bus 132 and a
其中,存储器131可能包含高速随机存取存储器(RAM,Random Access Memory),也可能还包括非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。通过至少一个通信接口133(可以是有线或者无线)实现该系统网元与至少一个其他网元之间的通信连接,可以使用互联网,广域网,本地网,城域网等。总线132可以是ISA总线、PCI总线或EISA总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图7中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。Wherein, the memory 131 may include a high-speed random access memory (RAM, Random Access Memory), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 133 (which may be wired or wireless), and the Internet, wide area network, local network, metropolitan area network, etc. can be used. The bus 132 can be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one double-headed arrow is used in FIG. 7 , but it does not mean that there is only one bus or one type of bus.
处理器130可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器130中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器130可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(DigitalSignal Processor,简称DSP)、专用集成电路(Application Specific IntegratedCircuit,简称ASIC)、现场可编程门阵列(Field-Programmable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本发明实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器131,处理器130读取存储器131中的信息,结合其硬件完成前述实施例的方法的步骤。The
本发明实施例还提供了一种机器可读存储介质,该机器可读存储介质存储有机器可执行指令,该机器可执行指令在被处理器调用和执行时,该机器可执行指令促使处理器实现上述访问请求的处理方法,具体实现可参见方法实施例,在此不再赘述。The embodiment of the present invention also provides a machine-readable storage medium, the machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to To realize the processing method of the above access request, the specific implementation may refer to the method embodiment, which will not be repeated here.
本发明实施例所提供的访问请求的处理方法、装置和服务器的计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令可用于执行前面方法实施例中所述的方法,具体实现可参见方法实施例,在此不再赘述。The computer program product of the access request processing method, device, and server provided by the embodiments of the present invention includes a computer-readable storage medium storing program codes, and the instructions included in the program codes can be used to execute the method described in the preceding method embodiments. For the specific implementation of the method, refer to the method embodiments, which will not be repeated here.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present invention. 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. .
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present invention. scope.
Claims (12)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110997001.8A CN115733801A (en) | 2021-08-27 | 2021-08-27 | Access request processing method and device and server |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110997001.8A CN115733801A (en) | 2021-08-27 | 2021-08-27 | Access request processing method and device and server |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115733801A true CN115733801A (en) | 2023-03-03 |
Family
ID=85290369
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110997001.8A Pending CN115733801A (en) | 2021-08-27 | 2021-08-27 | Access request processing method and device and server |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115733801A (en) |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102096595A (en) * | 2009-08-23 | 2011-06-15 | 美国银行公司 | Dynamic configuration system |
| CN106060112A (en) * | 2016-05-09 | 2016-10-26 | 乐视控股(北京)有限公司 | Method and device of limiting file downloading number of times based on object storage |
| CN107704765A (en) * | 2017-08-28 | 2018-02-16 | 深圳市诚壹科技有限公司 | A kind of interface access method, server and computer-readable recording medium |
| CN108111511A (en) * | 2017-12-20 | 2018-06-01 | 杭州云屏科技有限公司 | One kind shares file access method, device, equipment and storage medium |
| CN110535777A (en) * | 2019-08-12 | 2019-12-03 | 新华三大数据技术有限公司 | Access request control method, device, electronic equipment and readable storage medium storing program for executing |
| CN111931030A (en) * | 2020-07-30 | 2020-11-13 | 中粮招商局(深圳)粮食电子交易中心有限公司 | Request adaptation method, device, equipment and storage medium based on heterogeneous system |
| CN113010818A (en) * | 2021-02-23 | 2021-06-22 | 腾讯科技(深圳)有限公司 | Access current limiting method and device, electronic equipment and storage medium |
-
2021
- 2021-08-27 CN CN202110997001.8A patent/CN115733801A/en active Pending
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102096595A (en) * | 2009-08-23 | 2011-06-15 | 美国银行公司 | Dynamic configuration system |
| CN106060112A (en) * | 2016-05-09 | 2016-10-26 | 乐视控股(北京)有限公司 | Method and device of limiting file downloading number of times based on object storage |
| CN107704765A (en) * | 2017-08-28 | 2018-02-16 | 深圳市诚壹科技有限公司 | A kind of interface access method, server and computer-readable recording medium |
| CN108111511A (en) * | 2017-12-20 | 2018-06-01 | 杭州云屏科技有限公司 | One kind shares file access method, device, equipment and storage medium |
| CN110535777A (en) * | 2019-08-12 | 2019-12-03 | 新华三大数据技术有限公司 | Access request control method, device, electronic equipment and readable storage medium storing program for executing |
| CN111931030A (en) * | 2020-07-30 | 2020-11-13 | 中粮招商局(深圳)粮食电子交易中心有限公司 | Request adaptation method, device, equipment and storage medium based on heterogeneous system |
| CN113010818A (en) * | 2021-02-23 | 2021-06-22 | 腾讯科技(深圳)有限公司 | Access current limiting method and device, electronic equipment and storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3605352B1 (en) | Short-link parsing method, apparatus and device | |
| US9509790B2 (en) | Global presence | |
| CN115428403B (en) | Logically implementing client-side policies on client-side | |
| CN106656920B (en) | Processing method, device, storage medium and the processor of HTTP service | |
| CN114500537B (en) | Container service access method, system, storage medium and electronic equipment | |
| US20160380816A1 (en) | System and method for configuring a data access system | |
| CN109033302A (en) | A kind of method for page jump, device, terminal and storage medium | |
| CN107491700B (en) | Data access method and equipment | |
| CN111090449A (en) | API service access method, device and electronic device | |
| RU2348066C2 (en) | Communication terminal | |
| CN112579180B (en) | Application program keep alive method and device | |
| WO2019071928A1 (en) | Method and apparatus for implementing list view, and readable storage medium and device | |
| CN112073366B (en) | Data processing method for railway financial system and data center | |
| CN110413423B (en) | Data processing method, related device, equipment and storage medium | |
| WO2024249142A1 (en) | Performing a security action with regard to an access token based on clustering of access requests | |
| CN115733801A (en) | Access request processing method and device and server | |
| CN112733510A (en) | Financial certificate generation method, device, equipment and computer readable storage medium | |
| CN110545328A (en) | Non-invasive service function expansion enhancing method and device and server | |
| CN117076046A (en) | Cloud container multi-level access method and device, storage medium and chip | |
| CN115756549A (en) | Method and device for downloading data of big data middlebox and storage medium | |
| CN108881257A (en) | Distributed search cluster encrypted transmission method and encrypted transmission distributed search cluster | |
| CN115242516A (en) | Access rights management method, device, device and storage medium | |
| CN114817285A (en) | Data updating method, device, storage medium and device | |
| CN115633038A (en) | Load balancing implementation method, device, medium and equipment | |
| CN115801769A (en) | Channel package obtaining method, electronic device 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 |