Speed limiting configuration method and device, interface speed limiting method and device and electronic equipment
By establishing a speed limit configuration method between the management platform and the target access device, and generating speed limit configuration information based on the service type and number of accesses, the problem of inability to flexibly limit speed in the existing technology is solved, and flexible limits for different services are achieved Speed, improves the access efficiency of the interface.
Patent Information
- Application Number
- CN202411352898.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2024-12-10
Smart Images

Figure CN119109877A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a speed limit configuration method, an interface speed limit method, a device and an electronic device. Background Art
[0002] Currently, when service providers provide services to service users, in order to avoid interface congestion when encountering continuous high-concurrency data access and to ensure that all devices of service users can access the service provider's devices through the interface, they will limit the speed of the interface. For example, the speed limit for the advertising media interface is set to 10 times / second.
[0003] In the prior art, a speed limit is directly set for the interface so that the interface processes all data flows accessed through the interface according to the speed limit. For example, when both service A and service B need to be accessed through the advertising media interface, the advertising media interface processes the data flows of service A and service B according to the speed limit of the advertising media interface.
[0004] However, the applicant has found that the existing speed limiting method cannot flexibly limit the speed of different services. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a speed limit configuration method, an interface speed limit method, a device and an electronic device to improve the flexibility of interface speed limit so as to flexibly limit the speed of different services. The specific technical solution is as follows:
[0006] In a first aspect of the present invention, a speed limit configuration method is first provided, which is applied to a management platform, wherein the management platform is connected to a target access terminal device in communication, and a service is running on the target access terminal device; the target access terminal device is connected to a target accessed device in communication, and a target interface is provided on the target accessed device. The method comprises:
[0007] When the rate limit configuration instruction is obtained, the target service that can access the target interface is displayed;
[0008] Obtain speed limit setting information set for a target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0009] According to the target service, determine the target access terminal device running the target service;
[0010] According to the speed limit setting information, speed limit configuration information is generated, and the speed limit configuration information is sent to the target access end device, so that the target access end device configures the speed limit configuration information to the SDK (Software Development Kit) running thereon, and after obtaining the access request sent by the target service, sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
[0011] In a second aspect of an embodiment of the present invention, an interface speed limiting method is also provided, which is applied to an SDK running on a target access terminal device, the target access terminal device is communicatively connected to a management platform; the access terminal device is also communicatively connected to a target accessed device, and a target interface is provided on the target accessed device, the method comprising:
[0012] Obtain the speed limit configuration information corresponding to the target service sent by the management platform, and configure the speed limit configuration information, the speed limit configuration information including: the speed limit type and the second maximum number of accesses corresponding to the speed limit type within the preset speed limit period; the speed limit type includes: shared speed limit and / or private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0013] When obtaining an access request from a target service on a target access terminal device to a target accessed device, determining whether there is a private speed limit corresponding to the target service;
[0014] If there is a private speed limit corresponding to the target service, determine whether the target service has a remaining number of private accesses in the current speed limit period; the remaining number of private accesses is the difference between the second maximum number of accesses to the private speed limit corresponding to the target service and the total number of historical private accesses to the target service in the current speed limit period;
[0015] If there is a remaining private access count, sending an access request to a target interface of a target accessed device based on the remaining private access count, so that the target accessed device responds to the access request;
[0016] If there is no private speed limit corresponding to the target service, determine whether there is a shared speed limit corresponding to the target service;
[0017] If there is a shared speed limit corresponding to the target service, determine whether the target service has a remaining shared access count in the current speed limit period, where the remaining shared access count is the difference between the second maximum access count of the shared speed limit corresponding to the target service and the total number of historical shared access counts of all services sharing the second maximum access count in the current speed limit period;
[0018] If there is a remaining shared access number, an access request is sent to the target interface of the target accessed device based on the remaining shared access number, so that the target accessed device responds to the access request.
[0019] In a third aspect of the present invention, a speed limit configuration device is provided, which is applied to a management platform, the management platform is connected to a target access terminal device in communication, a service is running on the target access terminal device; the target access terminal device is connected to a target accessed device in communication, a target interface is provided on the target accessed device, and the device comprises:
[0020] A display module is used to display the target service that can access the target interface when the rate limit configuration instruction is obtained;
[0021] A first acquisition module is used to acquire speed limit setting information set for a target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0022] A determination module, used to determine a target access terminal device running a target service according to the target service;
[0023] A generation module is used to generate speed limit configuration information according to the speed limit setting information, and send the speed limit configuration information to the target access terminal device, so that the target access terminal device configures the speed limit configuration information to the SDK running thereon, and after obtaining the access request sent by the target service, sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
[0024] In a fourth aspect of the present invention, an interface speed limiting device is provided, which is applied to an SDK running on a target access terminal device, the target access terminal device is connected to a management platform in communication; the access terminal device is also connected to a target accessed device in communication, and a target interface is provided on the target accessed device, the device comprising:
[0025] The second acquisition module is used to acquire the speed limit configuration information corresponding to the target service sent by the management platform, and configure the speed limit configuration information, wherein the speed limit configuration information includes: the speed limit type and the second maximum number of accesses corresponding to the speed limit type within the preset speed limit period; the speed limit type includes: shared speed limit and / or private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0026] A judgment module, used to judge whether there is a private speed limit corresponding to the target service when obtaining an access request of the target service on the target access terminal device to the target accessed device;
[0027] If there is a private speed limit corresponding to the target service, determine whether the target service has a remaining number of private accesses in the current speed limit period; the remaining number of private accesses is the difference between the second maximum number of accesses to the private speed limit corresponding to the target service and the total number of historical private accesses to the target service in the current speed limit period;
[0028] If there are remaining private access times, triggering the first sending module;
[0029] A first sending module, configured to send an access request to a target interface of a target accessed device based on the remaining private access count, so that the target accessed device responds to the access request;
[0030] If there is no private speed limit corresponding to the target service, determine whether there is a shared speed limit corresponding to the target service;
[0031] If there is a shared speed limit corresponding to the target service, determine whether the target service has a remaining shared access count in the current speed limit period, where the remaining shared access count is the difference between the second maximum access count of the shared speed limit corresponding to the target service and the total number of historical shared access counts of all services sharing the second maximum access count in the current speed limit period;
[0032] If there are remaining shared access times, triggering the second sending module;
[0033] The second sending module is used to send the access request to the target interface of the target accessed device based on the remaining shared access times, so that the target accessed device responds to the access request.
[0034] In a fifth aspect of the present invention, a management platform is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0035] Memory, used to store computer programs;
[0036] The processor is used to implement any of the above-mentioned speed limit configuration methods when executing the program stored in the memory.
[0037] In a sixth aspect of the present invention, a target access terminal device is provided, the target access terminal device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0038] Memory, used to store computer programs;
[0039] The processor is used to implement any of the above-mentioned interface speed limiting methods when executing the program stored in the memory.
[0040] In the seventh aspect of the implementation of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored. When the computer program is executed by a processor, any of the above-mentioned speed limit configuration methods or interface speed limit methods is implemented.
[0041] In an eighth aspect of the implementation of the present invention, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned speed limit configuration methods or interface speed limit methods.
[0042] In the ninth aspect of the implementation of the present invention, a speed limiting system is also provided, which includes: the management platform shown in the fifth aspect above, the target access end device and the target accessed device shown in the sixth aspect above, the management platform is communicatively connected with the target access end device, and a service is running on the target access end device; the target access end device is communicatively connected with the target accessed device, and a target interface is set on the target accessed device.
[0043] The embodiments of the present invention provide a speed limit configuration method, an interface speed limit method, a device and an electronic device, wherein the speed limit configuration method can display a target service that can access a target interface when a speed limit configuration instruction is obtained; then obtain the speed limit setting information set for the target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; a private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; a shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period; then, according to the target service, determine the target access terminal device running the target service; finally, according to the speed limit setting information, generate the speed limit configuration information, and send the speed limit configuration information to the target access terminal device, so that the target access terminal device configures the speed limit configuration information to the SDK running thereon, and sends an access request to the accessed device through the speed limit configuration information configured on the SDK. Therefore, the target interface can use the corresponding speed limit configuration information for different services to limit the speed, thereby improving the flexibility of the interface in limiting the speed of services, so as to flexibly limit the speed of different services. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0045] Figure 1 This is a schematic diagram of the structure of a first architecture of a speed limit system in an embodiment of the present invention;
[0046] Figure 2 This is a flow chart of a first implementation method of a speed limit configuration method in an embodiment of the present invention;
[0047] Figure 3 This is a flow chart of a first implementation of an interface rate limiting method in an embodiment of the present invention;
[0048] Figure 4 This is a schematic diagram of the structure of a second architecture of a speed limit system in an embodiment of the present invention;
[0049] Figure 5 This is a flow chart of a second implementation of a speed limit configuration method in an embodiment of the present invention;
[0050] Figure 6 This is a flow chart of a second implementation of an interface rate limiting method in an embodiment of the present invention;
[0051] Figure 7 This is a flow chart of a third implementation of a speed limit configuration method in an embodiment of the present invention;
[0052] Figure 8 This is a flow chart of a third implementation of an interface rate limiting method in an embodiment of the present invention;
[0053] Fig. 9 This is a flow chart of a fourth implementation of a speed limit configuration method in an embodiment of the present invention;
[0054] Fig.10 This is a flow chart of a fourth implementation of an interface rate limiting method in an embodiment of the present invention;
[0055] Fig.11 This is a schematic diagram of the structure of a speed limit configuration device in an embodiment of the present invention;
[0056] Fig.12 This is a schematic diagram of the structure of an interface speed limiting device in an embodiment of the present invention;
[0057] Fig.13 This is a schematic diagram of the structure of a management platform in an embodiment of the present invention;
[0058] Fig.14 The figure is a schematic diagram of the structure of a target access terminal device in an embodiment of the present invention. DETAILED DESCRIPTION
[0059] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0060] In some examples, a speed limit is directly set for the interface so that the interface processes all data streams accessed through the interface according to the speed limit. For example, when both service A and service B need to be accessed through the advertising media interface, the advertising media interface processes the data streams of service A and service B according to the speed limit of the advertising media interface.
[0061] However, the applicant has found that the existing speed limiting method cannot flexibly limit the speed of different services.
[0062] In order to solve the problems existing in the prior art, the embodiments of the present invention provide a speed limit configuration method, an interface speed limit method, an apparatus and an electronic device to improve the flexibility of interface speed limit so as to flexibly limit the speed of different services.
[0063] First, an application scenario of a speed limit configuration method and an interface speed limit method according to an embodiment of the present invention is introduced. Figure 1 As shown, it is a structural diagram of the first architecture of a speed limit system according to an embodiment of the present invention. The above-mentioned speed limit configuration method and interface speed limit method can be applied to the speed limit system. The speed limit system can include a management platform 110, a target access terminal device 120, and a target accessed device 130. The target accessed device is provided with a target interface. The target access terminal device can be provided with a service and an SDK. The service can be used to provide services to a client connected to the target access terminal device in communication. The service can send an access request to the target interface on the target accessed device through the SDK to obtain data from the target accessed device. Among them, the above-mentioned speed limit configuration method can be applied to the management platform 110 in the speed limit system, and the above-mentioned interface speed limit method can be applied to the target access terminal device 120 in the speed limit system.
[0064] The following is an introduction to the speed limit configuration method of the embodiment of the present invention. Figure 2 FIG. 1 is a flow chart of a first implementation of a method for configuring a speed limit in an embodiment of the present invention. The method may include:
[0065] S210, when the rate limit configuration instruction is obtained, displaying the target service that can access the target interface;
[0066] S220, obtaining speed limit setting information set for the target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0067] S230, determining a target access terminal device running the target service according to the target service;
[0068] S240, generating speed limit configuration information according to the speed limit setting information, and sending the speed limit configuration information to the target access terminal device, so that the target access terminal device configures the speed limit configuration information to the SDK running thereon, and sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
[0069] In some examples, when a user needs to set a speed limit, the user can first open the software for configuring the speed limit on the management platform. At this time, the software for configuring the speed limit on the management platform can display an interface, on which interfaces of various accessed devices can be displayed. The user can select an interface as a target interface to be speed-limited. At this time, the management platform can confirm that a speed limit configuration instruction for speed-limiting the target interface has been obtained, and then the target service for accessing the target interface can be displayed;
[0070] The user can then enter the speed limit setting information set for each target service on the interface that displays the target service for accessing the target interface. The speed limit setting information includes: the speed limit type and the second maximum number of accesses corresponding to the speed limit type within the preset speed limit period; the speed limit type includes: shared speed limit and / or private speed limit; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; for example, assuming that a shared speed limit is set for service A and service B, the second maximum number of accesses corresponding to the shared speed limit indicates the maximum number of times service A and service B can access together within the preset speed limit period. When the sum of the number of accesses corresponding to the shared speed limit of service A and the number of accesses corresponding to the shared speed limit of service B is greater than the second maximum number of accesses corresponding to the shared speed limit, services A and B are not allowed to access the target interface.
[0071] Private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; for example, assuming that a private speed limit is set for service A, service A is prohibited from accessing the target interface only when the number of accesses corresponding to the private speed limit of service A within the preset speed limit period is greater than the second maximum number of accesses corresponding to the private speed limit of service A.
[0072] In some other examples, the preset speed limit period may be 1 second, 1 minute, etc. This can all be set based on experience.
[0073] In some examples, the second maximum number of accesses is set based on the first maximum number of accesses of the target interface within a preset speed limit period; for example, assuming that the first maximum number of accesses of interface C within 1 second is 10 times, the corresponding second maximum number of accesses for the private speed limit setting of service A can be 2 times, the corresponding second maximum number of accesses for the private speed limit setting of service B can be 3 times, and the second maximum number of accesses corresponding to the shared speed limit set for services A and B can be 5 times.
[0074] After obtaining the speed limit setting information, in order to set a corresponding speed limit for the target service, the target access terminal device running the target service may be determined according to the target service;
[0075] In some examples, the target service may be multiple services, and the multiple services may be services on one access terminal device or services on multiple access terminal devices.
[0076] In some other examples, the management platform may store the corresponding relationship between the identification information of each service and the identification information of the access terminal device running each service. Therefore, the management platform may determine the target access terminal device running the target service according to the corresponding relationship.
[0077] Then, speed limit configuration information can be generated based on the speed limit setting information, and the speed limit configuration information can be sent to the target access end device. In this way, after obtaining the speed limit configuration information, the target access end device can configure the speed limit configuration information to the SDK running on it, so that after obtaining the access request sent by the target service, the access request can be sent to the accessed device through the speed limit configuration information configured on the SDK.
[0078] A speed limit configuration method provided by an embodiment of the present invention can display a target service that can access a target interface when a speed limit configuration instruction is obtained; then obtain the speed limit setting information set for the target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period; then according to the target service, determine the target access terminal device running the target service; finally, according to the speed limit setting information, generate speed limit configuration information, and send the speed limit configuration information to the target access terminal device, so that the target access terminal device configures the speed limit configuration information to the SDK running thereon, and sends an access request to the accessed device through the speed limit configuration information configured on the SDK. Thus, the target interface can use the corresponding speed limit configuration information for different services to limit the speed, thereby improving the flexibility of the interface to limit the speed of the service, so as to flexibly limit the speed of different services.
[0079] Corresponding to the above-mentioned speed limit configuration method, the embodiment of the present invention also provides an interface speed limit method, such as Figure 3 FIG. 1 is a flowchart of a first implementation of an interface rate limiting method in an embodiment of the present invention. The method may include:
[0080] S310, obtaining the speed limit configuration information corresponding to the target service sent by the management platform, and configuring the speed limit configuration information; the speed limit configuration information includes: the speed limit type and the second maximum number of accesses corresponding to the speed limit type within the preset speed limit period; the speed limit type includes: shared speed limit and / or private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0081] S320, when obtaining the access request of the target service on the target access terminal device to the target accessed device, determine whether there is a private speed limit corresponding to the target service; if yes, execute step S330, if not, execute step S350;
[0082] S330, determine whether the target service has a remaining number of private accesses in the current speed limit period; the remaining number of private accesses is the difference between the second maximum number of private speed limit accesses corresponding to the target service and the total number of historical private accesses corresponding to the target service in the current speed limit period; if yes, execute step S340, if not, execute step S350;
[0083] S340, based on the remaining private access count, sending an access request to a target interface of a target accessed device, so that the target accessed device responds to the access request;
[0084] S350, determine whether there is a shared speed limit corresponding to the target service; if yes, execute step S360,
[0085] S360, determining whether the target service has a remaining shared access count in the current speed limit period; the remaining shared access count is the difference between the second maximum access count of the shared speed limit corresponding to the target service and the total number of historical shared access counts of all services sharing the second maximum access count in the current speed limit period; if yes, executing step S370;
[0086] S370: Based on the remaining shared access times, an access request is sent to a target interface of a target accessed device, so that the target accessed device responds to the access request.
[0087] In some examples, when the target access terminal device receives the speed limit configuration information corresponding to the target service sent by the management platform, the speed limit configuration information can be configured on the SDK on the target access terminal, and the speed limit configuration information can include the speed limit type and the second maximum number of accesses corresponding to the speed limit type within the preset speed limit period; the speed limit type includes: shared speed limit and / or private speed limit;
[0088] Then, when the target service on the target access end device needs to access the target interface during operation, an access request to access the target interface can be generated first. At this time, the SDK running on the target access end device can obtain the access request sent by the target service on the target access end device for the target interface on the target accessed device. It can be understood that the target accessed device can have multiple interfaces, and the target interface is the interface that the target access end device wants to access.
[0089] When the SDK obtains an access request for a target interface, it may first determine whether there is a private speed limit corresponding to the target access terminal device.
[0090] If it is determined that there is a private speed limit corresponding to the target service, it can be determined whether the target service has a remaining private access count in the current speed limit period; the remaining private access count is the difference between the second maximum access count of the private speed limit corresponding to the target service and the total number of historical private accesses corresponding to the target service in the current speed limit period; if yes, based on the remaining private access count, an access request is sent to the target interface of the target accessed device, so that the target accessed device responds to the access request;
[0091] In some examples, since the shared speed limit and the private speed limit both have corresponding second maximum access times within the preset speed limit period, the preset speed limit period may be 1 second or 1 minute. Therefore, in the embodiment of the present invention, statistics may be performed in units of each preset speed limit period.
[0092] For example, assuming that the total number of accesses corresponding to the private speed limit sent by service A in the current speed limit period is 5, and the second maximum number of accesses corresponding to the private speed limit of service A is 10, then the remaining private access number is 5. The total number of accesses corresponding to the private speed limit sent by service A in the current speed limit period is the total number of historical private accesses corresponding to the target service.
[0093] In some other examples, if it is determined that the target service has no remaining private access times within the current speed limit period, or it is determined that there is no private speed limit corresponding to the target service, then, in order to enable the server device to access the target accessed device, step S350 can be executed to determine whether there is a shared speed limit corresponding to the target service; if there is a shared speed limit corresponding to the target service, it can be determined whether the target service has no remaining shared access times within the current speed limit period; so as to determine whether the target accessed device can be accessed through the shared speed limit.
[0094] The remaining shared access count is the difference between the second maximum access count of the shared speed limit corresponding to the target service and the total number of historical shared access counts of all services sharing the second maximum access count in the current speed limit period;
[0095] For example, the second maximum number of accesses corresponding to the shared speed limit is shared by service A and service B. Then, in the current speed limit period, the total number of accesses sent by service A through the shared speed limit and the total number of accesses sent by service B through the shared speed limit can be counted first, and then the total number of accesses sent by service A and service B respectively through the shared speed limit can be summed up to obtain the total number of historical shared accesses of services A and B in the current speed limit period. Then, the second maximum number of accesses of the shared speed limit corresponding to service A can be subtracted from the total number of historical shared accesses of services A and B in the current speed limit period to obtain the remaining shared accesses corresponding to service A.
[0096] If it is determined that the target service has a remaining number of shared accesses within the current speed limit period, an access request can be sent to the target interface of the target accessed device based on the remaining number of shared accesses, so that the target accessed device responds to the access request, so that the target access end device can use the shared speed limit to access the target accessed device when it cannot use the private speed limit to access the target accessed device. In this way, the target service can use the corresponding private speed limit first.
[0097] In some examples, when it is determined that there is no shared speed limit corresponding to the target service or it is determined that there are no remaining shared access times for the target service in the current speed limit period, the access request may not be sent to the target interface of the target accessed device.
[0098] An interface speed limiting method provided by an embodiment of the present invention can obtain speed limit configuration information corresponding to a target service sent by a management platform, configure the speed limit configuration information, and then, when obtaining an access request from a target service on a target access terminal device to a target accessed device, determine whether there is a private speed limit corresponding to the target service; if there is a private speed limit corresponding to the target service, determine whether there are remaining private access times for the target service in the current speed limit period; if there are remaining private access times, send an access request to a target interface of the target accessed device based on the remaining private access times, so that the target accessed device responds to the access request; if there is no private speed limit corresponding to the target service, determine whether there is a shared speed limit corresponding to the target service; if there is a shared speed limit corresponding to the target service, determine whether there are remaining shared access times for the target service in the current speed limit period, and if there are remaining shared access times, send an access request to a target interface of the target accessed device based on the remaining shared access times, so that the target accessed device responds to the access request. In this way, the target access terminal device can access the target accessed device based on the speed limit configuration information sent by the management platform. Therefore, the private speed limit and / or shared speed limit corresponding to each service can be used to limit the speed of the target access terminal device, thereby improving the flexibility of the interface in limiting the speed of the target access terminal device, so as to flexibly limit the speed of different services.
[0099] Furthermore, since the speed limit configuration information is configured on the SDK on the target access terminal device, and the SDK can be installed on different access terminal devices, the first SDK can be set in a distributed manner, thereby achieving distributed speed limit and reducing the pressure on the target accessed device.
[0100] In some examples, such as Figure 4 As shown, the management platform shown in the embodiment of the present invention can also communicate with the token server 140 in addition to being connected to the target access terminal device. The token server 140 is also connected to the target access terminal device 120. Figure 2 Based on the speed limit configuration method shown in FIG. 1 , the embodiment of the present invention further provides a possible implementation method, such as Figure 5 As shown, the method may include:
[0101] S510, when the rate limit configuration instruction is obtained, displaying the target service that can access the target interface;
[0102] S520, obtaining speed limit setting information set for the target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0103] S530, determining a target access terminal device running the target service according to the target service;
[0104] S540, generates speed limit configuration information based on the speed limit setting information, and sends the speed limit configuration information to the target access terminal device, so that the target access terminal device configures the speed limit configuration information to the SDK running on it, and after obtaining the access request sent by the target service, sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
[0105] S550, generating a token generation instruction, and sending the token generation instruction to the token server, so that the token server generates a token corresponding to the speed limit type according to the speed limit type carried in the token generation instruction;
[0106] S560: Generate token request information, and send the token request information to the target access end device, so that the target access end device configures the token request information on the SDK. The token request information is used to indicate that a first token acquisition request corresponding to a private speed limit or a second token acquisition request corresponding to a shared speed limit is sent to a token server to obtain a token corresponding to the speed limit type from the token server, and send an access request to the target interface of the target accessed device through the token corresponding to the speed limit type.
[0107] In some examples, in the embodiments of the present invention, in addition to implementing the speed limit for each target service accessing the target interface through the speed limit configuration information, in the embodiments of the present invention, the access request sent by each target service to the target interface can also be limited through the token. In this regard, a token server can also be configured so that the target access device obtains a token from the token server and then sends an access request to the target interface based on the token.
[0108] Specifically, the user can click a "generate token" button on the management platform to which the speed limit configuration method of the embodiment of the present invention is applied, and then the management platform can generate a token generation instruction and send the token generation instruction to the token server, so that the token server can generate a token corresponding to the speed limit type according to the speed limit type carried in the token generation instruction;
[0109] In some examples, in addition to sending a token generation instruction to the token server to instruct the token server to generate a token corresponding to the speed limit type according to the speed limit type carried in the token generation instruction, the management platform also generates token request information and sends the token request information to the target access end device so that the target access end device configures the token request information on the SDK; the token request information is used to indicate that a first token acquisition request corresponding to a private speed limit or a second token acquisition request corresponding to a shared speed limit is sent to the token server to obtain a token corresponding to the speed limit type from the token server, and send an access request to the target interface of the target accessed device through the token corresponding to the speed limit type.
[0110] In this way, when a user sends an access request to a target interface based on a shared speed limit or a private speed limit, the user can use a token to send an access request to the target interface at the same time.
[0111] It can be understood that steps S510 to S540 in the embodiment of the present invention are the same as or similar to steps S210 to S240 in the first implementation of the speed limit configuration method, and are not described in detail here.
[0112] Corresponding to Figure 5 The speed limit configuration method shown in the figure, the embodiment of the present invention also provides an interface speed limit method, such as Figure 6 FIG. 1 is a flow chart of a second implementation of an interface rate limiting method in an embodiment of the present invention. The method may include:
[0113] S610, obtain the speed limit configuration information and token request information corresponding to the target service sent by the management platform, and configure the speed limit configuration information and token request information; the speed limit configuration information includes: the speed limit type and the second maximum number of accesses corresponding to the speed limit type within the preset speed limit period; the speed limit type includes: shared speed limit and / or private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period; the token request information is used to indicate that a first token acquisition request corresponding to the private speed limit or a second token acquisition request corresponding to the shared speed limit is sent to the token server to obtain a token corresponding to the speed limit type from the token server, and send an access request to the target interface of the target accessed device through the token corresponding to the speed limit type;
[0114] S620, when obtaining the access request of the target service on the target access terminal device to the target accessed device, determine whether there is a private speed limit corresponding to the target service; if yes, execute step S630, if not, execute step S660;
[0115] S630, determine whether the target service has a remaining number of private accesses in the current speed limit period; the remaining number of private accesses is the difference between the second maximum number of private speed limit accesses corresponding to the target service and the total number of historical private accesses corresponding to the target service in the current speed limit period; if yes, execute step S640, if not, execute step S660;
[0116] S640, sending a first token acquisition request corresponding to the private speed limit to the token server;
[0117] S650, obtaining a first token corresponding to the private speed limit returned by the token server, and sending the first token and the access request together to the target interface of the target accessed device, so that the target accessed device responds to the access request according to the first token;
[0118] S660, determine whether there is a shared speed limit corresponding to the target service; if yes, execute step S670,
[0119] S670, determining whether the target service has a remaining shared access count in the current speed limit period; the remaining shared access count is the difference between the second maximum access count of the shared speed limit corresponding to the target service and the total number of historical shared access counts of all services sharing the second maximum access count in the current speed limit period; if yes, executing step S680;
[0120] S680, sending a second token acquisition request corresponding to the shared speed limit to the token server;
[0121] S690, obtain a second token corresponding to the shared speed limit returned by the token server, and send the second token and the access request together to the target interface of the target accessed device, so that the target accessed device responds to the access request according to the second token.
[0122] In some examples, when the target access terminal device obtains the rate limit configuration information and token request information corresponding to the target service sent by the management platform, the rate limit configuration information and token request information may be configured;
[0123] Then, when it is determined that the target service has a remaining number of private accesses within the current speed limit period, a first token acquisition request corresponding to the private speed limit may be sent to the token server to acquire a first token corresponding to the private speed limit;
[0124] When the target access end device obtains the first token corresponding to the private speed limit returned by the token server, the first token and the access request can be sent together to the target interface of the target accessed device, so that the target accessed device responds to the access request according to the first token; in this way, when the target accessed device obtains the first token and the access request at the same time, it will respond to the access request; if it only obtains the access request but not the first token, it will not respond to the access request.
[0125] When it is determined that the target service has a remaining number of shared accesses within the current speed limit period, a second token acquisition request corresponding to the shared speed limit may be sent to the token server to acquire a second token corresponding to the shared speed limit;
[0126] When the target access end device obtains the second token corresponding to the shared speed limit returned by the token server, the second token and the access request can be sent to the target interface of the target accessed device together, so that the target accessed device responds to the access request according to the second token. In this way, when the target accessed device obtains the second token and the access request at the same time, it will respond to the access request. If it only obtains the access request but does not obtain the second token, it will not respond to the access request.
[0127] Through the embodiment of the present invention, the token can be combined with the speed limit, so that the target access terminal device can access the target accessed device based on the token and the speed limit.
[0128] It can be understood that steps S620-S630 and S660-S670 in the embodiment of the present invention are the same as or similar to steps S320-S330 and S350-S360 in the first implementation of the interface rate limiting method, and are not described in detail here.
[0129] In some examples, Figure 5 Based on the speed limit configuration method shown in FIG. 1 , the embodiment of the present invention further provides a possible implementation method, such as Figure 7 As shown, the method may include:
[0130] S710, when the rate limit configuration instruction is obtained, displaying a target service that can access the target interface;
[0131] S720, obtaining speed limit setting information set for the target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0132] S730, determining a target access terminal device running the target service according to the target service;
[0133] S740, generates speed limit configuration information based on the speed limit setting information, and sends the speed limit configuration information to the target access terminal device, so that the target access terminal device configures the speed limit configuration information to the SDK running on it, and after obtaining the access request sent by the target service, sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
[0134] S750, generating a token generation instruction, and sending the token generation instruction to the token server, so that the token server generates a token corresponding to the speed limit type according to the speed limit type carried in the token generation instruction;
[0135] S760, obtaining a sorting queue generation instruction, and sending the sorting queue generation instruction to the token server, so that the token server generates a sorting queue; the sorting queue is used to sort the queue elements;
[0136] S770, obtaining a priority number and a token acquisition rule set for the target service;
[0137] S780: Generate token request information according to the priority number and token acquisition rule, and send the token request information to the target access terminal device, so that the target access terminal device configures the priority number and token acquisition rule on the SDK. The token request information is used to indicate that a first token acquisition request corresponding to a private speed limit or a second token acquisition request corresponding to a shared speed limit is sent to a token server to obtain a token corresponding to the speed limit type from the token server, and send an access request to the target interface of the target accessed device through the token corresponding to the speed limit type. The token acquisition rules include: when the speed limit type corresponding to the target service is a shared speed limit, first generate a serial number corresponding to the target service based on the priority number corresponding to the target service and the acquisition timestamp of the access request for obtaining the target service; then send the serial number corresponding to the target service, the first identification information, and the second identification information of the access request to the token server, so that the token server sorts the first identification information and the second identification information as the first queue element corresponding to the target service in the sorting queue in the order of the size of the serial number corresponding to the target service; finally, when the first queue element corresponding to the target service is obtained from the queue head of the sorting queue in the first-in-first-out order, send a second token acquisition request to the token server based on the first queue element corresponding to the target service.
[0138] In some examples, there may be a problem where multiple services compete for a token at the same time. To solve this problem, in an embodiment of the present invention, a sorting queue can be configured for the token server, and then a corresponding priority number can be configured for each service. Each service is then sorted in the sorting queue based on its corresponding priority number, and the token is obtained based on the sorting result.
[0139] Specifically, the user can click the "Configure Sorting Queue" button on the management platform. At this time, the management platform can obtain the sorting queue generation instruction, and then send the sorting queue generation instruction to the token server, so that the token server can generate the sorting queue.
[0140] In some examples, after instructing the token server to generate a sorting queue, the management platform can also obtain the priority number and token acquisition rules set for the target service in order to enable each service to be sorted in the sorting queue based on the priority number; wherein the priority number and the token acquisition rules can be pre-set by the user.
[0141] In some examples, the order of priority can be in ascending order of numbers, that is, the order of priority from high to low is represented by the order of priority numbers from small to large. For example, the priority numbers set for different SDKs can be 1, 2, 3, 4, etc.
[0142] In some other examples, the order of the priorities is the same as the order of the sorting queue. When the priorities are sorted in ascending order of numbers, the order of the sorting queue is also sorted in ascending order of numbers.
[0143] Then the management platform can generate token request information according to the priority number and token acquisition rule, and send the token request information to the target access terminal device, so that the target access terminal device configures the priority number and token acquisition rule on the SDK. The token request information is used to indicate that a first token acquisition request corresponding to a private speed limit or a second token acquisition request corresponding to a shared speed limit is sent to the token server to obtain a token corresponding to the speed limit type from the token server, and send an access request to the target interface of the target accessed device through the token corresponding to the speed limit type. The token acquisition rule includes: when the speed limit type corresponding to the target service is a shared speed limit, firstly generate a serial number corresponding to the target service based on the priority number corresponding to the target service and the acquisition timestamp of the access request for obtaining the target service; then send the serial number corresponding to the target service, the first identification information and the second identification information of the access request to the token server, so that the token server sorts the first identification information and the second identification information as the first queue element corresponding to the target service in the sorting queue according to the size order of the serial number corresponding to the target service; finally, when the first queue element corresponding to the target service is obtained from the queue head of the sorting queue in the first-in-first-out order, send a second token acquisition request to the token server based on the first queue element corresponding to the target service.
[0144] It can be understood that, in the embodiment of the present invention, steps S760 and S770 may be executed simultaneously, or step S760 may be executed first and then step S770, or step S770 may be executed first and then step S760. Figure 7 This is merely an exemplary description and is not intended to limit the order of steps S760 and S770.
[0145] Through the embodiment of the present invention, it is possible to configure the priority number and token acquisition rules for the target access terminal device so that the target access terminal device obtains a second token from the token server based on the priority number and token acquisition rules, and then accesses the target accessed device based on the obtained second token.
[0146] It can be understood that steps S710 to S750 in the embodiment of the present invention are the same as or similar to steps S510 to S550 in the second implementation of the speed limit configuration method, and are not described in detail here.
[0147] Corresponding to Figure 7 The speed limit configuration method shown in the figure, the embodiment of the present invention also provides an interface speed limit method, such as Figure 8 FIG. 1 is a flowchart of a third implementation of an interface rate limiting method in an embodiment of the present invention. The method may include:
[0148] S801, obtain the speed limit configuration information and token request information corresponding to the target service sent by the management platform, and configure the speed limit configuration information and token request information; the speed limit configuration information includes: the speed limit type and the second maximum number of accesses corresponding to the speed limit type within the preset speed limit period; the speed limit type includes: shared speed limit and / or private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period; the token request information includes: the priority number and the token acquisition rule, and the token acquisition rule includes: When the speed limit type is shared speed limit, first generate a serial number corresponding to the target service based on the priority number corresponding to the target service and the acquisition timestamp of the access request for the target service; then send the serial number corresponding to the target service, the first identification information and the second identification information of the access request to the token server, so that the token server sorts the first identification information and the second identification information as the first queue element corresponding to the target service in the sorting queue in the order of the sequence numbers corresponding to the target services; finally, when the first queue element corresponding to the target service is obtained from the queue head of the sorting queue in the first-in-first-out order, send a second token acquisition request to the token server based on the first queue element corresponding to the target service.
[0149] S802, when obtaining an access request from a target service on a target access terminal device to a target accessed device, determining whether there is a private speed limit corresponding to the target service; if yes, executing step S803, if not, executing step S806;
[0150] S803, determine whether the target service has a remaining number of private accesses in the current speed limit period; the remaining number of private accesses is the difference between the second maximum number of private speed limit accesses corresponding to the target service and the total number of historical private accesses corresponding to the target service in the current speed limit period; if yes, execute step S804, if not, execute step S806;
[0151] S804, sending a first token acquisition request corresponding to the private speed limit to the token server;
[0152] S805, obtaining a first token corresponding to the private speed limit returned by the token server, and sending the first token and the access request together to the target interface of the target accessed device, so that the target accessed device responds to the access request according to the first token;
[0153] S806, determine whether there is a shared speed limit corresponding to the target service; if yes, execute step S807,
[0154] S807, determine whether the target service has a remaining shared access count in the current speed limit period; the remaining shared access count is the difference between the second maximum access count of the shared speed limit corresponding to the target service and the total number of historical shared access counts of all services sharing the second maximum access count in the current speed limit period; if yes, execute step S808;
[0155] S808, obtaining a priority number corresponding to the target service, an acquisition timestamp of the access request, first identification information of the target service, and second identification information of the access request;
[0156] S809, generating a sequence number corresponding to the target service based on the priority sequence number and the acquisition timestamp;
[0157] S810, sending the serial number, the first identification information, and the second identification information corresponding to the target service to the token server, so that the token server sorts the first identification information and the second identification information as the first queue elements corresponding to the target service in the sorting queue according to the size order of the serial numbers corresponding to the target services;
[0158] S811, when a first queue element corresponding to the target service is obtained from the queue head of the sorting queue in a first-in-first-out order, a second token acquisition request is sent to the token server based on the first queue element corresponding to the target service;
[0159] S812, obtain the second token corresponding to the shared speed limit returned by the token server, and send the second token and the access request together to the target interface of the target accessed device, so that the target accessed device responds to the access request according to the second token.
[0160] In some examples, since the management platform sends token request information including a priority number and token acquisition rules to the target access terminal device, the target access terminal device can obtain the speed limit configuration information corresponding to the target service and the token request information including the priority number and token acquisition rules sent by the management platform, and then can configure the speed limit configuration information, priority number and token acquisition rules on the SDK running on the target access terminal device.
[0161] In this way, when the management platform determines that the target service has a remaining number of shared accesses within the current speed limit period, it can first obtain the priority number corresponding to the target service, the acquisition timestamp of the access request, the first identification information of the target service, and the second identification information of the access request; and generate a serial number corresponding to the first SDK based on the priority number and the receiving timestamp;
[0162] In some examples, when the SDK obtains the above-mentioned access request, it can confirm the time when the access request is obtained, and then generate a corresponding acquisition timestamp.
[0163] In some other examples, when the above-mentioned target access terminal device generates an access request, it can generate a second identification information corresponding to the access request, and the second identification information is used to uniquely identify the access request. Different access requests have different corresponding second identification information. The second identification information can be an identification composed of a string of numbers, or English letters, or a combination of English letters, numbers and other symbols. All of these are possible.
[0164] In some examples, when generating a serial number corresponding to the first SDK based on the priority number and the receiving timestamp, the priority number and the receiving timestamp can be concatenated to generate the serial number corresponding to the first SDK. For example, the priority number can be placed before the receiving timestamp, or the priority number can be placed at the end of the receiving timestamp, or the priority number and the receiving timestamp can be operated to generate the serial number corresponding to the first SDK. All of these are possible.
[0165] After generating the serial number corresponding to the target service based on the priority number and the receiving timestamp, the serial number, the first identification information and the second identification information corresponding to the target service can be sent to the token server. The token server can sort the first identification information and the second identification information as the first queue elements corresponding to the target service in the sorting queue according to the order of the serial numbers corresponding to the target services.
[0166] It can be understood that the sorting queue may store queue elements corresponding to multiple target services, and then sort the queue elements corresponding to the multiple target services.
[0167] In some other examples, the serial number, the first identification information, and the second identification information corresponding to the target service may also be sorted in the sorting queue as a first queue element corresponding to the target service.
[0168] Then the management platform can obtain queue elements from the sorting queue according to the first-in-first-out principle. When the first queue element corresponding to the target service is obtained from the queue head of the sorting queue according to the first-in-first-out order, a second token acquisition request can be sent to the first token server based on the first queue element corresponding to the target service.
[0169] In this way, the management platform can send a second token acquisition request to the token server according to the result of sorting the sorting queue, thereby acquiring the token according to the priority order and the receiving timestamp.
[0170] In some examples, when generating a sequence number corresponding to a target service based on a priority sequence number and a reception timestamp, the priority sequence number may be added before a preset number of digits of the reception timestamp to generate a sequence number corresponding to the target service, wherein the preset number of digits is the number of digits of the reception timestamp from the back to the front. The preset number of digits may be pre-set as required.
[0171] For example, assuming that in order to make the priority effective only for access requests within 1 second, the preset number of digits may be set to the third digit, and accordingly, the receiving timestamp is a timestamp generated in milliseconds.
[0172] For another example, assuming that the receiving timestamp is 1719564878585, then add the priority number before the third digit from the back, that is, before "585", and the serial number corresponding to the first SDK obtained is "17195648784585".
[0173] Through the embodiment of the present invention, the priority can be made valid only within a set time range, so that the effective time range of the priority can be set as needed, thereby improving the flexibility of setting the effective time range of the priority.
[0174] In addition, if the time range is set within 1 second, it can prevent low-priority services from never being able to obtain tokens for a long time, thereby avoiding the impact on overall performance.
[0175] It can be understood that steps S801 to S807 and S812 in the embodiment of the present invention are the same as or similar to steps S610 to S670 and S690 in the second implementation of the interface rate limiting method, and are not described in detail here.
[0176] In some examples, Figure 7 Based on the speed limit configuration method shown in FIG. 1 , the embodiment of the present invention further provides a possible implementation method, such as Fig. 9 As shown, the method may include:
[0177] S910, when the rate limit configuration instruction is obtained, displaying a target service that can access the target interface;
[0178] S920, obtaining speed limit setting information set for the target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0179] S930, determining a target access terminal device running the target service according to the target service;
[0180] S940, generates speed limit configuration information based on the speed limit setting information, and sends the speed limit configuration information to the target access terminal device, so that the target access terminal device configures the speed limit configuration information to the SDK running on it, and after obtaining the access request sent by the target service, sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
[0181] S950, generating a token generation instruction, and sending the token generation instruction to the token server, so that the token server generates a token corresponding to the speed limit type according to the speed limit type carried in the token generation instruction;
[0182] S960, obtaining a sorting queue generation instruction, and sending the sorting queue generation instruction to the token server, so that the token server generates a sorting queue; the sorting queue is used to sort the queue elements;
[0183] S970, obtaining a priority number and a token acquisition rule set for the target service;
[0184] S980, sending multiple distributed locks to the token server, so that the token server stores the multiple distributed locks;
[0185] S990, generate token request information according to the priority number, token acquisition rules and distributed lock holding instructions, and send the token request information to the target access end device, so that the target access end device configures the priority number, token acquisition rules and distributed lock holding instructions on the SDK. The distributed lock holding instruction is used to indicate that when the speed limit type corresponding to the target service is a shared speed limit, obtain a distributed lock from the token server; the token acquisition rules specifically include: when the speed limit type corresponding to the target service is a shared speed limit, when the second queue element is obtained from the queue head of the sorting queue in the first-in-first-out order, determine whether the serial number corresponding to the second queue element is greater than the serial number corresponding to the target service; when the serial number corresponding to the second queue element is less than the serial number corresponding to the target service, send the third identification information of the second service in the second queue element to the token server, so that the token server determines whether there is a corresponding distributed lock for the second service; and when the corresponding distributed lock does not exist for the second service When the sequence number corresponding to the second queue element is equal to the sequence number corresponding to the target service, the second queue element is used as the first queue element corresponding to the target service, and a second token acquisition request is sent to the token server based on the first queue element corresponding to the target service; when the sequence number corresponding to the second queue element is greater than the sequence number corresponding to the target service, the sequence number, the first identification information and the second identification information corresponding to the target service are resent to the token server, so that the token server re-sorts the first identification information and the second identification information as the first queue element corresponding to the target service in the sorting queue according to the size order of the sequence numbers corresponding to the target service.
[0186] In some examples, after the management platform places the serial numbers corresponding to each target service in the sorting queue, the services on the management platform may go offline due to a failure. At this time, the SDK may not obtain the serial numbers corresponding to the target services from the sorting queue for a long time, causing congestion in the sorting queue and other SDKs to be unable to obtain the serial numbers corresponding to other services.
[0187] In this regard, multiple distributed locks can be sent to the token server so that the token server stores multiple distributed locks; then, token request information can be generated based on the acquired priority number, token acquisition rules and distributed lock holding instructions, and the token request information can be sent to the target access end device, so that the target access end device can configure the priority number, token acquisition rules and distributed lock holding instructions on the SDK running on it.
[0188] By storing multiple distributed locks in the token server, when an SDK is communicating with the token server, it can be considered that the SDK is online. At this time, the SDK can request to hold a distributed lock for each service on the access device running the SDK. Each service on the access device corresponds to a distributed lock. When an SDK goes offline, the token server can release the distributed lock allocated to the service on the access device running the SDK.
[0189] It can be understood that, in the embodiment of the present invention, steps S960 to S980 may be executed in sequence, simultaneously, or in other sequences. Fig. 9 This is merely an exemplary description and is not intended to limit the order of steps S960 to S980.
[0190] Through the embodiment of the present invention, it is possible to store multiple distributed locks in the token server, configure the priority number, token acquisition rules and distributed lock holding instructions on the target access terminal device, and instruct each service on the target access terminal device to hold a distributed lock, and then obtain queue elements based on the distributed locks, and then obtain tokens based on the queue elements. This can avoid the problem of congestion in the sorting queue caused by the service on the management platform going offline due to a fault.
[0191] It can be understood that steps S910 to S970 in the embodiment of the present invention are the same as or similar to steps S710 to S770 in the third implementation of the speed limit configuration method, and are not described in detail here.
[0192] In some examples, in order to enable users using the management platform to promptly learn about the status of tokens issued by the token server, a token issuance information acquisition instruction may be sent to the token server;
[0193] In some examples, the token server can record the number of tokens issued within a period of time and the issuance time of each token as token issuance information in the token server. After obtaining the token issuance information acquisition instruction, the token server can send the token issuance information to the management platform, and the management platform can obtain the token issuance information recorded by the token server. In this way, it is convenient for users of the management platform to manage the token server and tokens.
[0194] In some other examples, the management platform can also adjust the second maximum number of accesses corresponding to the private speed limit and / or shared speed limit of the target service. In this regard, the user using the management platform can reset the adjustment value of the second maximum number of accesses corresponding to the private speed limit and / or shared speed limit of the target service or the adjusted second maximum number of accesses, and then send the adjustment value of the second maximum number of accesses corresponding to the private speed limit and / or shared speed limit of the target service or the adjusted second maximum number of accesses as a speed limit adjustment instruction to the target service.
[0195] After receiving the speed limit adjustment instruction sent by the management platform, the SDK can make adjustments according to the adjustment value of the second maximum number of accesses corresponding to the private speed limit and / or shared speed limit of the target service or the adjusted second maximum number of accesses.
[0196] In this way, the second maximum number of accesses corresponding to the private speed limit and / or the shared speed limit of the target service can be adjusted dynamically, further improving the flexibility of the speed limit.
[0197] Corresponding to Fig. 9 The speed limit configuration method shown in the figure, the embodiment of the present invention also provides an interface speed limit method, such as Fig.10 FIG. 1 is a flowchart of a fourth implementation of an interface rate limiting method in an embodiment of the present invention. The method may include:
[0198] S1001, obtain the speed limit configuration information and token request information corresponding to the target service sent by the management platform, and configure the speed limit configuration information and token request information; the speed limit configuration information includes: the speed limit type and the second maximum number of accesses corresponding to the speed limit type within the preset speed limit period; the speed limit type includes: shared speed limit and / or private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period; the token request information includes: priority number, token acquisition rule and distributed lock holding instruction, the token acquisition rule specifically includes: when the speed limit type corresponding to the target service is shared speed limit, when the second queue element is obtained from the queue head of the sorting queue in the first-in-first-out order, it is determined whether the sequence number corresponding to the second queue element is greater than the sequence number corresponding to the target service; in the second queue When the serial number corresponding to the element is less than the serial number corresponding to the target service, the third identification information of the second service in the second queue element is sent to the token server, so that the token server determines whether there is a corresponding distributed lock for the second service; and when the second service does not have a corresponding distributed lock, the second queue element in the sorting queue is deleted; when the serial number corresponding to the second queue element is equal to the serial number corresponding to the target service, the second queue element is used as the first queue element corresponding to the target service, and a second token acquisition request is sent to the token server based on the first queue element corresponding to the target service; when the serial number corresponding to the second queue element is greater than the serial number corresponding to the target service, the serial number, the first identification information and the second identification information corresponding to the target service are resent to the token server, so that the token server re-sorts the first identification information and the second identification information as the first queue element corresponding to the target service in the sorting queue according to the size order of the serial numbers corresponding to the target service.
[0199] S1002, when obtaining an access request from a target service on a target access terminal device to a target accessed device, determining whether there is a private speed limit corresponding to the target service; if yes, executing step S1003, if not, executing step S1006;
[0200] S1003, determine whether the target service has a remaining number of private accesses in the current speed limit period; the remaining number of private accesses is the difference between the second maximum number of private speed limit accesses corresponding to the target service and the total number of historical private accesses corresponding to the target service in the current speed limit period; if yes, execute step S1004, if not, execute step S1006;
[0201] S1004, sending a first token acquisition request corresponding to the private speed limit to the token server;
[0202] S1005, obtaining a first token corresponding to the private speed limit returned by the token server, and sending the first token and the access request together to the target interface of the target accessed device, so that the target accessed device responds to the access request according to the first token;
[0203] S1006, determine whether there is a shared speed limit corresponding to the target service; if yes, execute step S1007,
[0204] S1007, determining whether the target service has a remaining shared access count in the current speed limit period; the remaining shared access count is the difference between the second maximum access count of the shared speed limit corresponding to the target service and the total number of historical shared access counts of all services sharing the second maximum access count in the current speed limit period; if yes, executing step S1008;
[0205] S1008, obtaining a priority number corresponding to the target service, an acquisition timestamp of the access request, first identification information of the target service, and second identification information of the access request;
[0206] S1009, generating a sequence number corresponding to the target service based on the priority sequence number and the acquisition timestamp;
[0207] S1010, sending the serial number, the first identification information, and the second identification information corresponding to the target service to the token server, so that the token server sorts the first identification information and the second identification information as the first queue elements corresponding to the target service in the sorting queue according to the order of the serial numbers corresponding to the target services;
[0208] S1011, when a second queue element is obtained from the queue head of the sorting queue in a first-in-first-out order, determining whether a sequence number corresponding to the second queue element is greater than a sequence number corresponding to the target service;
[0209] S1012, when the sequence number corresponding to the second queue element is less than the sequence number corresponding to the target service, the third identification information of the second service in the second queue element is sent to the token server, so that the token server determines whether there is a corresponding distributed lock for the second service; and when the corresponding distributed lock does not exist for the second service, the second queue element in the sorting queue is deleted;
[0210] S1013, when the sequence number corresponding to the second queue element is equal to the sequence number corresponding to the target service, use the second queue element as the first queue element corresponding to the target service, and send a second token acquisition request to the token server based on the first queue element corresponding to the target service;
[0211] S1014, obtaining a second token corresponding to the shared speed limit returned by the token server, and sending the second token and the access request together to the target interface of the target accessed device, so that the target accessed device responds to the access request according to the second token.
[0212] In some examples, after the management platform sends multiple distributed locks to the token server, the token server may store multiple distributed locks; Fig. 9 After the management platform sends the token request information, the target access terminal device can configure the priority number, token acquisition rules and distributed lock holding instructions on the SDK running on it.
[0213] In this way, when the target access end device is connected to the token server for communication, a distributed lock can be requested for each service on the target access end device.
[0214] Then, when the second queue element is obtained from the queue head of the sorting queue in the first-in-first-out order, the second queue element may be the same as the first queue element or may be different. In order to determine whether the second queue element is the same as the first queue element, it can be determined whether the sequence number corresponding to the second queue element is greater than the sequence number corresponding to the target service.
[0215] When the serial number corresponding to the second queue element is equal to the serial number corresponding to the target service, the second queue element must be the first queue element when stored. At this time, a second token acquisition request can be sent to the token server based on the first queue element corresponding to the target service.
[0216] When the serial number corresponding to the second queue element is smaller than the serial number corresponding to the target service, it may indicate that the second SDK on the access terminal device running the second service identified by the third identification information in the second queue element may be offline due to a fault. In order to further confirm whether the second SDK is offline due to a fault, the third identification information of the second service in the second queue element may be sent to the token server, which determines whether there is a corresponding distributed lock for the second service. When the second service does not have a corresponding distributed lock, it can be determined that the second SDK is offline, and the second queue element in the sorting queue may be deleted to avoid congestion in the sorting queue.
[0217] In some other examples, the SDK on the target access terminal device that applies an interface speed limiting method of an embodiment of the present invention may also go offline due to a fault. At this time, the SDK on the target access terminal device may not obtain the serial number for a certain period of time. When the SDK on the target access terminal device is troubleshooted and comes back online, it will re-acquire the serial number. Therefore, when the serial number corresponding to the acquired second queue element is greater than the serial number corresponding to the target service, it can be explained that the first queue element corresponding to the target service stored in the sorting queue has been deleted. At this time, the serial number, first identification information and second identification information corresponding to the target service can be resent to the token server. In this way, the token server can re-sort the first identification information and the second identification information as the first queue elements corresponding to the target service in the sorting queue according to the size order of the serial numbers corresponding to the target services.
[0218] In this way, after the SDK on the target access terminal device goes offline due to a fault and the fault is eliminated, the first queue element corresponding to the target service can be re-obtained, and then the token can be obtained, avoiding the problem of not being able to obtain the token after troubleshooting.
[0219] It can be understood that steps S1002 to S1010 and S1014 in the embodiment of the present invention are the same as or similar to steps S802 to S810 and S812 in the second implementation of the interface rate limiting method, and are not described in detail here.
[0220] Corresponding to the above method embodiment, the embodiment of the present invention further provides a speed limit configuration device, which is applied to a management platform, the management platform is connected to a target access terminal device in communication, and a service is running on the target access terminal device; the target access terminal device is connected to a target accessed device in communication, and a target interface is set on the target accessed device, such as Fig.11 FIG. 1 is a schematic diagram of a speed limit configuration device according to an embodiment of the present invention. The device may include:
[0221] Display module 1110, used for displaying target services that can access the target interface when the rate limit configuration instruction is obtained;
[0222] The first acquisition module 1120 is used to acquire speed limit setting information set for the target service; the speed limit setting information includes: speed limit type and the second maximum access number corresponding to the speed limit type within the preset speed limit period; the speed limit type includes: shared speed limit and / or private speed limit; the private speed limit is used to indicate that the second maximum access number is privately owned by a service; the shared speed limit is used to indicate that the second maximum access number is shared by multiple services; the second maximum access number is set according to the first maximum access number of the target interface within the preset speed limit period;
[0223] A determination module 1130 is used to determine a target access terminal device running a target service according to the target service;
[0224] The generation module 1140 is used to generate speed limit configuration information according to the speed limit setting information, and send the speed limit configuration information to the target access terminal device, so that the target access terminal device configures the speed limit configuration information to the SDK running thereon, and sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
[0225] A speed limit configuration device provided by an embodiment of the present invention can display a target service that can access a target interface when a speed limit configuration instruction is obtained; then obtain the speed limit setting information set for the target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period; then according to the target service, determine the target access terminal device running the target service; finally, according to the speed limit setting information, generate speed limit configuration information, and send the speed limit configuration information to the target access terminal device, so that the target access terminal device configures the speed limit configuration information to the SDK running thereon, and sends an access request to the accessed device through the speed limit configuration information configured on the SDK. Thus, the target interface can use the corresponding speed limit configuration information for different services to limit the speed, thereby improving the flexibility of the interface to limit the speed of the service, so as to flexibly limit the speed of different services.
[0226] In some examples, the management platform is further connected to the token server in communication; the apparatus further includes:
[0227] A token generation instruction sending module is used to generate a token generation instruction after obtaining the speed limit setting information corresponding to the target service, and send the token generation instruction to the token server, so that the token server generates a token corresponding to the speed limit type according to the speed limit type carried in the token generation instruction;
[0228] A token request information sending module is used to generate token request information and send the token request information to a target access end device, so that the target access end device configures the token request information on the SDK; the token request information is used to indicate that a first token acquisition request corresponding to a private speed limit or a second token acquisition request corresponding to a shared speed limit is sent to a token server to obtain a token corresponding to the speed limit type from the token server, and send an access request to the target interface of the target accessed device through the token corresponding to the speed limit type.
[0229] In some examples, the apparatus further includes:
[0230] A sorting queue generation instruction sending module is used to obtain a sorting queue generation instruction and send the sorting queue generation instruction to the token server, so that the token server generates a sorting queue, and the sorting queue is used to sort the queue elements;
[0231] The sorting queue generates an instruction sending module, and is also used to obtain the priority sequence number and token acquisition rules set for the target service;
[0232] The token request information sending module is specifically used for:
[0233] Generate token request information according to the priority number and token acquisition rules, and send the token request information to the target access end device, so that the target access end device configures the priority number and token acquisition rules on the SDK. The token acquisition rules include: when the speed limit type corresponding to the target service is a shared speed limit, first generate a serial number corresponding to the target service based on the priority number corresponding to the target service and the acquisition timestamp of the access request for the target service; then send the serial number corresponding to the target service, the first identification information and the second identification information of the access request to the token server, so that the token server sorts the first identification information and the second identification information as the first queue elements corresponding to the target service in the sorting queue in the order of the size of the serial numbers corresponding to the target services; finally, when the first queue element corresponding to the target service is obtained from the queue head of the sorting queue in the first-in-first-out order, send a second token acquisition request to the token server based on the first queue element corresponding to the target service.
[0234] In some examples, the apparatus further includes: a distributed lock sending module, configured to generate token request information according to the priority sequence number and the token acquisition rule, and send the token request information to the target access end device, so that after the target access end device configures the priority sequence number and the token acquisition rule on the SDK, it sends multiple distributed locks to the token server, so that the token server stores the multiple distributed locks;
[0235] The token request information sending module is specifically used to: generate token request information according to the priority number, token acquisition rules and distributed lock holding instructions, and send the token request information to the target access end device, so that the target access end device configures the priority number, token acquisition rules and distributed lock holding instructions on the SDK, and the distributed lock holding instructions are used to indicate that when the speed limit type corresponding to the target service is a shared speed limit, a distributed lock is obtained from the token server; the token acquisition rules specifically include: when the speed limit type corresponding to the target service is a shared speed limit, when the second queue element is obtained from the queue head of the sorting queue in a first-in-first-out order, it is determined whether the serial number corresponding to the second queue element is greater than the serial number corresponding to the target service; when the serial number corresponding to the second queue element is less than the serial number corresponding to the target service, the second queue element is The third identification information of the second service in the target service is sent to the token server, so that the token server determines whether there is a corresponding distributed lock for the second service; and when the corresponding distributed lock does not exist for the second service, the second queue element in the sorting queue is deleted; when the serial number corresponding to the second queue element is equal to the serial number corresponding to the target service, the second queue element is used as the first queue element, and a second token acquisition request is sent to the token server based on the first queue element; when the serial number corresponding to the second queue element is greater than the serial number corresponding to the target service, the serial number, the first identification information and the second identification information corresponding to the target service are resent to the token server, so that the token server re-sorts the first identification information and the second identification information as the first queue elements in the sorting queue according to the size order of the serial numbers corresponding to the target services.
[0236] In some examples, the apparatus further includes:
[0237] The token issuance information acquisition module is used to send a token issuance information acquisition instruction to the token server; and obtain the token issuance information recorded by the token server; wherein the token issuance information includes: the number of issued tokens and the issuance time of each token.
[0238] Corresponding to the above-mentioned interface speed limiting method embodiment, the embodiment of the present invention also provides an interface speed limiting device, which is applied to the SDK running on the target access terminal device, the target access terminal device is connected to the management platform in communication; the access terminal device is also connected to the target accessed device in communication, and the target accessed device is provided with a target interface, such as Fig.12 FIG. 1 is a schematic diagram of the structure of an interface speed limiting device in an embodiment of the present invention, and the device may include:
[0239] The second acquisition module 1210 is used to acquire the speed limit configuration information corresponding to the target service sent by the management platform, and configure the speed limit configuration information, the speed limit configuration information including: the speed limit type and the second maximum number of accesses corresponding to the speed limit type within the preset speed limit period; the speed limit type includes: shared speed limit and / or private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0240] The determination module 1220 is used to determine whether there is a private speed limit corresponding to the target service when obtaining an access request of the target service on the target access terminal device to the target accessed device;
[0241] If there is a private speed limit corresponding to the target service, determine whether the target service has a remaining number of private accesses in the current speed limit period; the remaining number of private accesses is the difference between the second maximum number of accesses to the private speed limit corresponding to the target service and the total number of historical private accesses to the target service in the current speed limit period;
[0242] If there are remaining private access times, triggering the first sending module;
[0243] A first sending module 1230, configured to send an access request to a target interface of a target accessed device based on the remaining private access count, so that the target accessed device responds to the access request;
[0244] If there is no private speed limit corresponding to the target service, determine whether there is a shared speed limit corresponding to the target service;
[0245] If there is a shared speed limit corresponding to the target service, determine whether the target service has a remaining shared access count in the current speed limit period, where the remaining shared access count is the difference between the second maximum access count of the shared speed limit corresponding to the target service and the total number of historical shared access counts of all services sharing the second maximum access count in the current speed limit period;
[0246] If there is a remaining number of shared access times, the second sending module 1240 is triggered;
[0247] The second sending module 1240 is configured to send the access request to the target interface of the target accessed device based on the remaining shared access times, so that the target accessed device responds to the access request.
[0248] An interface speed limiting device provided by an embodiment of the present invention can obtain the speed limit configuration information corresponding to the target service sent by the management platform, configure the speed limit configuration information, and then determine whether there is a private speed limit corresponding to the target service when obtaining the access request of the target service on the target access terminal device to the target accessed device; if there is a private speed limit corresponding to the target service, determine whether there are remaining private access times for the target service in the current speed limit period; if there are remaining private access times, based on the remaining private access times, send the access request to the target interface of the target accessed device, so that the target accessed device responds to the access request; if there is no private speed limit corresponding to the target service, determine whether there is a shared speed limit corresponding to the target service; if there is a shared speed limit corresponding to the target service, determine whether there are remaining shared access times for the target service in the current speed limit period, and if there are remaining shared access times, send the access request to the target interface of the target accessed device based on the remaining shared access times, so that the target accessed device responds to the access request. In this way, the target access terminal device can access the target accessed device based on the speed limit configuration information sent by the management platform. Therefore, the private speed limit and / or shared speed limit corresponding to each service can be used to limit the speed of the target access terminal device, thereby improving the flexibility of the interface in limiting the speed of the target access terminal device, so as to flexibly limit the speed of different services.
[0249] In some examples, the determination module 1220 is further used to, after determining whether the target service has remaining private access times in the current speed limit period, if there are no remaining private access times, execute the step of determining whether there is a shared speed limit corresponding to the target service.
[0250] In some examples, the access terminal device is in communication connection with a token server, and the token server is used to obtain a token corresponding to the speed limit type from the token server according to the speed limit type;
[0251] The second acquisition module 1210 is specifically configured to:
[0252] Obtain the speed limit configuration information and token request information corresponding to the target service sent by the management platform, and configure the speed limit configuration information and token request information, the token request information is used to indicate sending a first token acquisition request corresponding to a private speed limit or a second token acquisition request corresponding to a shared speed limit to a token server, so as to obtain a token corresponding to the speed limit type from the token server, and send an access request to the target interface of the target accessed device through the token corresponding to the speed limit type;
[0253] Accordingly, the first sending module 1230 includes:
[0254] A first sending submodule, used for sending a first token acquisition request corresponding to a private speed limit to a token server;
[0255] A first acquisition submodule, used for acquiring a first token corresponding to the private speed limit returned by the token server, and sending the first token and the access request together to a target interface of a target accessed device, so that the target accessed device responds to the access request according to the first token;
[0256] The second sending module 1240 includes:
[0257] A second sending submodule, used for sending a second token acquisition request corresponding to the shared speed limit to the token server;
[0258] The second acquisition submodule is used to acquire the second token corresponding to the shared speed limit returned by the token server, and send the second token and the access request together to the target interface of the target accessed device, so that the target accessed device responds to the access request according to the second token.
[0259] In some examples, a sorting queue corresponding to the target interface is set on the token server; different services have different priorities; the token request information includes: a priority number and a token acquisition rule, and the token acquisition rule includes: when the speed limit type corresponding to the target service is a shared speed limit, first generate a serial number corresponding to the target service based on the priority number corresponding to the target service and the acquisition timestamp of the access request for the target service; then send the serial number corresponding to the target service, the first identification information and the second identification information of the access request to the token server, so that the token server sorts the first identification information and the second identification information as the first queue element corresponding to the target service in the sorting queue according to the size order of the serial numbers corresponding to the target services; finally, when the first queue element corresponding to the target service is obtained from the queue head of the sorting queue in a first-in-first-out order, send a second token acquisition request to the token server based on the first queue element corresponding to the target service.
[0260] Correspondingly, the second sending submodule includes:
[0261] A first acquisition unit, used to acquire a priority number corresponding to a target service, an acquisition timestamp of an access request, first identification information of the target service, and second identification information of the access request;
[0262] A generating unit, used for generating a sequence number corresponding to a target service based on a priority sequence number and an acquisition timestamp;
[0263] A first sending unit is used to send the serial number, the first identification information and the second identification information corresponding to the target service to the token server, so that the token server sorts the first identification information and the second identification information as the first queue elements corresponding to the target service in the sorting queue according to the size order of the serial number corresponding to the target service;
[0264] The second sending unit is used to send a second token acquisition request to the token server based on the first queue element corresponding to the target service when the first queue element corresponding to the target service is obtained from the queue head of the sorting queue in a first-in-first-out order.
[0265] In some examples, the generating unit is specifically configured to:
[0266] The priority number is added before the preset number of digits of the acquisition timestamp to generate a serial number corresponding to the target service, wherein the preset number of digits is the number of digits of the acquisition timestamp from the back to the front.
[0267] In some examples, multiple distributed locks are also set on the token server; each target service holds a distributed lock; the token acquisition rules specifically include: when the speed limit type corresponding to the target service is a shared speed limit, when the second queue element is obtained from the queue head of the sorting queue in a first-in-first-out order, it is determined whether the serial number corresponding to the second queue element is greater than the serial number corresponding to the target service; when the serial number corresponding to the second queue element is less than the serial number corresponding to the target service, the third identification information of the second service in the second queue element is sent to the token server, so that the token server determines whether there is a corresponding distributed lock for the second service; and when the second service does not have a corresponding distributed lock, the second queue element in the sorting queue is deleted; when the serial number corresponding to the second queue element is equal to the serial number corresponding to the target service, the second queue element is used as the first queue element corresponding to the target service, and a second token acquisition request is sent to the token server based on the first queue element corresponding to the target service; when the serial number corresponding to the second queue element is greater than the serial number corresponding to the target service, the serial number, the first identification information and the second identification information corresponding to the target service are resent to the token server, so that the token server re-sorts the first identification information and the second identification information as the first queue elements in the sorting queue according to the size order of the serial numbers corresponding to the target services.
[0268] The second sending submodule also includes: a judgment unit, which is used to send the serial number, the first identification information and the second identification information corresponding to the target service to the token server, so that the token server sorts the first identification information and the second identification information as the first queue element in the sorting queue according to the size order of the serial number corresponding to the target service, and when the second queue element is obtained from the queue head of the sorting queue in the first-in-first-out order, it is judged whether the serial number corresponding to the second queue element is greater than the serial number corresponding to the target service; when the serial number corresponding to the second queue element is less than the serial number corresponding to the target service, the third sending unit is triggered;
[0269] A third sending unit is used to send the third identification information of the second service in the second queue element to the token server, so that the token server determines whether there is a corresponding distributed lock for the second service; and when the corresponding distributed lock does not exist for the second service, delete the second queue element in the sorting queue;
[0270] The second sending unit is specifically used for:
[0271] When the serial number corresponding to the second queue element is equal to the serial number corresponding to the target service, the second queue element is used as the first queue element corresponding to the target service, and a second token acquisition request is sent to the token server based on the first queue element corresponding to the target service.
[0272] In some examples, the determination unit is further configured to trigger the fourth sending unit when the sequence number corresponding to the second queue element is greater than the sequence number corresponding to the target service;
[0273] The fourth sending unit is used to resend the serial number corresponding to the target service, the first identification information and the second identification information to the token server when the serial number corresponding to the second queue element is greater than the serial number corresponding to the target service, so that the token server re-sorts the first identification information and the second identification information as the first queue elements corresponding to the target service in the sorting queue according to the order of the serial numbers corresponding to the target service.
[0274] The embodiment of the present invention also provides a management platform, such as Fig.13 As shown, it includes a processor 1301, a communication interface 1302, a memory 1303 and a communication bus 1304, wherein the processor 1301, the communication interface 1302, and the memory 1303 communicate with each other through the communication bus 1304.
[0275] Memory 1303, used for storing computer programs;
[0276] The processor 1301 is configured to implement the steps of the speed limit configuration method shown in any of the above embodiments when executing the program stored in the memory 1303. For example, the following steps may be implemented:
[0277] When the rate limit configuration instruction is obtained, the target service that can access the target interface is displayed;
[0278] Obtain speed limit setting information set for a target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0279] According to the target service, determine the target access terminal device running the target service;
[0280] According to the speed limit setting information, the speed limit configuration information is generated and sent to the target access end device, so that the target access end device configures the speed limit configuration information to the SDK running on it, and after obtaining the access request sent by the target service, sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
[0281] The embodiment of the present invention also provides a target access terminal device, such as Fig.14 As shown, it includes a processor 1401, a communication interface 1402, a memory 1403 and a communication bus 1404, wherein the processor 1401, the communication interface 1402, and the memory 1403 communicate with each other through the communication bus 1404.
[0282] Memory 1403, used for storing computer programs;
[0283] The processor 1401 is configured to implement the steps of the interface rate limiting method shown in any of the above embodiments when executing the program stored in the memory 1403. For example, the following steps may be implemented:
[0284] Obtain the speed limit configuration information corresponding to the target service sent by the management platform, and configure the speed limit configuration information, the speed limit configuration information including: the speed limit type and the second maximum number of accesses corresponding to the speed limit type within the preset speed limit period; the speed limit type includes: shared speed limit and / or private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0285] When obtaining an access request from a target service on a target access terminal device to a target accessed device, determining whether there is a private speed limit corresponding to the target service;
[0286] If there is a private speed limit corresponding to the target service, determine whether the target service has a remaining number of private accesses in the current speed limit period; the remaining number of private accesses is the difference between the second maximum number of accesses to the private speed limit corresponding to the target service and the total number of historical private accesses to the target service in the current speed limit period;
[0287] If there is a remaining private access count, sending an access request to a target interface of a target accessed device based on the remaining private access count, so that the target accessed device responds to the access request;
[0288] If there is no private speed limit corresponding to the target service, determine whether there is a shared speed limit corresponding to the target service;
[0289] If there is a shared speed limit corresponding to the target service, determine whether the target service has a remaining shared access count in the current speed limit period, where the remaining shared access count is the difference between the second maximum access count of the shared speed limit corresponding to the target service and the total number of historical shared access counts of all services sharing the second maximum access count in the current speed limit period;
[0290] If there is a remaining shared access number, an access request is sent to the target interface of the target accessed device based on the remaining shared access number, so that the target accessed device responds to the access request.
[0291] The communication bus mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0292] The communication interface is used for communication between the above terminal and other devices.
[0293] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0294] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0295] In another embodiment provided by the present invention, a computer-readable storage medium is further provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of the speed limit configuration method or the interface speed limit method shown in any of the above embodiments are implemented. For example, the following steps can be implemented:
[0296] When the rate limit configuration instruction is obtained, the target service that can access the target interface is displayed;
[0297] Obtain speed limit setting information set for a target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0298] According to the target service, determine the target access terminal device running the target service;
[0299] According to the speed limit setting information, the speed limit configuration information is generated and sent to the target access end device, so that the target access end device configures the speed limit configuration information to the SDK running on it, and after obtaining the access request sent by the target service, sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
[0300] In another embodiment of the present invention, a computer program product including instructions is further provided. When the computer program product is run on a computer, the computer executes the steps of the speed limit configuration method or the interface speed limit method shown in any of the above embodiments. For example, the following steps can be implemented:
[0301] When the rate limit configuration instruction is obtained, the target service that can access the target interface is displayed;
[0302] Obtain speed limit setting information set for a target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period;
[0303] According to the target service, determine the target access terminal device running the target service;
[0304] According to the speed limit setting information, the speed limit configuration information is generated and sent to the target access end device, so that the target access end device configures the speed limit configuration information to the SDK running on it, and after obtaining the access request sent by the target service, sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
[0305] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0306] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0307] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, computer-readable storage medium, computer program product containing instructions, and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0308] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A speed limit configuration method, characterized in that: Applied to a management platform, the management platform is connected to a target access terminal device in communication, a service is running on the target access terminal device; the target access terminal device is connected to a target accessed device in communication, a target interface is provided on the target accessed device, the method comprises: When the rate limit configuration instruction is obtained, the target service that can access the target interface is displayed; Obtain speed limit setting information set for the target service; the speed limit setting information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period; According to the target service, determining a target access terminal device running the target service; Based on the speed limit setting information, speed limit configuration information is generated, and the speed limit configuration information is sent to the target access end device, so that the target access end device configures the speed limit configuration information to the software development kit SDK running thereon, and after obtaining the access request sent by the target service, sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
2. The method according to claim 1, characterized in that The management platform is also connected to the token server in communication; After acquiring the speed limit setting information corresponding to the target service, the method further includes: Generate a token generation instruction, and send the token generation instruction to the token server, so that the token server generates a token corresponding to the speed limit type according to the speed limit type carried in the token generation instruction; Generate token request information and send the token request information to the target access end device, so that the target access end device configures the token request information on the SDK; the token request information is used to indicate sending a first token acquisition request corresponding to a private speed limit or a second token acquisition request corresponding to a shared speed limit to a token server, so as to obtain a token corresponding to the speed limit type from the token server, and send an access request to the target interface of the target accessed device through the token corresponding to the speed limit type.
3. The method according to claim 2, characterized in that The method further comprises: Obtaining a sorting queue generation instruction, and sending the sorting queue generation instruction to the token server, so that the token server generates a sorting queue, wherein the sorting queue is used to sort queue elements; Obtaining a priority number and token acquisition rule set for the target service; The generating token request information and sending the token request information to the target access terminal device so that the target access terminal device configures the token request information on the SDK includes: Generate token request information according to the priority number and the token acquisition rule, and send the token request information to the target access end device, so that the target access end device configures the priority number and the token acquisition rule on the SDK, and the token acquisition rule includes: when the speed limit type corresponding to the target service is a shared speed limit, first generate a serial number corresponding to the target service based on the priority number corresponding to the target service and the acquisition timestamp of the access request for obtaining the target service; then send the serial number corresponding to the target service, the first identification information and the second identification information of the access request to the token server, so that the token server sorts the first identification information and the second identification information as the first queue element corresponding to the target service in the sorting queue according to the size order of the serial numbers corresponding to the target services; finally, when the first queue element corresponding to the target service is obtained from the queue head of the sorting queue in a first-in-first-out order, send a second token acquisition request to the token server based on the first queue element corresponding to the target service.
4. The method according to claim 3, characterized in that After generating token request information according to the priority number and the token acquisition rule, and sending the token request information to the target access terminal device so that the target access terminal device configures the priority number and the token acquisition rule on the SDK, the method further includes: Sending a plurality of distributed locks to the token server so that the token server stores the plurality of distributed locks; The generating token request information according to the priority number and the token acquisition rule, and sending the token request information to the target access terminal device, so that the target access terminal device configures the priority number and the token acquisition rule on the SDK, includes: Generate token request information according to the priority number, the token acquisition rule and the distributed lock holding instruction, and send the token request information to the target access end device, so that the target access end device configures the priority number, the token acquisition rule and the distributed lock holding instruction on the SDK, and the distributed lock holding instruction is used to indicate that when the speed limit type corresponding to the target service is a shared speed limit, a distributed lock is obtained from the token server; The token acquisition rule specifically includes: when the speed limit type corresponding to the target service is a shared speed limit, when a second queue element is obtained from the queue head of the sorting queue in the first-in-first-out order, it is determined whether the sequence number corresponding to the second queue element is greater than the sequence number corresponding to the target service; when the sequence number corresponding to the second queue element is less than the sequence number corresponding to the target service, the third identification information of the second service in the second queue element is sent to the token server, so that the token server determines whether there is a corresponding distributed lock for the second service; and when there is no corresponding distributed lock for the second service, the second queue element in the sorting queue is deleted; when the sequence number corresponding to the second queue element is equal to the sequence number corresponding to the target service, the second queue element is used as the first queue element corresponding to the target service, and the second token acquisition request is sent to the token server based on the first queue element corresponding to the target service; when the sequence number corresponding to the second queue element is greater than the sequence number corresponding to the target service, the sequence number corresponding to the target service, the first identification information and the second identification information are resent to the token server, so that the token server re-sorts the first identification information and the second identification information as the first queue element corresponding to the target service in the sorting queue according to the size order of the sequence numbers corresponding to the target services.
5. The method according to any one of claims 2 to 4, characterized in that: The method further comprises: Sending a token issuance information acquisition instruction to the token server; Obtain the token issuance information recorded by the token server; wherein the token issuance information includes: the number of issued tokens and the issuance time of each token.
6. An interface speed limiting method, characterized in that: The SDK is applied to a target access terminal device, the target access terminal device is connected to a management platform; the access terminal device is also connected to a target accessed device, and a target interface is provided on the target accessed device. The method includes: Obtain the speed limit configuration information corresponding to the target service sent by the management platform, and configure the speed limit configuration information, wherein the speed limit configuration information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period; When obtaining an access request from the target service on the target access terminal device to the target accessed device, determining whether there is a private speed limit corresponding to the target service; If there is a private speed limit corresponding to the target service, determine whether there is a remaining number of private accesses to the target service in the current speed limit period; the remaining number of private accesses is the difference between the second maximum number of accesses to the private speed limit corresponding to the target service and the total number of historical private accesses to the target service in the current speed limit period; If there is a remaining private access count, based on the remaining private access count, sending the access request to the target interface of the target accessed device so that the target accessed device responds to the access request; If there is no private speed limit corresponding to the target service, determining whether there is a shared speed limit corresponding to the target service; If there is a shared speed limit corresponding to the target service, determine whether there is a remaining shared access count for the target service in the current speed limit period, where the remaining shared access count is the difference between the second maximum access count for the shared speed limit corresponding to the target service and the total number of historical shared access counts for all services sharing the second maximum access count in the current speed limit period; If there is a remaining shared access number, the access request is sent to the target interface of the target accessed device based on the remaining shared access number, so that the target accessed device responds to the access request.
7. The method according to claim 6, characterized in that After determining whether the target service has a remaining number of private accesses within the current rate limit period, the method further includes: If there is no remaining private access count, the step of determining whether there is a shared speed limit corresponding to the target service is performed.
8. The method according to claim 6 or 7, characterized in that: The target access terminal device is communicatively connected with the token server; The acquiring the speed limit configuration information corresponding to the target service sent by the management platform and configuring the speed limit configuration information includes: Obtaining speed limit configuration information and token request information corresponding to the target service sent by the management platform, and configuring the speed limit configuration information and the token request information, wherein the token request information is used to indicate sending a first token acquisition request corresponding to a private speed limit or a second token acquisition request corresponding to a shared speed limit to a token server, so as to obtain a token corresponding to the speed limit type from the token server, and sending an access request to the target interface of the target accessed device through the token corresponding to the speed limit type; The step of sending the access request to the target interface of the target accessed device based on the remaining private access times so that the target accessed device responds to the access request includes: Sending a first token acquisition request corresponding to the private speed limit to the token server; Obtaining a first token corresponding to the private speed limit returned by the token server, and sending the first token and the access request together to the target interface of the target accessed device, so that the target accessed device responds to the access request according to the first token; The step of sending the access request to the target interface of the target accessed device based on the remaining shared access times so that the target accessed device responds to the access request includes: Sending a second token acquisition request corresponding to the shared speed limit to the token server; Obtain a second token corresponding to the shared speed limit returned by the token server, and send the second token and the access request together to the target interface of the target accessed device, so that the target accessed device responds to the access request according to the second token.
9. The method according to claim 8, characterized in that The token server is provided with a sorting queue corresponding to the target interface; Different services have different priorities; The token request information includes: a priority number and a token acquisition rule, and the token acquisition rule includes: when the speed limit type corresponding to the target service is a shared speed limit, first generate a serial number corresponding to the target service based on the priority number corresponding to the target service and the acquisition timestamp of the access request for obtaining the target service; then send the serial number corresponding to the target service, the first identification information, and the second identification information of the access request to the token server, so that the token server sorts the first identification information and the second identification information as the first queue element corresponding to the target service in the sorting queue in the order of the size of the serial numbers corresponding to the target services; finally, when the first queue element corresponding to the target service is obtained from the queue head of the sorting queue in the first-in-first-out order, send a second token acquisition request to the token server based on the first queue element corresponding to the target service; The sending a second token acquisition request corresponding to the shared speed limit to the token server includes: Obtaining a priority number corresponding to the target service, an acquisition timestamp of the access request, first identification information of the target service, and second identification information of the access request; Generate a sequence number corresponding to the target service based on the priority sequence number and the acquisition timestamp; Sending the serial number corresponding to the target service, the first identification information, and the second identification information to the token server, so that the token server sorts the first identification information and the second identification information as first queue elements corresponding to the target service in the sorting queue according to the order of the serial numbers corresponding to the target services; When the first queue element corresponding to the target service is obtained from the queue head of the sorting queue in a first-in-first-out order, the second token acquisition request is sent to the token server based on the first queue element corresponding to the target service.
10. The method according to claim 9, characterized in that The generating a sequence number corresponding to the target service based on the priority sequence number and the acquisition timestamp includes: The priority number is added before the preset number of digits of the acquisition timestamp to generate a serial number corresponding to the target service, wherein the preset number of digits is the number of digits of the acquisition timestamp from the back to the front.
11. The method according to claim 9, characterized in that The token server is also provided with a plurality of distributed locks; each target service holds a distributed lock; the token acquisition rules specifically include: when the speed limit type corresponding to the target service is a shared speed limit, when a second queue element is obtained from the queue head of the sorting queue in the first-in-first-out order, it is determined whether the serial number corresponding to the second queue element is greater than the serial number corresponding to the target service; when the serial number corresponding to the second queue element is less than the serial number corresponding to the target service, the third identification information of the second service in the second queue element is sent to the token server, so that the token server determines whether there is a corresponding distributed lock for the second service; and when the corresponding distributed lock does not exist for the second service, the sorting service is deleted. the second queue element in the queue; when the sequence number corresponding to the second queue element is equal to the sequence number corresponding to the target service, taking the second queue element as the first queue element corresponding to the target service, and sending the second token acquisition request to the token server based on the first queue element corresponding to the target service; when the sequence number corresponding to the second queue element is greater than the sequence number corresponding to the target service, resending the sequence number corresponding to the target service, the first identification information and the second identification information to the token server, so that the token server re-sorts the first identification information and the second identification information as the first queue element in the sorting queue according to the size order of the sequence numbers corresponding to the target service; After sending the serial number corresponding to the target service, the first identification information, and the second identification information to the token server so that the token server sorts the first identification information and the second identification information as first queue elements in the sorting queue in the order of the size of the serial number corresponding to the target service, the method further includes: When a second queue element is obtained from the queue head of the sorting queue in the first-in-first-out order, determining whether a sequence number corresponding to the second queue element is greater than a sequence number corresponding to the target service; When the sequence number corresponding to the second queue element is less than the sequence number corresponding to the target service, the third identification information of the second service in the second queue element is sent to the token server, so that the token server determines whether there is a corresponding distributed lock for the second service; and when there is no corresponding distributed lock for the second service, the second queue element in the sorting queue is deleted; When the first queue element corresponding to the target service is obtained from the queue head of the sorting queue in a first-in-first-out order, sending the second token acquisition request to the token server based on the first queue element corresponding to the target service includes: When the serial number corresponding to the second queue element is equal to the serial number corresponding to the target service, the second queue element is used as the first queue element corresponding to the target service, and the second token acquisition request is sent to the token server based on the first queue element corresponding to the target service.
12. The method according to claim 11, characterized in that After determining whether the sequence number corresponding to the second queue element is greater than the sequence number corresponding to the target service, the method further includes: When the sequence number corresponding to the second queue element is greater than the sequence number corresponding to the target service, the sequence number corresponding to the target service, the first identification information and the second identification information are resent to the token server, so that the token server re-sorts the first identification information and the second identification information as the first queue elements corresponding to the target service in the sorting queue according to the order of the sequence numbers corresponding to the target service.
13. A speed limit configuration device, characterized in that: Applied to a management platform, the management platform is connected to a target access terminal device in communication, a service is running on the target access terminal device; the target access terminal device is connected to a target accessed device in communication, a target interface is provided on the target accessed device, and the device comprises: A display module, used for displaying a target service that can access the target interface when a rate limit configuration instruction is obtained; A first acquisition module is used to acquire speed limit setting information set for the target service; the speed limit setting information includes: a speed limit type and a second maximum access number corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum access number is privately owned by a service; the shared speed limit is used to indicate that the second maximum access number is shared by multiple services; the second maximum access number is set according to the first maximum access number of the target interface within the preset speed limit period; A determination module, used for determining a target access terminal device running the target service according to the target service; A generation module is used to generate speed limit configuration information according to the speed limit setting information, and send the speed limit configuration information to the target access terminal device, so that the target access terminal device configures the speed limit configuration information to the SDK running thereon, and after obtaining the access request sent by the target service, sends an access request to the accessed device through the speed limit configuration information configured on the SDK.
14. An interface speed limiting device, characterized in that: The SDK is applied to a target access terminal device, the target access terminal device is connected to a management platform; the access terminal device is also connected to a target accessed device, and a target interface is provided on the target accessed device. The device includes: A second acquisition module is used to acquire the speed limit configuration information corresponding to the target service sent by the management platform, and configure the speed limit configuration information, wherein the speed limit configuration information includes: a speed limit type and a second maximum number of accesses corresponding to the speed limit type within a preset speed limit period; the speed limit type includes: a shared speed limit and / or a private speed limit; the private speed limit is used to indicate that the second maximum number of accesses is privately owned by a service; the shared speed limit is used to indicate that the second maximum number of accesses is shared by multiple services; the second maximum number of accesses is set according to the first maximum number of accesses of the target interface within the preset speed limit period; A judgment module, configured to judge whether there is a private speed limit corresponding to the target service when obtaining an access request from the target service on the target access terminal device to the target accessed device; If there is a private speed limit corresponding to the target service, determine whether there is a remaining number of private accesses to the target service in the current speed limit period; the remaining number of private accesses is the difference between the second maximum number of accesses to the private speed limit corresponding to the target service and the total number of historical private accesses to the target service in the current speed limit period; If there are remaining private access times, triggering the first sending module; The first sending module is used to send the access request to the target interface of the target accessed device based on the remaining private access times, so that the target accessed device responds to the access request; If there is no private speed limit corresponding to the target service, determining whether there is a shared speed limit corresponding to the target service; If there is a shared speed limit corresponding to the target service, determine whether there is a remaining shared access count for the target service in the current speed limit period, where the remaining shared access count is the difference between the second maximum access count for the shared speed limit corresponding to the target service and the total number of historical shared access counts for all services sharing the second maximum access count in the current speed limit period; If there are remaining shared access times, triggering the second sending module; The second sending module is configured to send the access request to the target interface of the target accessed device based on the remaining shared access times, so that the target accessed device responds to the access request.
15. A management platform, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the steps of any one of the methods described in claims 1-5 when executing a program stored in a memory.
16. A target access terminal device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the steps of any of the methods described in claims 6-12 when executing a program stored in a memory.
17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in any one of claims 1-5 or 6-12 are implemented.
18. A computer program product comprising instructions, characterized in that When the method is executed on a computer, the computer is enabled to execute the steps of any one of the methods of claims 1 to 5 or 6 to 12.
19. A speed limiting system, characterized in that: The system includes: the management platform described in claim 15, the target access terminal device described in claim 16, and the target accessed device, the management platform is communicatively connected with the target access terminal device, and a service is running on the target access terminal device; the target access terminal device is communicatively connected with the target accessed device, and a target interface is set on the target accessed device.
