WO2023240506A1 - Request processing method and apparatus, server, and storage medium - Google Patents

Request processing method and apparatus, server, and storage medium Download PDF

Info

Publication number
WO2023240506A1
WO2023240506A1 PCT/CN2022/099017 CN2022099017W WO2023240506A1 WO 2023240506 A1 WO2023240506 A1 WO 2023240506A1 CN 2022099017 W CN2022099017 W CN 2022099017W WO 2023240506 A1 WO2023240506 A1 WO 2023240506A1
Authority
WO
WIPO (PCT)
Prior art keywords
requests
preset
total number
server
current
Prior art date
Application number
PCT/CN2022/099017
Other languages
French (fr)
Chinese (zh)
Inventor
黄助良
Original Assignee
北京小米移动软件有限公司
北京小米松果电子有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京小米移动软件有限公司, 北京小米松果电子有限公司 filed Critical 北京小米移动软件有限公司
Priority to PCT/CN2022/099017 priority Critical patent/WO2023240506A1/en
Priority to CN202280004482.0A priority patent/CN117716736A/en
Publication of WO2023240506A1 publication Critical patent/WO2023240506A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W48/00Access restriction; Network selection; Access point selection
    • H04W48/02Access restriction performed under specific conditions
    • H04W48/06Access restriction performed under specific conditions based on traffic conditions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/50Connection management for emergency connections

Definitions

  • the present disclosure relates to the field of computer technology, and in particular, to a request processing method, device, server and storage medium.
  • SDK Software Development Kit
  • the terminal device When the connection is disconnected, the terminal device will be triggered to reconnect to the server cyclically, causing the server to receive a large number of device connection requests in a short period of time, causing the server's central processing unit (CPU) to fail.
  • CPU central processing unit
  • embodiments of the present disclosure provide an anchor point information processing method, device, equipment and storage medium to solve the defects in the related technology.
  • embodiments of the present disclosure provide a request processing method, device, server and storage medium to solve the defects in the related technology.
  • a request processing method is provided, applied to a server, and the method includes:
  • the current remaining requests are processed based on the second preset method.
  • the sum of the first number of the current pending requests and the second number of the current remaining requests is the total number.
  • the processing of the second preset method The speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server.
  • the total number of device connection requests meets set conditions, including at least one of the following:
  • the total number of device connection requests is greater than or equal to the set quantity threshold, and the duration greater than or equal to the set quantity threshold exceeds the first set time threshold;
  • the total number of device connection requests is greater than or equal to the target number of device connection requests that the server can handle within the preset time period, and the duration that is greater than or equal to the target number exceeds the second set time threshold .
  • determining the current pending requests from the total number of device connection requests includes:
  • the first number of device connection requests is determined from the total number based on a preset rule.
  • processing the currently pending request based on a first preset method includes:
  • first preset information is sent to the first sending device, where the first preset information is used to represent that the first sending device and the server have successfully established a connection.
  • processing the current remaining requests in the total number based on the second preset method includes:
  • the method further includes repeatedly executing the following process until the number of current remaining requests that have not been processed in the first preset manner becomes 0:
  • a request processing device applied to the server, and the device includes:
  • the quantity determination module is used to determine the total number of device connection requests received within the preset time period before the current moment;
  • a request determination module configured to determine the current pending request from the total number of device connection requests in response to detecting that the total number meets the set condition
  • a first processing module configured to process the currently pending request based on a first preset method
  • the second processing module is configured to process the current remaining requests based on the second preset method.
  • the sum of the first number of the current pending requests and the second number of the current remaining requests is the total number.
  • the processing speed of the second preset method is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending messages to the service. The client then sends a device connection request.
  • the total number of device connection requests meets set conditions, including at least one of the following:
  • the total number of device connection requests is greater than or equal to the set quantity threshold, and the duration greater than or equal to the set quantity threshold exceeds the first set time threshold;
  • the total number of device connection requests is greater than or equal to the target number of device connection requests that the server can handle within the preset time period, and the duration that is greater than or equal to the target number exceeds the second set time threshold .
  • the request determination module includes:
  • a target number determination unit configured to determine the target number of device connection requests that the server can handle within the current time period based on the current load size of the central processing unit CPU of the server;
  • a first quantity determining unit configured to determine the first quantity based on the target quantity, where the first quantity is less than or equal to the target quantity;
  • a first request determining unit configured to determine the first number of device connection requests from the total number based on a preset rule.
  • the first processing module includes:
  • An information acquisition unit configured to acquire the authentication information of the first sending device of the currently pending request
  • a connection authentication unit configured to perform connection authentication on the first sending device based on the authentication information
  • a first sending unit configured to send first preset information to the first sending device in response to the connection authentication being passed, where the first preset information is used to represent that the first sending device and the server have Connection established successfully.
  • the second processing module is further configured to send second preset information to the second sending device of the current remaining request, where the second preset information is used to characterize the relationship between the second sending device and the current remaining request.
  • the server has successfully established a connection.
  • the apparatus further includes a process repeat execution module
  • the process repeat execution module is used to repeatedly execute the following process until the number of current remaining requests that have not been processed in the first preset manner becomes 0:
  • a server includes:
  • the processor is configured to, when executing the computer program, implement:
  • the current remaining requests are processed based on the second preset method.
  • the sum of the first number of the current pending requests and the second number of the current remaining requests is the total number.
  • the processing of the second preset method The speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server.
  • a computer-readable storage medium is provided, a computer program is stored thereon, and when executed by a processor, the program implements:
  • the current remaining requests are processed based on the second preset method.
  • the sum of the first number of the current pending requests and the second number of the current remaining requests is the total number.
  • the processing of the second preset method The speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server.
  • the present disclosure determines the current pending request from the total number of device connection requests by determining the total number of device connection requests received within a preset time period before the current moment, and in response to detecting that the total number meets the set conditions. , and then process the currently pending request based on the first preset method, and process the current remaining requests based on the second preset method, because the processing speed of the second preset method is higher than that of the first preset method.
  • the processing speed of the preset mode, and after being processed in the second preset mode, the second sending device of the current remaining requests will stop sending device connection requests to the server, so the number of device connection requests can be quickly reduced.
  • the amount of concurrency enables the server to process the received device connection requests in batches to achieve smooth processing of the surge in concurrent requests. Compared with related technologies that take measures such as current limiting or server expansion to relieve the pressure on the server. In this way, the present disclosure can reduce the impact on the device side and avoid increasing the hardware cost of the server.
  • Figure 1 is a flow chart of a request processing method according to an exemplary embodiment of the present disclosure
  • Figure 2 is a flowchart illustrating how to determine currently pending requests from the total number of device connection requests according to an exemplary embodiment of the present disclosure
  • Figure 3 is a flowchart showing how to process the currently pending request based on a first preset manner according to an exemplary embodiment of the present disclosure
  • Figure 4 is a flow chart of yet another request processing method according to an exemplary embodiment of the present disclosure.
  • Figure 5 is a block diagram of a request processing device according to an exemplary embodiment of the present disclosure.
  • Figure 6 is a block diagram of yet another request processing device according to an exemplary embodiment of the present disclosure.
  • Figure 7 is a block diagram of a server according to an exemplary embodiment of the present disclosure.
  • SDK Software Development Kit
  • the terminal device When the connection is disconnected, the terminal device will be triggered to reconnect to the server cyclically, causing the server to receive a large number of device connection requests in a short period of time, causing the server's central processing unit (CPU) to fail.
  • CPU central processing unit
  • measures such as current limiting or server capacity expansion are usually adopted in related technologies.
  • the current limiting measure only allows some devices to connect within a period of time, while rejecting connection requests from other devices.
  • current limiting measures are only effective for normal device connection requests, and corresponding current limiting logic needs to be set on the device. For example, when the device finds that its connection to the server has failed, it will wait for a period of time before initiating a second connection. .
  • For device connection requests triggered by the vulnerability even if the current is limited, it still cannot reduce the concurrency of the device repeatedly reconnecting to the server, that is, it cannot reduce the pressure on the server's CPU, which in turn affects other normal devices connecting to the server.
  • the expansion measures need to be planned in advance on the server.
  • server expansion measures are difficult to implement quickly, and the expansion measures Will increase the hardware cost of the server.
  • Figure 1 is a flow chart of a request processing method according to an exemplary embodiment; the method of this embodiment can be applied to servers such as local servers and cloud servers with data processing functions, and the server can be deployed on a computer.
  • Electronic equipment or a equipment cluster composed of multiple electronic equipment.
  • the method includes the following steps S101-S104:
  • step S101 the total number of device connection requests received within a preset time period before the current time is determined.
  • the server may determine the total number of device connection requests received within a preset time period before the current time.
  • the length of the above-mentioned preset time period can be set based on actual business needs, such as setting it to 1 second (that is, counting the number of device connection requests received within the current 1 second every second). In this embodiment, Not limited.
  • the above device connection request may include a connection request sent by the terminal device to the service segment when the application program on the terminal device needs to establish a connection with the server (the connection is used to enable the subsequent server to provide services for the application program).
  • step S102 in response to detecting that the total number satisfies the set condition, a currently pending request is determined from the total number of device connection requests.
  • the server determines the total number of device connection requests received within the preset time period before the current time, it can detect whether the total number meets the set conditions. If the set conditions are met, then the total number is determined from the total number. The current pending request is determined from the device connection request.
  • the total number of device connection requests when the total number of device connection requests meets the set conditions, it may include at least one of the following:
  • the total number of device connection requests is greater than or equal to the set number threshold, and the duration greater than or equal to the set number threshold exceeds the first set time threshold; wherein, the above set number threshold can be based on The service needs to be set, for example, set to tens of millions, etc. This embodiment does not limit this.
  • the total number of device connection requests is greater than or equal to the target number of device connection requests that the server can handle within the preset time period, and the duration that is greater than or equal to the target number exceeds the second set time threshold .
  • the second set time threshold is equal to or different from the first set time threshold. For example, based on the current load of the server's central processing unit (CPU), the target number of device connection requests that the server can handle within a preset time period can be estimated, and then the target number of device connection requests that can be processed by the server can be estimated when a predetermined request is detected.
  • CPU central processing unit
  • the “duration” content in the above setting conditions is to more accurately and reasonably limit the conditions that need to be met when executing this implementation plan, so as to avoid the total number of device connection requests.
  • the quantity is accidentally greater than or equal to the set quantity threshold or target quantity. It can be understood that if the total number of device connection requests is only accidentally greater than or equal to the set number threshold or target number, and then quickly returns to the normal level, in this case, there is no need to implement the subsequent steps of this embodiment. .
  • the above-mentioned method of determining the currently pending request from the total number of device connection requests may also refer to the embodiment shown in FIG. 2 below, which will not be described in detail here.
  • step S103 the currently pending request is processed based on a first preset method.
  • the currently pending request can be processed based on the first preset method. deal with.
  • the above-mentioned first preset method can be used to represent the normal processing method performed by the server on the device connection request after receiving the device connection request in related technologies, such as first performing connection authentication, and then performing authentication. How to handle steps such as information feedback after success or failure, etc.
  • the above-mentioned method of processing the currently pending request based on the first preset method may refer to the embodiment shown in FIG. 3 below, and will not be described in detail here.
  • step S104 the current remaining requests are processed based on the second preset method.
  • the current remaining requests can be processed based on the second preset method.
  • the current remaining requests may be the device connection requests excluding the currently pending requests among the above total number of device connection requests, so the sum of the first number of the current pending requests and the second number of the current remaining requests is the total quantity stated.
  • the second preset method can be regarded as a simple processing method compared to the first preset method, so the processing speed of the second preset method is higher than that of the first preset method. processing speed, and after being processed in the second preset manner, the second sending device of the current remaining requests will stop sending device connection requests to the server.
  • the first preset method includes first performing connection authentication, and then performing steps such as information feedback after the authentication succeeds or fails
  • the second preset method may only include the step of information feedback (that is, not including Connection authentication step), and the information content fed back can be used to indicate that the second sending device of the current remaining requests (different from the first sending device that sends the pending request) has successfully established a connection with the server.
  • the second sending device will send a device connection request again, which will cause the server to receive The request concurrency remains high. Therefore, in this embodiment, by having the server feedback information indicating that the connection has been successfully established, the second sending device can avoid sending a device connection request again, thereby reducing the request concurrency received by the server. Purpose.
  • the above-mentioned second preset method is not the final processing method of the device connection request, but is only a temporary processing method adopted to avoid that the second sending device will send the device connection request again, and due to the feedback of the second preset method
  • the information has not gone through the connection authentication step, so it can be regarded as a "fake connection" message fed back by the server to the second sending device.
  • the server's After the pressure is reduced those device connection requests processed based on the second preset method can be processed again in the first preset method until all device connection requests are processed in the first preset method.
  • the method of this embodiment determines the total number of device connection requests received within a preset time period before the current moment, and responds to detecting that the total number meets the set condition, from the total number of devices
  • the current pending request is determined in the connection request, and then the current pending request is processed based on the first preset method, and the current remaining requests are processed based on the second preset method.
  • the speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server, Therefore, the concurrent amount of device connection requests can be quickly reduced, allowing the server to process the received device connection requests in batches, and smoothly handle the surge in concurrent requests.
  • the present disclosure can reduce the impact on the device side and avoid increasing the hardware cost of the server.
  • Figure 2 is a flow chart showing how to determine the current pending request from the total number of device connection requests according to an exemplary embodiment of the present disclosure; this embodiment is based on the above embodiment and how to determine the current pending request from the total number of device connection requests. Determining the current pending request in the device connection request is taken as an example for illustrative explanation. As shown in Figure 2, determining the current pending requests from the total number of device connection requests described in step S102 above may include the following steps S201-S203:
  • step S201 based on the current load size of the central processing unit CPU of the server, determine the target number of device connection requests that the server can handle within the current time period;
  • step S202 the first quantity is determined based on the target quantity, and the first quantity is less than or equal to the target quantity;
  • step S203 the first number of device connection requests is determined from the total number based on a preset rule.
  • the current load size of the central processing unit CPU of the server can be obtained, and then the current load size of the CPU can be determined based on the current load size of the CPU.
  • the target number of device connection requests that the server can handle (for example, 100,000, etc.).
  • the number of device connection requests that the server can handle when the CPU is under various load conditions can be detected in advance, and a mapping relationship between the two can be established.
  • the target number of device connection requests that the server can process within the current time period can be determined based on the mapping relationship.
  • the length of the current time period may be equal to the length of the above-mentioned preset time period, such as 1 second, etc., which is not limited in this embodiment.
  • the first number can be determined based on the target number.
  • the first number can be set It is less than or equal to the target number to ensure that the server can handle the above-mentioned first number of device connection requests when the CPU is under current load.
  • the first number of device connection requests may be determined from the total number based on a preset rule. For example, a first number of device connection requests may be selected from the above total number of device connection requests in order of sending time, or the first number of device connection requests may be selected randomly.
  • the sending devices of the first number of device connection requests can also be recorded, so that it can be later distinguished which sending devices have device connection requests processed based on the first preset method and which sending devices have device connection requests processed based on the third preset method. It is processed in the second preset way, so that when the pressure of the server is reduced, those device connection requests processed based on the second preset way can be processed in the first preset way.
  • this embodiment determines the target number of device connection requests that the server can handle in the current time period based on the current load size of the central processing unit CPU of the server, and determines the target number based on the target number.
  • the first number is less than or equal to the target number, and then the first number of device connection requests are determined from the total number based on preset rules, so that the first number of device connection requests can be reasonably obtained from the total number.
  • the current pending requests are determined in the device connection requests to ensure that the server can process the first number of device connection requests when the CPU is under current load.
  • Figure 3 is a flow chart illustrating how to process the currently pending request based on a first preset manner according to an exemplary embodiment of the present disclosure; this embodiment is based on the above embodiment and how to process the request from the total number. Determining the current pending request in the device connection request is taken as an example for illustrative explanation. As shown in Figure 2, the processing of the currently pending request based on the first preset method described in step S103 above may include the following steps S301-S303:
  • step S301 obtain the authentication information of the first sending device of the currently pending request
  • step S302 perform connection authentication on the first sending device based on the authentication information
  • step S303 in response to the connection authentication passing, first preset information is sent to the first sending device.
  • the first preset information is used to indicate that the first sending device and the server have been successfully established. connect.
  • the authentication information of the first sending device of the currently pending request can be obtained, and then the authentication information is processed based on the authentication information.
  • the first sending device performs connection authentication, and then in response to the connection authentication passing, sends first preset information to the first sending device, where the first preset information is used to represent the connection between the first sending device and the first sending device.
  • the server has successfully established a connection.
  • third preset information may be sent to the first sending device.
  • the third preset information may be used to characterize the relationship between the first sending device and the service. The connection was not successfully established.
  • the first sending device includes a device that sends the above-mentioned currently pending request.
  • the above authentication information may include an encrypted string sent by the first sending device, etc.
  • the server obtains the encrypted string sent by the first sending device, it can determine whether the received authentication information is legal based on the encrypted string. If it is legal, it determines that the connection authentication has passed, and then sends the message to the first sending device. Send the first preset information; on the contrary, if it is illegal, it is determined that the connection authentication has not passed, and then the third preset information is sent to the first sending device.
  • the key when judging whether the received authentication information is legal based on the encrypted string, the key can be calculated based on the device identification (such as device identity information ID and/or device serial number, etc.) of the first sending device.
  • the encrypted string on the server side is output, and then it can be judged whether the encrypted string on the server side is consistent with the encrypted string sent by the first sending device: if they are consistent, it is determined that the received authentication information is legal; otherwise, it is determined that the received authentication information is not valid. legitimate.
  • connection authentication on the first sending device based on the authentication information is only for illustrative purposes. In practical applications, other methods can also be adopted based on actual needs to authenticate the first sending device.
  • the sending device performs connection authentication, and the results obtained are also applicable to subsequent steps in this embodiment, which is not limited in this embodiment.
  • this embodiment obtains the authentication information of the first sending device of the currently pending request, performs connection authentication on the first sending device based on the authentication information, and then responds to the connection authentication.
  • the currently pending request can be processed based on the first preset method, which can reduce the concurrency of device connection requests and achieve a surge in the number of concurrent requests. Ease the situation.
  • Figure 4 is a flow chart of yet another request processing method according to an exemplary embodiment of the present disclosure.
  • the method of this embodiment can be applied to servers such as local servers and cloud servers with data processing functions.
  • the server can be deployed in one electronic device or a device cluster composed of multiple electronic devices.
  • the method includes the following steps S401-S407:
  • step S401 determine the total number of device connection requests received within a preset time period before the current time
  • step S402 in response to detecting that the total number meets the set condition, determine the currently pending request from the total number of device connection requests;
  • step S403 the currently pending request is processed based on the first preset method
  • step S404 the current remaining requests are processed based on a second preset method.
  • the sum of the first number of currently pending requests and the second number of current remaining requests is the total number.
  • the second The processing speed of the preset method is higher than the processing speed of the first preset method, and after processing by the second preset method, the second sending device of the current remaining requests will stop sending any more requests to the server. Send device connection request.
  • step S405 in response to completing the processing of the current pending request based on the first preset method, determine the pending request again from the current remaining requests;
  • step S406 the currently pending request is processed based on the first preset method.
  • step S407 it is determined that the current number of remaining requests has become 0: if it has not become 0, step S405 is executed again; if it has become 0, the current process is ended.
  • Figure 5 is a block diagram of a request processing device according to an exemplary embodiment of the present disclosure; the device of this embodiment can be applied to servers such as local servers and cloud servers with data processing functions, and the server can be deployed in a One electronic device or a device cluster composed of multiple electronic devices.
  • servers such as local servers and cloud servers with data processing functions
  • the device may include: a quantity determination module 110, a request determination module 120, a first processing module 130 and a second processing module 140, wherein:
  • the quantity determination module 110 is used to determine the total number of device connection requests received within a preset time period before the current time;
  • the request determination module 120 is configured to determine the currently pending request from the total number of device connection requests in response to detecting that the total number meets the set condition;
  • the first processing module 130 is configured to process the currently pending request based on a first preset method
  • the second processing module 140 is configured to process the current remaining requests based on a second preset method.
  • the sum of the first number of currently pending requests and the second number of current remaining requests is the total number, so
  • the processing speed of the second preset method is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending messages to the The server then sends a device connection request.
  • the device of this embodiment determines the total number of device connection requests received within the preset time period before the current moment, and responds to detecting that the total number meets the set condition, from the total number of devices
  • the current pending request is determined in the connection request, and then the current pending request is processed based on the first preset method, and the current remaining requests are processed based on the second preset method.
  • the speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server, Therefore, the concurrent amount of device connection requests can be quickly reduced, allowing the server to process the received device connection requests in batches, and smoothly handle the surge in concurrent requests.
  • the present disclosure can reduce the impact on the device side and avoid increasing the hardware cost of the server.
  • Figure 6 is a block diagram of another request processing device according to an exemplary embodiment of the present disclosure; the device of this embodiment can be applied to servers such as local servers and cloud servers with data processing functions, and the server can be deployed on One electronic device or a device cluster composed of multiple electronic devices.
  • the quantity determination module 210, the request determination module 220, the first processing module 230 and the second processing module 240 are the same as the quantity determination module 110, the request determination module 120, the first processing module 130 and the third processing module in the embodiment shown in Figure 5.
  • the functions of the two processing modules 140 are the same and will not be described again here.
  • the total number of device connection requests meets the set conditions, which may include at least one of the following:
  • the total number of device connection requests is greater than or equal to the set quantity threshold, and the duration greater than or equal to the set quantity threshold exceeds the first set time threshold;
  • the total number of device connection requests is greater than or equal to the target number of device connection requests that the server can handle within the preset time period, and the duration that is greater than or equal to the target number exceeds the second set time threshold .
  • the request determination module 220 may include:
  • the target number determination unit 221 is configured to determine the target number of device connection requests that the server can process within the current time period based on the current load size of the central processing unit CPU of the server;
  • the first quantity determining unit 222 is configured to determine the first quantity based on the target quantity, where the first quantity is less than or equal to the target quantity;
  • the first request determining unit 223 is configured to determine the first number of device connection requests from the total number based on preset rules.
  • the first processing module 230 may include:
  • Information acquisition unit 231 configured to acquire the authentication information of the first sending device of the currently pending request
  • connection authentication unit 232 is configured to perform connection authentication on the first sending device based on the authentication information
  • the first sending unit 233 is configured to send first preset information to the first sending device in response to the connection authentication being passed.
  • the first preset information is used to characterize the first sending device and the server. Connection established successfully.
  • the second processing module 240 may also be configured to send second preset information to the second sending device of the current remaining request, where the second preset information is used to characterize the relationship between the second sending device and the current remaining request.
  • the server has successfully established a connection.
  • the above-mentioned apparatus may further include a process repeat execution module 250;
  • the process repeat execution module 250 may be configured to repeatedly execute the following process until the number of current remaining requests that have not been processed in the first preset manner becomes 0:
  • Figure 7 is a block diagram of a server according to an exemplary embodiment.
  • the device 900 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
  • device 900 may include one or more of the following components: a processing component 902, a memory 904, a power supply component 906, a multimedia component 908, an audio component 910, an input/output (I/O) interface 912, a sensor component 914, and communications component 916.
  • a processing component 902 a memory 904
  • a power supply component 906 a multimedia component 908, an audio component 910, an input/output (I/O) interface 912, a sensor component 914, and communications component 916.
  • I/O input/output
  • Processing component 902 generally controls the overall operations of device 900, such as operations associated with display, phone calls, data communications, camera operations, and recording operations.
  • the processing component 902 may include one or more processors 920 to execute instructions to complete all or part of the steps of the above method.
  • processing component 902 may include one or more modules that facilitate interaction between processing component 902 and other components.
  • processing component 902 may include a multimedia module to facilitate interaction between multimedia component 908 and processing component 902.
  • Memory 904 is configured to store various types of data to support operations at device 900 . Examples of such data include instructions for any application or method operating on device 900, contact data, phonebook data, messages, pictures, videos, etc.
  • Memory 904 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EEPROM erasable programmable read-only memory
  • EPROM Programmable read-only memory
  • PROM programmable read-only memory
  • ROM read-only memory
  • magnetic memory flash memory, magnetic or optical disk.
  • Power supply component 906 provides power to the various components of device 900 .
  • Power supply components 906 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 900 .
  • Multimedia component 908 includes a screen that provides an output interface between the device 900 and the user.
  • the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user.
  • the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide action.
  • multimedia component 908 includes a front-facing camera and/or a rear-facing camera.
  • the front camera and/or the rear camera may receive external multimedia data.
  • Each front-facing camera and rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
  • Audio component 910 is configured to output and/or input audio signals.
  • audio component 910 includes a microphone (MIC) configured to receive external audio signals when device 900 is in operating modes, such as call mode, recording mode, and speech recognition mode. The received audio signals may be further stored in memory 904 or sent via communications component 916 .
  • audio component 910 also includes a speaker for outputting audio signals.
  • the I/O interface 912 provides an interface between the processing component 902 and a peripheral interface module, which may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
  • Sensor component 914 includes one or more sensors that provide various aspects of status assessment for device 900 .
  • the sensor component 914 can detect the open/closed state of the device 900, the relative positioning of components, such as the display and keypad of the device 900, and the sensor component 914 can also detect a change in position of the device 900 or a component of the device 900. , the presence or absence of user contact with device 900 , device 900 orientation or acceleration/deceleration and temperature changes of device 900 .
  • Sensor assembly 914 may also include a proximity sensor configured to detect the presence of nearby objects without any physical contact.
  • Sensor assembly 914 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 914 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 916 is configured to facilitate wired or wireless communications between device 900 and other devices.
  • the device 900 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G or 5G, or a combination thereof.
  • the communication component 916 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communications component 916 also includes a near field communications (NFC) module to facilitate short-range communications.
  • NFC near field communications
  • the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • device 900 may be configured by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the above method.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable Gate array
  • controller microcontroller, microprocessor or other electronic component implementation for performing the above method.
  • a non-transitory computer-readable storage medium including instructions such as a memory 904 including instructions, which are executable by the processor 920 of the device 900 to complete the above method is also provided.
  • the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present disclosure relates to a request processing method and apparatus, a server, and a storage medium. The method is applied to the server, and the method comprises: determining the total number of device connection requests received within a preset time period before the current moment; in response to detecting that the total number meets a set condition, determining, from the total number of device connection requests, the current requests to be processed; on the basis of a first preset mode, processing the current requests to be processed; and processing the current remaining requests on the basis of a second preset mode, wherein the sum of a first number of the current requests to be processed and a second number of the current remaining requests is the total number, the processing speed of the second preset mode is higher than the processing speed of the first preset mode, and after the processing in the second preset mode, a second sending device for the current remaining requests stops sending the device connection requests to the server. The present disclosure can reduce the concurrency of the device connection requests and relieve the pressure of the server.

Description

请求处理方法、装置、服务端及存储介质Request processing method, device, server and storage medium 技术领域Technical field
本公开涉及计算机技术领域,尤其涉及一种请求处理方法、装置、服务端及存储介质。The present disclosure relates to the field of computer technology, and in particular, to a request processing method, device, server and storage medium.
背景技术Background technique
随着终端技术的发展,用户在终端上安装的应用程序(Application,App)变得越来越多,比如一些社交应用程序、新闻媒体应用程序、智能家居的客户端程序等。当终端设备上的应用程序运行时,需要与后台的服务器建立连接,以便服务器为该应用程序提供服务。相关技术中,在某些应用场景下,例如终端设备上应用程序运行时协同唤醒的软件开发工具包(Software Development Kit,SDK)存在漏洞或服务器所在机房的网络出现断电、断网等异常情况时,会出现连接断开的情况,继而触发终端设备循环性地重连服务器,使得服务器在短时间内接收到大量的设备连接请求,进而导致服务器的中央处理器(central processing unit,简称CPU)的负载飙升,甚至导致服务器宕机,继而又导致触发更多的连接断开及循环性重连,使情况持续恶化。With the development of terminal technology, more and more applications (Applications, Apps) are installed by users on terminals, such as some social applications, news media applications, smart home client programs, etc. When an application on the terminal device is running, it needs to establish a connection with the server in the background so that the server can provide services for the application. In related technologies, in certain application scenarios, for example, there are vulnerabilities in the Software Development Kit (SDK) that collaboratively wakes up when the application is running on the terminal device, or the network in the computer room where the server is located experiences abnormal situations such as power outages and network outages. When the connection is disconnected, the terminal device will be triggered to reconnect to the server cyclically, causing the server to receive a large number of device connection requests in a short period of time, causing the server's central processing unit (CPU) to fail. The load soared, even causing the server to crash, which in turn triggered more connection disconnections and cyclic reconnections, making the situation continue to worsen.
发明内容Contents of the invention
为克服相关技术中存在的问题,本公开实施例提供一种锚点信息处理方法、装置、设备及存储介质,用以解决相关技术中的缺陷。In order to overcome the problems existing in the related technology, embodiments of the present disclosure provide an anchor point information processing method, device, equipment and storage medium to solve the defects in the related technology.
为克服相关技术中存在的问题,本公开实施例提供一种请求处理方法、装置、服务端及存储介质,用以解决相关技术中的缺陷。In order to overcome the problems existing in the related technology, embodiments of the present disclosure provide a request processing method, device, server and storage medium to solve the defects in the related technology.
根据本公开实施例的第一方面,提供一种请求处理方法,应用于服务端,所述方法包括:According to a first aspect of an embodiment of the present disclosure, a request processing method is provided, applied to a server, and the method includes:
确定当前时刻之前预设时间段内接收到设备连接请求的总数量;Determine the total number of device connection requests received within the preset time period before the current moment;
响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求;In response to detecting that the total number satisfies the set condition, determining a current pending request from the total number of device connection requests;
基于第一预设方式对所述当前待处理请求进行处理;Process the currently pending request based on the first preset method;
基于第二预设方式对当前剩余请求进行处理,所述当前待处理请求的第一数量与所述当前剩余请求的第二数量之和为所述总数量,所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求。The current remaining requests are processed based on the second preset method. The sum of the first number of the current pending requests and the second number of the current remaining requests is the total number. The processing of the second preset method The speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server.
在一些实施例中,所述设备连接请求的总数量满足设定条件,包括以下至少一项:In some embodiments, the total number of device connection requests meets set conditions, including at least one of the following:
所述设备连接请求的总数量大于或等于设定数量阈值,且大于或等于所述设定数量阈值的持续时间超过第一设定时间阈值;The total number of device connection requests is greater than or equal to the set quantity threshold, and the duration greater than or equal to the set quantity threshold exceeds the first set time threshold;
所述设备连接请求的总数量大于或等于所述预设时间段内所述服务端能够处理的设备连接请求的目标数量,且大于或等于所述目标数量的持续时间超过第二设定时间阈值。The total number of device connection requests is greater than or equal to the target number of device connection requests that the server can handle within the preset time period, and the duration that is greater than or equal to the target number exceeds the second set time threshold .
在一些实施例中,所述从所述总数量的设备连接请求中确定当前待处理请求,包括:In some embodiments, determining the current pending requests from the total number of device connection requests includes:
基于所述服务端的中央处理器CPU的当前负载大小,确定当前时间段内所述服务端能够处理的设备连接请求的目标数量;Based on the current load size of the central processing unit CPU of the server, determine the target number of device connection requests that the server can handle within the current time period;
基于所述目标数量确定所述第一数量,所述第一数量小于或等于所述目标数量;determining the first quantity based on the target quantity, the first quantity being less than or equal to the target quantity;
基于预设规则从所述总数量中确定所述第一数量的设备连接请求。The first number of device connection requests is determined from the total number based on a preset rule.
在一些实施例中,所述基于第一预设方式对所述当前待处理请求进行处理,包括:In some embodiments, processing the currently pending request based on a first preset method includes:
获取所述当前待处理请求的第一发送设备的鉴权信息;Obtain the authentication information of the first sending device of the currently pending request;
基于所述鉴权信息对所述第一发送设备进行连接鉴权;Perform connection authentication on the first sending device based on the authentication information;
响应于连接鉴权通过,向所述第一发送设备发送第一预设信息,所述第一预设信息用于表征所述第一发送设备与所述服务端已成功建立连接。In response to the connection authentication passing, first preset information is sent to the first sending device, where the first preset information is used to represent that the first sending device and the server have successfully established a connection.
在一些实施例中,所述基于第二预设方式对所述总数量中剩余的当前剩余请求进行处理,包括:In some embodiments, processing the current remaining requests in the total number based on the second preset method includes:
向所述当前剩余请求的第二发送设备发送第二预设信息,所述第二预设信息用于表征所述第二发送设备与所述服务端已成功建立连接。Send second preset information to the second sending device of the current remaining request, where the second preset information is used to indicate that the connection between the second sending device and the server has been successfully established.
在一些实施例中,所述方法还包括重复执行以下过程,直至未经过所述第一预设方式处理的当前剩余请求的数量变为0:In some embodiments, the method further includes repeatedly executing the following process until the number of current remaining requests that have not been processed in the first preset manner becomes 0:
响应于完成基于所述第一预设方式对当前待处理请求的处理,从当前剩余请求中再次确定待处理请求;In response to completing the processing of the currently pending request based on the first preset manner, determining the pending request again from the current remaining requests;
基于所述第一预设方式对当前待处理请求进行处理。Process the currently pending request based on the first preset method.
根据本公开实施例的第二方面,提供一种请求处理装置,应用于服务端,所述装置包括:According to a second aspect of the embodiment of the present disclosure, a request processing device is provided, applied to the server, and the device includes:
数量确定模块,用于确定当前时刻之前预设时间段内接收到设备连接请求的总数量;The quantity determination module is used to determine the total number of device connection requests received within the preset time period before the current moment;
请求确定模块,用于响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求;A request determination module, configured to determine the current pending request from the total number of device connection requests in response to detecting that the total number meets the set condition;
第一处理模块,用于基于第一预设方式对所述当前待处理请求进行处理;A first processing module, configured to process the currently pending request based on a first preset method;
第二处理模块,用于基于第二预设方式对当前剩余请求进行处理,所述当前待处理请求的第一数量与所述当前剩余请求的第二数量之和为所述总数量,所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求。The second processing module is configured to process the current remaining requests based on the second preset method. The sum of the first number of the current pending requests and the second number of the current remaining requests is the total number. The processing speed of the second preset method is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending messages to the service. The client then sends a device connection request.
在一些实施例中,所述设备连接请求的总数量满足设定条件,包括以下至少一项:In some embodiments, the total number of device connection requests meets set conditions, including at least one of the following:
所述设备连接请求的总数量大于或等于设定数量阈值,且大于或等于所述设定数量阈值的持续时间超过第一设定时间阈值;The total number of device connection requests is greater than or equal to the set quantity threshold, and the duration greater than or equal to the set quantity threshold exceeds the first set time threshold;
所述设备连接请求的总数量大于或等于所述预设时间段内所述服务端能够处理的设备连接请求的目标数量,且大于或等于所述目标数量的持续时间超过第二设定时间阈值。The total number of device connection requests is greater than or equal to the target number of device connection requests that the server can handle within the preset time period, and the duration that is greater than or equal to the target number exceeds the second set time threshold .
在一些实施例中,所述请求确定模块,包括:In some embodiments, the request determination module includes:
目标数量确定单元,用于基于所述服务端的中央处理器CPU的当前负载大小,确定当前时间段内所述服务端能够处理的设备连接请求的目标数量;A target number determination unit configured to determine the target number of device connection requests that the server can handle within the current time period based on the current load size of the central processing unit CPU of the server;
第一数量确定单元,用于基于所述目标数量确定所述第一数量,所述第一数量小于或等于所述目标数量;A first quantity determining unit configured to determine the first quantity based on the target quantity, where the first quantity is less than or equal to the target quantity;
第一请求确定单元,用于基于预设规则从所述总数量中确定所述第一数量的设备连接请求。A first request determining unit configured to determine the first number of device connection requests from the total number based on a preset rule.
在一些实施例中,所述第一处理模块,包括:In some embodiments, the first processing module includes:
信息获取单元,用于获取所述当前待处理请求的第一发送设备的鉴权信息;An information acquisition unit, configured to acquire the authentication information of the first sending device of the currently pending request;
连接鉴权单元,用于基于所述鉴权信息对所述第一发送设备进行连接鉴权;A connection authentication unit, configured to perform connection authentication on the first sending device based on the authentication information;
第一发送单元,用于响应于连接鉴权通过,向所述第一发送设备发送第一预设信息,所述第一预设信息用于表征所述第一发送设备与所述服务端已成功建立连接。A first sending unit, configured to send first preset information to the first sending device in response to the connection authentication being passed, where the first preset information is used to represent that the first sending device and the server have Connection established successfully.
在一些实施例中,所述第二处理模块还用于向所述当前剩余请求的第二发送设备发送第二预设信息,所述第二预设信息用于表征所述第二发送设备与所述服务端已成功建立连接。In some embodiments, the second processing module is further configured to send second preset information to the second sending device of the current remaining request, where the second preset information is used to characterize the relationship between the second sending device and the current remaining request. The server has successfully established a connection.
在一些实施例中,所述装置还包括过程重复执行模块;In some embodiments, the apparatus further includes a process repeat execution module;
所述过程重复执行模块用于重复执行以下过程,直至未经过所述第一预设方式处理的当前剩余请求的数量变为0:The process repeat execution module is used to repeatedly execute the following process until the number of current remaining requests that have not been processed in the first preset manner becomes 0:
响应于完成基于所述第一预设方式对当前待处理请求的处理,从当前剩余请求中再 次确定待处理请求;In response to completing the processing of the current pending request based on the first preset method, determining the pending request again from the current remaining requests;
基于所述第一预设方式对当前待处理请求进行处理。Process the currently pending request based on the first preset method.
根据本公开实施例的第三方面,提供一种服务端,所述服务端包括:According to a third aspect of the embodiment of the present disclosure, a server is provided, and the server includes:
处理器以及用于存储计算机程序的存储器;Processor and memory for storing computer programs;
其中,所述处理器被配置为在执行所述计算机程序时,实现:Wherein, the processor is configured to, when executing the computer program, implement:
确定当前时刻之前预设时间段内接收到设备连接请求的总数量;Determine the total number of device connection requests received within the preset time period before the current moment;
响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求;In response to detecting that the total number satisfies the set condition, determining a current pending request from the total number of device connection requests;
基于第一预设方式对所述当前待处理请求进行处理;Process the currently pending request based on the first preset method;
基于第二预设方式对当前剩余请求进行处理,所述当前待处理请求的第一数量与所述当前剩余请求的第二数量之和为所述总数量,所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求。The current remaining requests are processed based on the second preset method. The sum of the first number of the current pending requests and the second number of the current remaining requests is the total number. The processing of the second preset method The speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server.
根据本公开实施例的第四方面,提供一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现:According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, a computer program is stored thereon, and when executed by a processor, the program implements:
确定当前时刻之前预设时间段内接收到设备连接请求的总数量;Determine the total number of device connection requests received within the preset time period before the current moment;
响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求;In response to detecting that the total number satisfies the set condition, determining a current pending request from the total number of device connection requests;
基于第一预设方式对所述当前待处理请求进行处理;Process the currently pending request based on the first preset method;
基于第二预设方式对当前剩余请求进行处理,所述当前待处理请求的第一数量与所述当前剩余请求的第二数量之和为所述总数量,所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向服务端再发送设备连接请求。The current remaining requests are processed based on the second preset method. The sum of the first number of the current pending requests and the second number of the current remaining requests is the total number. The processing of the second preset method The speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server.
本公开的实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:
本公开通过确定当前时刻之前预设时间段内接收到设备连接请求的总数量,并响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求,进而基于第一预设方式对所述当前待处理请求进行处理,以及基于第二预设方式对当前剩余请求进行处理,由于所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求,因而可以迅速减少设备连接请求的并发量,使服务端能够分批地处理接收到的设备连接请求,实现对并发请求量飙升情况的平缓性处理,相比于相关技术中采取限流或者服务器扩容等措施来缓解服务端的压力的方式,本公开可以降低对设备端的影响,且可以避免提升服务器的硬件成本。The present disclosure determines the current pending request from the total number of device connection requests by determining the total number of device connection requests received within a preset time period before the current moment, and in response to detecting that the total number meets the set conditions. , and then process the currently pending request based on the first preset method, and process the current remaining requests based on the second preset method, because the processing speed of the second preset method is higher than that of the first preset method. The processing speed of the preset mode, and after being processed in the second preset mode, the second sending device of the current remaining requests will stop sending device connection requests to the server, so the number of device connection requests can be quickly reduced. The amount of concurrency enables the server to process the received device connection requests in batches to achieve smooth processing of the surge in concurrent requests. Compared with related technologies that take measures such as current limiting or server expansion to relieve the pressure on the server. In this way, the present disclosure can reduce the impact on the device side and avoid increasing the hardware cost of the server.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only, and do not limit the present disclosure.
附图说明Description of the drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
图1是根据本公开一示例性实施例示出的一种请求处理方法的流程图;Figure 1 is a flow chart of a request processing method according to an exemplary embodiment of the present disclosure;
图2是根据本公开一示例性实施例示出的如何从所述总数量的设备连接请求中确定当前待处理请求的流程图;Figure 2 is a flowchart illustrating how to determine currently pending requests from the total number of device connection requests according to an exemplary embodiment of the present disclosure;
图3是根据本公开一示例性实施例示出的如何基于第一预设方式对所述当前待处理请求进行处理的流程图;Figure 3 is a flowchart showing how to process the currently pending request based on a first preset manner according to an exemplary embodiment of the present disclosure;
图4是根据本公开一示例性实施例示出的又一种请求处理方法的流程图;Figure 4 is a flow chart of yet another request processing method according to an exemplary embodiment of the present disclosure;
图5是根据本公开一示例性实施例示出的一种请求处理装置的框图;Figure 5 is a block diagram of a request processing device according to an exemplary embodiment of the present disclosure;
图6是根据本公开一示例性实施例示出的又一种请求处理装置的框图;Figure 6 is a block diagram of yet another request processing device according to an exemplary embodiment of the present disclosure;
图7是根据本公开一示例性实施例示出的一种服务器的框图。Figure 7 is a block diagram of a server according to an exemplary embodiment of the present disclosure.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施例并不代表与本公开相一致的所有实施例。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings refer to the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with aspects of the disclosure as detailed in the appended claims.
随着终端技术的发展,用户在终端上安装的应用程序(Application,App)变得越来越多,比如一些社交应用程序、新闻媒体应用程序、智能家居的客户端程序等。当终端设备上的应用程序运行时,需要与后台的服务器建立连接,以便服务器为该应用程序提供服务。相关技术中,在某些应用场景下,例如终端设备上应用程序运行时协同唤醒的软件开发工具包(Software Development Kit,SDK)存在漏洞或服务器所在机房的网络出现断电、断网等异常情况时,会出现连接断开的情况,继而触发终端设备循环性地重连服务器,使得服务器在短时间内接收到大量的设备连接请求,进而导致服务器的中央处理器(central processing unit,简称CPU)的负载飙升,甚至导致服务器宕机,继而又导致触发更多的连接断开及循环性重连,使情况持续恶化。With the development of terminal technology, more and more applications (Applications, Apps) are installed by users on terminals, such as some social applications, news media applications, smart home client programs, etc. When an application on the terminal device is running, it needs to establish a connection with the server in the background so that the server can provide services for the application. In related technologies, in certain application scenarios, for example, there are vulnerabilities in the Software Development Kit (SDK) that collaboratively wakes up when the application is running on the terminal device, or the network in the computer room where the server is located experiences abnormal situations such as power outages and network outages. When the connection is disconnected, the terminal device will be triggered to reconnect to the server cyclically, causing the server to receive a large number of device connection requests in a short period of time, causing the server's central processing unit (CPU) to fail. The load soared, even causing the server to crash, which in turn triggered more connection disconnections and cyclic reconnections, making the situation continue to worsen.
为了解决上述问题,相关技术中通常是采取限流或者服务器扩容等措施。其中,限流措施即每段时间内只允许一部分设备进行连接,而拒绝其余设备的连接请求。然而,限流措施仅对正常的设备连接请求有效,且需要在设备端上也设置相应的限流逻辑,例如当设备发现自身和服务器连接失败后,则等待一段时间后再发起第二次连接。而对于由漏洞触发的设备连接请求,即使对其进行限流,仍然无法减少设备反复重连服务器的并发量,即无法减轻服务器的CPU的压力,进而影响其他正常的设备连接服务器。而扩容措施需要在服务器上进行提前规划,对于因为SDK漏洞或机房网络断电、断网等异常情况导致的短时间内设备连接请求数量飙升的情况,服务器扩容措施很难快速实施,而且扩容措施会提升服务器的硬件成本。有鉴于此,本公开实施例提供以下请求处理方法、装置、服务端及存储介质,用以解决相关技术中的上述问题。In order to solve the above problems, measures such as current limiting or server capacity expansion are usually adopted in related technologies. Among them, the current limiting measure only allows some devices to connect within a period of time, while rejecting connection requests from other devices. However, current limiting measures are only effective for normal device connection requests, and corresponding current limiting logic needs to be set on the device. For example, when the device finds that its connection to the server has failed, it will wait for a period of time before initiating a second connection. . For device connection requests triggered by the vulnerability, even if the current is limited, it still cannot reduce the concurrency of the device repeatedly reconnecting to the server, that is, it cannot reduce the pressure on the server's CPU, which in turn affects other normal devices connecting to the server. The expansion measures need to be planned in advance on the server. When the number of device connection requests soars in a short period of time due to abnormal situations such as SDK vulnerabilities or computer room network power outages or disconnections, server expansion measures are difficult to implement quickly, and the expansion measures Will increase the hardware cost of the server. In view of this, embodiments of the present disclosure provide the following request processing methods, devices, servers, and storage media to solve the above problems in related technologies.
图1是根据一示例性实施例示出的一种请求处理方法的流程图;本实施例的方法可以应用于具有数据处理功能的本地服务器和云服务器等服务端,该服务端可以部署在一台电子设备或多台电子设备组成的设备集群中。Figure 1 is a flow chart of a request processing method according to an exemplary embodiment; the method of this embodiment can be applied to servers such as local servers and cloud servers with data processing functions, and the server can be deployed on a computer. Electronic equipment or a equipment cluster composed of multiple electronic equipment.
如图1所示,该方法包括以下步骤S101-S104:As shown in Figure 1, the method includes the following steps S101-S104:
在步骤S101中,确定当前时刻之前预设时间段内接收到设备连接请求的总数量。In step S101, the total number of device connection requests received within a preset time period before the current time is determined.
本实施例中,服务端可以确定当前时刻之前预设时间段内接收到设备连接请求的总数量。In this embodiment, the server may determine the total number of device connection requests received within a preset time period before the current time.
其中,上述预设时间段的长度可以基于实际业务需要进行设置,如设置为1秒等(即,每秒钟统计一次当前1秒内接收到的设备连接请求的数量),本实施例对此不进行限定。Among them, the length of the above-mentioned preset time period can be set based on actual business needs, such as setting it to 1 second (that is, counting the number of device connection requests received within the current 1 second every second). In this embodiment, Not limited.
上述设备连接请求可以包括当终端设备上的应用程序需要与服务端建立连接(该连接用于实现后续服务器为该应用程序提供服务)时,通过该终端设备向服务段所发送的连接请求。The above device connection request may include a connection request sent by the terminal device to the service segment when the application program on the terminal device needs to establish a connection with the server (the connection is used to enable the subsequent server to provide services for the application program).
在步骤S102中,响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求。In step S102, in response to detecting that the total number satisfies the set condition, a currently pending request is determined from the total number of device connection requests.
本实施例中,当服务端确定当前时刻之前预设时间段内接收到设备连接请求的总数量后,可以检测该总数量是否满足设定条件,如果满足设定条件,则从所述总数量的设备连接请求中确定当前待处理请求。In this embodiment, after the server determines the total number of device connection requests received within the preset time period before the current time, it can detect whether the total number meets the set conditions. If the set conditions are met, then the total number is determined from the total number. The current pending request is determined from the device connection request.
在一些实施例中,上述设备连接请求的总数量满足设定条件的情况,可以包括以下至少一项:In some embodiments, when the total number of device connection requests meets the set conditions, it may include at least one of the following:
所述设备连接请求的总数量大于或等于设定数量阈值,且大于或等于所述设定数量阈值的持续时间超过第一设定时间阈值;其中,上述设定数量阈值可以在实际应用中基于业务需要进行设置,如设置为几千万等,本实施例对此不进行限定。The total number of device connection requests is greater than or equal to the set number threshold, and the duration greater than or equal to the set number threshold exceeds the first set time threshold; wherein, the above set number threshold can be based on The service needs to be set, for example, set to tens of millions, etc. This embodiment does not limit this.
所述设备连接请求的总数量大于或等于所述预设时间段内所述服务端能够处理的设备连接请求的目标数量,且大于或等于所述目标数量的持续时间超过第二设定时间阈值。其中,所述第二设定时间阈值与所述第一设定时间阈值相等或不等。示例性地,可以基于服务端的中央处理器(central processing unit,简称CPU)的当前负载,预估预设时间段内所述服务端能够处理的设备连接请求的目标数量,进而可以当检测到预设时间段内设备连接请求的总数量大于或等于所述预设时间段内所述服务端能够处理的设备连接请求的目标数量,且大于或等于所述目标数量的持续时间超过第二设定时间阈值时,判定设备连接请求的总数量满足设定条件,进而继续执行本实施例的后续步骤。The total number of device connection requests is greater than or equal to the target number of device connection requests that the server can handle within the preset time period, and the duration that is greater than or equal to the target number exceeds the second set time threshold . Wherein, the second set time threshold is equal to or different from the first set time threshold. For example, based on the current load of the server's central processing unit (CPU), the target number of device connection requests that the server can handle within a preset time period can be estimated, and then the target number of device connection requests that can be processed by the server can be estimated when a predetermined request is detected. Assume that the total number of device connection requests within the time period is greater than or equal to the target number of device connection requests that the server can handle within the preset time period, and the duration that is greater than or equal to the target number exceeds the second setting When the time threshold is reached, it is determined that the total number of device connection requests meets the set conditions, and then the subsequent steps of this embodiment are continued.
值得说明的是,上述设定条件中关于“持续时间”的内容,是为了更准确、合理地限定执行本实施方案时设备连接请求的总数量所需满足的条件,以规避设备连接请求的总数量偶然大于或等于设定数量阈值或目标数量的情况。可以理解的是,如果设备连接请求的总数量仅是偶然大于或等于设定数量阈值或目标数量,而又很快恢复到正常水平,则在这种情况下可以无需实施本实施例的后续步骤。It is worth noting that the “duration” content in the above setting conditions is to more accurately and reasonably limit the conditions that need to be met when executing this implementation plan, so as to avoid the total number of device connection requests. The quantity is accidentally greater than or equal to the set quantity threshold or target quantity. It can be understood that if the total number of device connection requests is only accidentally greater than or equal to the set number threshold or target number, and then quickly returns to the normal level, in this case, there is no need to implement the subsequent steps of this embodiment. .
在另一些实施例中,上述从所述总数量的设备连接请求中确定当前待处理请求的方式还可以参见下述图2所示实施例,在此先不进行详述。In other embodiments, the above-mentioned method of determining the currently pending request from the total number of device connection requests may also refer to the embodiment shown in FIG. 2 below, which will not be described in detail here.
在步骤S103中,基于第一预设方式对所述当前待处理请求进行处理。In step S103, the currently pending request is processed based on a first preset method.
本实施例中,当检测到所述总数量满足设定条件,并从所述总数量的设备连接请求中确定当前待处理请求后,可以基于第一预设方式对所述当前待处理请求进行处理。In this embodiment, when it is detected that the total number meets the set condition and the current pending request is determined from the total number of device connection requests, the currently pending request can be processed based on the first preset method. deal with.
在一些实施例中,上述第一预设方式可以用于表征相关技术中服务端接收到设备连接请求后,对设备连接请求所执行的正常处理方式,如先进行连接鉴权,再在鉴权成功或失败后进行信息反馈等步骤的处理方式等。In some embodiments, the above-mentioned first preset method can be used to represent the normal processing method performed by the server on the device connection request after receiving the device connection request in related technologies, such as first performing connection authentication, and then performing authentication. How to handle steps such as information feedback after success or failure, etc.
在另一些实施例中,上述基于第一预设方式对所述当前待处理请求进行处理的方式可以参见下述图3所示实施例,在此先不进行详述。In other embodiments, the above-mentioned method of processing the currently pending request based on the first preset method may refer to the embodiment shown in FIG. 3 below, and will not be described in detail here.
在步骤S104中,基于第二预设方式对当前剩余请求进行处理。In step S104, the current remaining requests are processed based on the second preset method.
本实施例中,当检测到所述总数量满足设定条件,并从所述总数量的设备连接请求中确定当前待处理请求后,可以基于第二预设方式对当前剩余请求进行处理。其中,当前剩余请求可以为上述总数量的设备连接请求中除去当前待处理请求之外的设备连接请求,因而所述当前待处理请求的第一数量与所述当前剩余请求的第二数量之和为所述总数量。In this embodiment, when it is detected that the total number meets the set condition and the current pending requests are determined from the total number of device connection requests, the current remaining requests can be processed based on the second preset method. Wherein, the current remaining requests may be the device connection requests excluding the currently pending requests among the above total number of device connection requests, so the sum of the first number of the current pending requests and the second number of the current remaining requests is the total quantity stated.
在一些实施例中,上述第二预设方式相对于第一预设方式而言,可以视为一种简易处理方式,因而第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求。示例性地,在第一预设方式包括先进行连接鉴权,再在鉴权成功或失败后进行信息反馈等步骤的情况下,第二预设方式可以仅包括信息反馈的步骤(即不包括连接鉴权步骤),且所反馈的信息内容可以用于表征当前剩余请求的第二发送设备(区别于发送待处理请求的第一发送设备)与所述服务端已成功建立连接。可以理解的是,如果所反馈的信息内容用于表征当前剩余请求的第二发送设备与所述服务端未成功建立连接,则第二发送设备会再次发送设备连接请求,会导致服务端接收到的请求并发量居高不下,因而本实施例中通过令服务端反馈表征已成功建立连接的信息,可以避免第二发送设备再次发送设备连接请求,从而达到降低服务端接收到的请求并发量的目的。In some embodiments, the second preset method can be regarded as a simple processing method compared to the first preset method, so the processing speed of the second preset method is higher than that of the first preset method. processing speed, and after being processed in the second preset manner, the second sending device of the current remaining requests will stop sending device connection requests to the server. For example, in the case where the first preset method includes first performing connection authentication, and then performing steps such as information feedback after the authentication succeeds or fails, the second preset method may only include the step of information feedback (that is, not including Connection authentication step), and the information content fed back can be used to indicate that the second sending device of the current remaining requests (different from the first sending device that sends the pending request) has successfully established a connection with the server. It can be understood that if the information content fed back is used to represent the second sending device of the current remaining request and the server fails to successfully establish a connection, the second sending device will send a device connection request again, which will cause the server to receive The request concurrency remains high. Therefore, in this embodiment, by having the server feedback information indicating that the connection has been successfully established, the second sending device can avoid sending a device connection request again, thereby reducing the request concurrency received by the server. Purpose.
值得说明的是,上述第二预设方式并不是设备连接请求的最终处理方式,只是为了 避免第二发送设备会再次发送设备连接请求所采取的临时处理方式,并且由于第二预设方式的反馈信息是未经过连接鉴权步骤,因而可以视为服务端向第二发送设备反馈的是一个“假连接”消息,当通过分批地基于第一预设方式处理当前待处理请求,使得服务器的压力有所降低后,可以再针对那些基于第二预设方式处理的设备连接请求,重新采用第一预设方式进行处理,直到全部的设备连接请求均经过第一预设方式的处理。It is worth noting that the above-mentioned second preset method is not the final processing method of the device connection request, but is only a temporary processing method adopted to avoid that the second sending device will send the device connection request again, and due to the feedback of the second preset method The information has not gone through the connection authentication step, so it can be regarded as a "fake connection" message fed back by the server to the second sending device. When the current pending requests are processed in batches based on the first preset method, the server's After the pressure is reduced, those device connection requests processed based on the second preset method can be processed again in the first preset method until all device connection requests are processed in the first preset method.
由上述描述可知,本实施例的方法通过确定当前时刻之前预设时间段内接收到设备连接请求的总数量,并响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求,进而基于第一预设方式对所述当前待处理请求进行处理,以及基于第二预设方式对当前剩余请求进行处理,由于所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求,因而可以迅速减少设备连接请求的并发量,使服务端能够分批地处理接收到的设备连接请求,实现对并发请求量飙升情况的平缓性处理,相比于相关技术中采取限流或者服务器扩容等措施来缓解服务端的压力的方式,本公开可以降低对设备端的影响,且可以避免提升服务器的硬件成本。As can be seen from the above description, the method of this embodiment determines the total number of device connection requests received within a preset time period before the current moment, and responds to detecting that the total number meets the set condition, from the total number of devices The current pending request is determined in the connection request, and then the current pending request is processed based on the first preset method, and the current remaining requests are processed based on the second preset method. Due to the processing of the second preset method The speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server, Therefore, the concurrent amount of device connection requests can be quickly reduced, allowing the server to process the received device connection requests in batches, and smoothly handle the surge in concurrent requests. Compared with current limiting or server expansion in related technologies, By taking other measures to alleviate the pressure on the server side, the present disclosure can reduce the impact on the device side and avoid increasing the hardware cost of the server.
图2是根据本公开一示例性实施例示出的如何从所述总数量的设备连接请求中确定当前待处理请求的流程图;本实施例在上述实施例的基础上以如何从所述总数量的设备连接请求中确定当前待处理请求为例进行示例性说明。如图2所示,上述步骤S102中所述的从所述总数量的设备连接请求中确定当前待处理请求,可以包括以下步骤S201-S203:Figure 2 is a flow chart showing how to determine the current pending request from the total number of device connection requests according to an exemplary embodiment of the present disclosure; this embodiment is based on the above embodiment and how to determine the current pending request from the total number of device connection requests. Determining the current pending request in the device connection request is taken as an example for illustrative explanation. As shown in Figure 2, determining the current pending requests from the total number of device connection requests described in step S102 above may include the following steps S201-S203:
在步骤S201中,基于所述服务端的中央处理器CPU的当前负载大小,确定当前时间段内所述服务端能够处理的设备连接请求的目标数量;In step S201, based on the current load size of the central processing unit CPU of the server, determine the target number of device connection requests that the server can handle within the current time period;
在步骤S202中,基于所述目标数量确定所述第一数量,所述第一数量小于或等于所述目标数量;In step S202, the first quantity is determined based on the target quantity, and the first quantity is less than or equal to the target quantity;
在步骤S203中,基于预设规则从所述总数量中确定所述第一数量的设备连接请求。In step S203, the first number of device connection requests is determined from the total number based on a preset rule.
本实施例中,当需要从所述总数量的设备连接请求中确定当前待处理请求时,可以获取服务端的中央处理器CPU的当前负载大小,进而可以基于CPU的当前负载大小确定当前时间段内所述服务端能够处理的设备连接请求的目标数量(如,10万个等)。示例性地,可以预先检测当CPU处于各种不同负载的情况下,服务端能够处理的设备连接请求的数量,并建立二者间的映射关系。进而当确定CPU的当前负载大小后,可以基于该映射关系确定当前时间段内所述服务端能够处理的设备连接请求的目标数量。示例性地,所述当前时间段的长度可以与上述预设时间段的长度相等,如1秒等,本实施例对此不进行限定。In this embodiment, when it is necessary to determine the current pending request from the total number of device connection requests, the current load size of the central processing unit CPU of the server can be obtained, and then the current load size of the CPU can be determined based on the current load size of the CPU. The target number of device connection requests that the server can handle (for example, 100,000, etc.). For example, the number of device connection requests that the server can handle when the CPU is under various load conditions can be detected in advance, and a mapping relationship between the two can be established. Furthermore, after determining the current load size of the CPU, the target number of device connection requests that the server can process within the current time period can be determined based on the mapping relationship. For example, the length of the current time period may be equal to the length of the above-mentioned preset time period, such as 1 second, etc., which is not limited in this embodiment.
在此基础上,当确定当前时间段内所述服务端能够处理的设备连接请求的目标数量后,可以基于所述目标数量确定所述第一数量,示例性地,可以将上述第一数量设置为小于或等于目标数量,以确保在CPU处于当前负载的情况下,服务端能够处理的上述第一数量的设备连接请求。On this basis, after determining the target number of device connection requests that the server can handle within the current time period, the first number can be determined based on the target number. For example, the first number can be set It is less than or equal to the target number to ensure that the server can handle the above-mentioned first number of device connection requests when the CPU is under current load.
进一步地,可以基于预设规则从所述总数量中确定所述第一数量的设备连接请求。例如,可以从上述总数量的设备连接请求中按照发送时间的先后选取第一数量的设备连接请求,或者随机选取第一数量的设备连接请求。并且,还可以对该第一数量的设备连接请求的发送设备进行记录,以便后续可以区分哪些发送设备的设备连接请求是基于第一预设方式处理的,哪些发送设备的设备连接请求是基于第二预设方式处理的,从而可以当服务器的压力降低后,再针对那些基于第二预设方式处理的设备连接请求,进行第一预设方式的处理。Further, the first number of device connection requests may be determined from the total number based on a preset rule. For example, a first number of device connection requests may be selected from the above total number of device connection requests in order of sending time, or the first number of device connection requests may be selected randomly. Moreover, the sending devices of the first number of device connection requests can also be recorded, so that it can be later distinguished which sending devices have device connection requests processed based on the first preset method and which sending devices have device connection requests processed based on the third preset method. It is processed in the second preset way, so that when the pressure of the server is reduced, those device connection requests processed based on the second preset way can be processed in the first preset way.
由上述描述可知,本实施例通过基于所述服务端的中央处理器CPU的当前负载大小,确定当前时间段内所述服务端能够处理的设备连接请求的目标数量,并基于所述目标数量确定所述第一数量,所述第一数量小于或等于所述目标数量,进而基于预设规 则从所述总数量中确定所述第一数量的设备连接请求,可以实现合理地从所述总数量的设备连接请求中确定当前待处理请求,确保在CPU处于当前负载的情况下,服务端能够处理的上述第一数量的设备连接请求。As can be seen from the above description, this embodiment determines the target number of device connection requests that the server can handle in the current time period based on the current load size of the central processing unit CPU of the server, and determines the target number based on the target number. The first number is less than or equal to the target number, and then the first number of device connection requests are determined from the total number based on preset rules, so that the first number of device connection requests can be reasonably obtained from the total number. The current pending requests are determined in the device connection requests to ensure that the server can process the first number of device connection requests when the CPU is under current load.
图3是根据本公开一示例性实施例示出的如何基于第一预设方式对所述当前待处理请求进行处理的流程图;本实施例在上述实施例的基础上以如何从所述总数量的设备连接请求中确定当前待处理请求为例进行示例性说明。如图2所示,上述步骤S103中所述的所述基于第一预设方式对所述当前待处理请求进行处理,可以包括以下步骤S301-S303:Figure 3 is a flow chart illustrating how to process the currently pending request based on a first preset manner according to an exemplary embodiment of the present disclosure; this embodiment is based on the above embodiment and how to process the request from the total number. Determining the current pending request in the device connection request is taken as an example for illustrative explanation. As shown in Figure 2, the processing of the currently pending request based on the first preset method described in step S103 above may include the following steps S301-S303:
在步骤S301中,获取所述当前待处理请求的第一发送设备的鉴权信息;In step S301, obtain the authentication information of the first sending device of the currently pending request;
在步骤S302中,基于所述鉴权信息对所述第一发送设备进行连接鉴权;In step S302, perform connection authentication on the first sending device based on the authentication information;
在步骤S303中,响应于连接鉴权通过,向所述第一发送设备发送第一预设信息,所述第一预设信息用于表征所述第一发送设备与所述服务端已成功建立连接。In step S303, in response to the connection authentication passing, first preset information is sent to the first sending device. The first preset information is used to indicate that the first sending device and the server have been successfully established. connect.
本实施例中,当基于第一预设方式对所述当前待处理请求进行处理时,可以获取所述当前待处理请求的第一发送设备的鉴权信息,然后基于所述鉴权信息对所述第一发送设备进行连接鉴权,进而响应于连接鉴权通过,向所述第一发送设备发送第一预设信息,所述第一预设信息用于表征所述第一发送设备与所述服务端已成功建立连接。在另一些实施例中,可以响应于连接鉴权未通过,向所述第一发送设备发送第三预设信息,该第三预设信息可以用于表征所述第一发送设备与所述服务端未成功建立连接。In this embodiment, when the currently pending request is processed based on the first preset method, the authentication information of the first sending device of the currently pending request can be obtained, and then the authentication information is processed based on the authentication information. The first sending device performs connection authentication, and then in response to the connection authentication passing, sends first preset information to the first sending device, where the first preset information is used to represent the connection between the first sending device and the first sending device. The server has successfully established a connection. In other embodiments, in response to failure in connection authentication, third preset information may be sent to the first sending device. The third preset information may be used to characterize the relationship between the first sending device and the service. The connection was not successfully established.
其中,第一发送设备包括发送上述当前待处理请求的设备。举例来说,上述鉴权信息可以包括第一发送设备发送的加密字符串等。当服务端获取到第一发送设备发送的加密字符串后,可以根据该加密字符串判断接收到的鉴权信息是否合法:若合法,则判定连接鉴权通过,进而向所述第一发送设备发送第一预设信息;相反,若不合法,则判定连接鉴权未通过,进而向所述第一发送设备发送第三预设信息。示例性地,当根据该加密字符串判断接收到的鉴权信息是否会合法时,可以根据第一发送设备的设备标识(如,设备身份信息ID和/或设备序列号等)和密钥计算出服务端的加密字符串,进而可以判断服务端的加密字符串与第一发送设备发送的加密字符串是否一致:若一致,判定接收到的鉴权信息合法;否则,判定接收到的鉴权信息不合法。Wherein, the first sending device includes a device that sends the above-mentioned currently pending request. For example, the above authentication information may include an encrypted string sent by the first sending device, etc. After the server obtains the encrypted string sent by the first sending device, it can determine whether the received authentication information is legal based on the encrypted string. If it is legal, it determines that the connection authentication has passed, and then sends the message to the first sending device. Send the first preset information; on the contrary, if it is illegal, it is determined that the connection authentication has not passed, and then the third preset information is sent to the first sending device. For example, when judging whether the received authentication information is legal based on the encrypted string, the key can be calculated based on the device identification (such as device identity information ID and/or device serial number, etc.) of the first sending device. The encrypted string on the server side is output, and then it can be judged whether the encrypted string on the server side is consistent with the encrypted string sent by the first sending device: if they are consistent, it is determined that the received authentication information is legal; otherwise, it is determined that the received authentication information is not valid. legitimate.
值得说明的是,上述基于所述鉴权信息对所述第一发送设备进行连接鉴权的方式仅用于示例性说明,在实际应用中,还可以基于实际需要采取其他方式对所述第一发送设备进行连接鉴权,所得结果同样适用于本实施例的后续步骤,本实施例对此不进行限定。It is worth noting that the above-mentioned method of performing connection authentication on the first sending device based on the authentication information is only for illustrative purposes. In practical applications, other methods can also be adopted based on actual needs to authenticate the first sending device. The sending device performs connection authentication, and the results obtained are also applicable to subsequent steps in this embodiment, which is not limited in this embodiment.
由上述描述可知,本实施例通过获取所述当前待处理请求的第一发送设备的鉴权信息,并基于所述鉴权信息对所述第一发送设备进行连接鉴权,进而响应于连接鉴权通过,向所述第一发送设备发送第一预设信息,可以实现基于第一预设方式对所述当前待处理请求进行处理,可以减少设备连接请求的并发量,实现对并发请求量飙升情况的平缓性处理。As can be seen from the above description, this embodiment obtains the authentication information of the first sending device of the currently pending request, performs connection authentication on the first sending device based on the authentication information, and then responds to the connection authentication. By sending the first preset information to the first sending device, the currently pending request can be processed based on the first preset method, which can reduce the concurrency of device connection requests and achieve a surge in the number of concurrent requests. Ease the situation.
图4是根据本公开一示例性实施例示出的又一种请求处理方法的流程图;Figure 4 is a flow chart of yet another request processing method according to an exemplary embodiment of the present disclosure;
本实施例的方法可以应用于具有数据处理功能的本地服务器和云服务器等服务端,该服务端可以部署在一台电子设备或多台电子设备组成的设备集群中。The method of this embodiment can be applied to servers such as local servers and cloud servers with data processing functions. The server can be deployed in one electronic device or a device cluster composed of multiple electronic devices.
如图4所示,该方法包括以下步骤S401-S407:As shown in Figure 4, the method includes the following steps S401-S407:
在步骤S401中,确定当前时刻之前预设时间段内接收到设备连接请求的总数量;In step S401, determine the total number of device connection requests received within a preset time period before the current time;
在步骤S402中,响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求;In step S402, in response to detecting that the total number meets the set condition, determine the currently pending request from the total number of device connection requests;
在步骤S403中,基于第一预设方式对所述当前待处理请求进行处理;In step S403, the currently pending request is processed based on the first preset method;
在步骤S404中,基于第二预设方式对当前剩余请求进行处理,所述当前待处理请求的第一数量与所述当前剩余请求的第二数量之和为所述总数量,所述第二预设方式 的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求。In step S404, the current remaining requests are processed based on a second preset method. The sum of the first number of currently pending requests and the second number of current remaining requests is the total number. The second The processing speed of the preset method is higher than the processing speed of the first preset method, and after processing by the second preset method, the second sending device of the current remaining requests will stop sending any more requests to the server. Send device connection request.
其中,上述步骤S401-S404的相关解释和说明可以参见上述图1所示实施例中的步骤S101-S104,在此不进行赘述。For relevant explanations and descriptions of the above-mentioned steps S401-S404, please refer to the above-mentioned steps S101-S104 in the embodiment shown in FIG. 1, and will not be described again here.
在步骤S405中,响应于完成基于所述第一预设方式对当前待处理请求的处理,从当前剩余请求中再次确定待处理请求;In step S405, in response to completing the processing of the current pending request based on the first preset method, determine the pending request again from the current remaining requests;
在步骤S406中,基于所述第一预设方式对当前待处理请求进行处理。In step S406, the currently pending request is processed based on the first preset method.
在步骤S407中,确定当前剩余请求的数量变为0:若未变为0,则再次执行步骤S405;若已变为0,则结束当前的流程。In step S407, it is determined that the current number of remaining requests has become 0: if it has not become 0, step S405 is executed again; if it has become 0, the current process is ended.
本实施例中,当完成基于所述第一预设方式对当前待处理请求的处理后,可以从当前剩余请求中再次确定不同的待处理请求,进而再基于所述第一预设方式对当前待处理请求进行处理,具体的处理方式可以参见上述图3所示实施例,在此不进行赘述。可以理解的是,由于当前剩余请求为未经过所述第一预设方式处理的设备连接请求,因而每次从当前剩余请求中确定待处理请求并基于第一预设方式进行处理后,当前剩余请求的数量会减少。因而,在每次基于所述第一预设方式对当前待处理请求进行处理后,判断当前剩余请求的数量是否变为0:若未变为0,则从当前剩余请求中再次确定待处理请求,并基于第一预设方式进行处理;而若已变为0,则可以结束本实施例的方法流程。由此可知,当结束本实施例的方法流程时,所述总数量的设备连接请求均已经过所述第一预设方式的处理。In this embodiment, after completing the processing of the current pending request based on the first preset method, different pending requests can be determined again from the current remaining requests, and then the current pending request can be processed based on the first preset method. The pending request is processed. For the specific processing method, please refer to the embodiment shown in Figure 3 above, which will not be described in detail here. It can be understood that since the current remaining requests are device connection requests that have not been processed in the first preset manner, each time the pending requests are determined from the current remaining requests and processed based on the first preset manner, the current remaining requests are The number of requests will decrease. Therefore, after each current pending request is processed based on the first preset method, it is determined whether the number of current remaining requests becomes 0: if it does not become 0, then the pending requests are determined again from the current remaining requests. , and the process is performed based on the first preset method; and if it becomes 0, the method flow of this embodiment can be ended. It can be seen from this that when the method process of this embodiment ends, the total number of device connection requests have been processed in the first preset manner.
图5是根据本公开一示例性实施例示出的一种请求处理装置的框图;本实施例的装置可以应用于具有数据处理功能的本地服务器和云服务器等服务端,该服务端可以部署在一台电子设备或多台电子设备组成的设备集群中。Figure 5 is a block diagram of a request processing device according to an exemplary embodiment of the present disclosure; the device of this embodiment can be applied to servers such as local servers and cloud servers with data processing functions, and the server can be deployed in a One electronic device or a device cluster composed of multiple electronic devices.
如图5所示,该装置可以包括:数量确定模块110、请求确定模块120、第一处理模块130以及第二处理模块140,其中:As shown in Figure 5, the device may include: a quantity determination module 110, a request determination module 120, a first processing module 130 and a second processing module 140, wherein:
数量确定模块110,用于确定当前时刻之前预设时间段内接收到设备连接请求的总数量;The quantity determination module 110 is used to determine the total number of device connection requests received within a preset time period before the current time;
请求确定模块120,用于响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求;The request determination module 120 is configured to determine the currently pending request from the total number of device connection requests in response to detecting that the total number meets the set condition;
第一处理模块130,用于基于第一预设方式对所述当前待处理请求进行处理;The first processing module 130 is configured to process the currently pending request based on a first preset method;
第二处理模块140,用于基于第二预设方式对当前剩余请求进行处理,所述当前待处理请求的第一数量与所述当前剩余请求的第二数量之和为所述总数量,所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求。The second processing module 140 is configured to process the current remaining requests based on a second preset method. The sum of the first number of currently pending requests and the second number of current remaining requests is the total number, so The processing speed of the second preset method is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending messages to the The server then sends a device connection request.
由上述描述可知,本实施例的装置通过确定当前时刻之前预设时间段内接收到设备连接请求的总数量,并响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求,进而基于第一预设方式对所述当前待处理请求进行处理,以及基于第二预设方式对当前剩余请求进行处理,由于所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求,因而可以迅速减少设备连接请求的并发量,使服务端能够分批地处理接收到的设备连接请求,实现对并发请求量飙升情况的平缓性处理,相比于相关技术中采取限流或者服务器扩容等措施来缓解服务端的压力的方式,本公开可以降低对设备端的影响,且可以避免提升服务器的硬件成本。As can be seen from the above description, the device of this embodiment determines the total number of device connection requests received within the preset time period before the current moment, and responds to detecting that the total number meets the set condition, from the total number of devices The current pending request is determined in the connection request, and then the current pending request is processed based on the first preset method, and the current remaining requests are processed based on the second preset method. Due to the processing of the second preset method The speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server, Therefore, the concurrent amount of device connection requests can be quickly reduced, allowing the server to process the received device connection requests in batches, and smoothly handle the surge in concurrent requests. Compared with current limiting or server expansion in related technologies, By taking other measures to alleviate the pressure on the server side, the present disclosure can reduce the impact on the device side and avoid increasing the hardware cost of the server.
图6是根据本公开一示例性实施例示出的又一种请求处理装置的框图;本实施例的装置可以应用于具有数据处理功能的本地服务器和云服务器等服务端,该服务端可以部署在一台电子设备或多台电子设备组成的设备集群中。其中,数量确定模块210、 请求确定模块220、第一处理模块230以及第二处理模块240与前述图5所示实施例中的数量确定模块110、请求确定模块120、第一处理模块130以及第二处理模块140的功能相同,在此不进行赘述。Figure 6 is a block diagram of another request processing device according to an exemplary embodiment of the present disclosure; the device of this embodiment can be applied to servers such as local servers and cloud servers with data processing functions, and the server can be deployed on One electronic device or a device cluster composed of multiple electronic devices. Among them, the quantity determination module 210, the request determination module 220, the first processing module 230 and the second processing module 240 are the same as the quantity determination module 110, the request determination module 120, the first processing module 130 and the third processing module in the embodiment shown in Figure 5. The functions of the two processing modules 140 are the same and will not be described again here.
本实施例中,所述设备连接请求的总数量满足设定条件,可以包括以下至少一项:In this embodiment, the total number of device connection requests meets the set conditions, which may include at least one of the following:
所述设备连接请求的总数量大于或等于设定数量阈值,且大于或等于所述设定数量阈值的持续时间超过第一设定时间阈值;The total number of device connection requests is greater than or equal to the set quantity threshold, and the duration greater than or equal to the set quantity threshold exceeds the first set time threshold;
所述设备连接请求的总数量大于或等于所述预设时间段内所述服务端能够处理的设备连接请求的目标数量,且大于或等于所述目标数量的持续时间超过第二设定时间阈值。The total number of device connection requests is greater than or equal to the target number of device connection requests that the server can handle within the preset time period, and the duration that is greater than or equal to the target number exceeds the second set time threshold .
在一些实施例中,请求确定模块220,可以包括:In some embodiments, the request determination module 220 may include:
目标数量确定单元221,用于基于所述服务端的中央处理器CPU的当前负载大小,确定当前时间段内所述服务端能够处理的设备连接请求的目标数量;The target number determination unit 221 is configured to determine the target number of device connection requests that the server can process within the current time period based on the current load size of the central processing unit CPU of the server;
第一数量确定单元222,用于基于所述目标数量确定所述第一数量,所述第一数量小于或等于所述目标数量;The first quantity determining unit 222 is configured to determine the first quantity based on the target quantity, where the first quantity is less than or equal to the target quantity;
第一请求确定单元223,用于基于预设规则从所述总数量中确定所述第一数量的设备连接请求。The first request determining unit 223 is configured to determine the first number of device connection requests from the total number based on preset rules.
在一些实施例中,第一处理模块230,可以包括:In some embodiments, the first processing module 230 may include:
信息获取单元231,用于获取所述当前待处理请求的第一发送设备的鉴权信息; Information acquisition unit 231, configured to acquire the authentication information of the first sending device of the currently pending request;
连接鉴权单元232,用于基于所述鉴权信息对所述第一发送设备进行连接鉴权;The connection authentication unit 232 is configured to perform connection authentication on the first sending device based on the authentication information;
第一发送单元233,用于响应于连接鉴权通过,向所述第一发送设备发送第一预设信息,所述第一预设信息用于表征所述第一发送设备与所述服务端已成功建立连接。The first sending unit 233 is configured to send first preset information to the first sending device in response to the connection authentication being passed. The first preset information is used to characterize the first sending device and the server. Connection established successfully.
在一些实施例中,第二处理模块240还可以用于向所述当前剩余请求的第二发送设备发送第二预设信息,所述第二预设信息用于表征所述第二发送设备与所述服务端已成功建立连接。In some embodiments, the second processing module 240 may also be configured to send second preset information to the second sending device of the current remaining request, where the second preset information is used to characterize the relationship between the second sending device and the current remaining request. The server has successfully established a connection.
在一些实施例中,上述装置还可以包括过程重复执行模块250;In some embodiments, the above-mentioned apparatus may further include a process repeat execution module 250;
过程重复执行模块250可以用于重复执行以下过程,直至未经过所述第一预设方式处理的当前剩余请求的数量变为0:The process repeat execution module 250 may be configured to repeatedly execute the following process until the number of current remaining requests that have not been processed in the first preset manner becomes 0:
响应于完成基于所述第一预设方式对当前待处理请求的处理,从当前剩余请求中再次确定待处理请求;In response to completing the processing of the currently pending request based on the first preset manner, determining the pending request again from the current remaining requests;
基于所述第一预设方式对当前待处理请求进行处理。Process the currently pending request based on the first preset method.
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the devices in the above embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method, and will not be described in detail here.
图7是根据一示例性实施例示出的一种服务器的框图。例如,设备900可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。Figure 7 is a block diagram of a server according to an exemplary embodiment. For example, the device 900 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
参照图7,设备900可以包括以下一个或多个组件:处理组件902,存储器904,电源组件906,多媒体组件908,音频组件910,输入/输出(I/O)的接口912,传感器组件914,以及通信组件916。Referring to Figure 7, device 900 may include one or more of the following components: a processing component 902, a memory 904, a power supply component 906, a multimedia component 908, an audio component 910, an input/output (I/O) interface 912, a sensor component 914, and communications component 916.
处理组件902通常控制设备900的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件902可以包括一个或多个处理器920来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件902可以包括一个或多个模块,便于处理组件902和其他组件之间的交互。例如,处理组件902可以包括多媒体模块,以方便多媒体组件908和处理组件902之间的交互。 Processing component 902 generally controls the overall operations of device 900, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 902 may include one or more processors 920 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 902 may include one or more modules that facilitate interaction between processing component 902 and other components. For example, processing component 902 may include a multimedia module to facilitate interaction between multimedia component 908 and processing component 902.
存储器904被配置为存储各种类型的数据以支持在设备900的操作。这些数据的示例包括用于在设备900上操作的任何应用程序或方法的指令,联系人数据,电话簿 数据,消息,图片,视频等。存储器904可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。 Memory 904 is configured to store various types of data to support operations at device 900 . Examples of such data include instructions for any application or method operating on device 900, contact data, phonebook data, messages, pictures, videos, etc. Memory 904 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
电源组件906为设备900的各种组件提供电力。电源组件906可以包括电源管理系统,一个或多个电源,及其他与为设备900生成、管理和分配电力相关联的组件。 Power supply component 906 provides power to the various components of device 900 . Power supply components 906 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 900 .
多媒体组件908包括在所述设备900和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件908包括一个前置摄像头和/或后置摄像头。当设备900处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。 Multimedia component 908 includes a screen that provides an output interface between the device 900 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide action. In some embodiments, multimedia component 908 includes a front-facing camera and/or a rear-facing camera. When the device 900 is in an operating mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each front-facing camera and rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
音频组件910被配置为输出和/或输入音频信号。例如,音频组件910包括一个麦克风(MIC),当设备900处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器904或经由通信组件916发送。在一些实施例中,音频组件910还包括一个扬声器,用于输出音频信号。 Audio component 910 is configured to output and/or input audio signals. For example, audio component 910 includes a microphone (MIC) configured to receive external audio signals when device 900 is in operating modes, such as call mode, recording mode, and speech recognition mode. The received audio signals may be further stored in memory 904 or sent via communications component 916 . In some embodiments, audio component 910 also includes a speaker for outputting audio signals.
I/O接口912为处理组件902和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 912 provides an interface between the processing component 902 and a peripheral interface module, which may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
传感器组件914包括一个或多个传感器,用于为设备900提供各个方面的状态评估。例如,传感器组件914可以检测到设备900的打开/关闭状态,组件的相对定位,例如所述组件为设备900的显示器和小键盘,传感器组件914还可以检测设备900或设备900一个组件的位置改变,用户与设备900接触的存在或不存在,设备900方位或加速/减速和设备900的温度变化。传感器组件914还可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件914还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件914还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。 Sensor component 914 includes one or more sensors that provide various aspects of status assessment for device 900 . For example, the sensor component 914 can detect the open/closed state of the device 900, the relative positioning of components, such as the display and keypad of the device 900, and the sensor component 914 can also detect a change in position of the device 900 or a component of the device 900. , the presence or absence of user contact with device 900 , device 900 orientation or acceleration/deceleration and temperature changes of device 900 . Sensor assembly 914 may also include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 914 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 914 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
通信组件916被配置为便于设备900和其他设备之间有线或无线方式的通信。设备900可以接入基于通信标准的无线网络,如WiFi,2G或3G,4G或5G或它们的组合。在一个示例性实施例中,通信组件916经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件916还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。 Communication component 916 is configured to facilitate wired or wireless communications between device 900 and other devices. The device 900 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G or 5G, or a combination thereof. In one exemplary embodiment, the communication component 916 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communications component 916 also includes a near field communications (NFC) module to facilitate short-range communications. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
在示例性实施例中,设备900可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子组件实现,用于执行上述方法。In an exemplary embodiment, device 900 may be configured by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the above method.
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器904,上述指令可由设备900的处理器920执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as a memory 904 including instructions, which are executable by the processor 920 of the device 900 to complete the above method is also provided. For example, the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
本领域技术人员在考虑说明书及实践这里公开的公开后,将容易想到本公开的其它实施方案。本公开旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。Other embodiments of the disclosure will be readily apparent to those skilled in the art from consideration of the specification and practice of the disclosure herein. The present disclosure is intended to cover any variations, uses, or adaptations of the disclosure that follow the general principles of the disclosure and include common common sense or customary technical means in the technical field that are not disclosed in the disclosure. . It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限制。It is to be understood that the present disclosure is not limited to the precise structures described above and illustrated in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the disclosure is limited only by the appended claims.

Claims (14)

  1. 一种请求处理方法,其特征在于,应用于服务端,所述方法包括:A request processing method, characterized in that it is applied to the server, and the method includes:
    确定当前时刻之前预设时间段内接收到设备连接请求的总数量;Determine the total number of device connection requests received within the preset time period before the current moment;
    响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求;In response to detecting that the total number satisfies the set condition, determining a current pending request from the total number of device connection requests;
    基于第一预设方式对所述当前待处理请求进行处理;Process the currently pending request based on the first preset method;
    基于第二预设方式对当前剩余请求进行处理,所述当前待处理请求的第一数量与所述当前剩余请求的第二数量之和为所述总数量,所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求。The current remaining requests are processed based on the second preset method. The sum of the first number of the current pending requests and the second number of the current remaining requests is the total number. The processing of the second preset method The speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server.
  2. 根据权利要求1所述的方法,其特征在于,所述设备连接请求的总数量满足设定条件,包括以下至少一项:The method according to claim 1, characterized in that the total number of device connection requests meets set conditions, including at least one of the following:
    所述设备连接请求的总数量大于或等于设定数量阈值,且大于或等于所述设定数量阈值的持续时间超过第一设定时间阈值;The total number of device connection requests is greater than or equal to the set quantity threshold, and the duration greater than or equal to the set quantity threshold exceeds the first set time threshold;
    所述设备连接请求的总数量大于或等于所述预设时间段内所述服务端能够处理的设备连接请求的目标数量,且大于或等于所述目标数量的持续时间超过第二设定时间阈值。The total number of device connection requests is greater than or equal to the target number of device connection requests that the server can handle within the preset time period, and the duration that is greater than or equal to the target number exceeds the second set time threshold .
  3. 根据权利要求1所述的方法,其特征在于,所述从所述总数量的设备连接请求中确定当前待处理请求,包括:The method of claim 1, wherein determining the current pending requests from the total number of device connection requests includes:
    基于所述服务端的中央处理器CPU的当前负载大小,确定当前时间段内所述服务端能够处理的设备连接请求的目标数量;Based on the current load size of the central processing unit CPU of the server, determine the target number of device connection requests that the server can handle within the current time period;
    基于所述目标数量确定所述第一数量,所述第一数量小于或等于所述目标数量;determining the first quantity based on the target quantity, the first quantity being less than or equal to the target quantity;
    基于预设规则从所述总数量中确定所述第一数量的设备连接请求。The first number of device connection requests is determined from the total number based on a preset rule.
  4. 根据权利要求1所述的方法,其特征在于,所述基于第一预设方式对所述当前待处理请求进行处理,包括:The method of claim 1, wherein processing the currently pending request based on a first preset method includes:
    获取所述当前待处理请求的第一发送设备的鉴权信息;Obtain the authentication information of the first sending device of the currently pending request;
    基于所述鉴权信息对所述第一发送设备进行连接鉴权;Perform connection authentication on the first sending device based on the authentication information;
    响应于连接鉴权通过,向所述第一发送设备发送第一预设信息,所述第一预设信息用于表征所述第一发送设备与所述服务端已成功建立连接。In response to the connection authentication passing, first preset information is sent to the first sending device, where the first preset information is used to represent that the first sending device and the server have successfully established a connection.
  5. 根据权利要求1所述的方法,其特征在于,所述基于第二预设方式对所述总数量中剩余的当前剩余请求进行处理,包括:The method of claim 1, wherein processing the remaining current remaining requests in the total number based on a second preset method includes:
    向所述当前剩余请求的第二发送设备发送第二预设信息,所述第二预设信息用于表征所述第二发送设备与所述服务端已成功建立连接。Send second preset information to the second sending device of the current remaining request, where the second preset information is used to indicate that the connection between the second sending device and the server has been successfully established.
  6. 根据权利要求1述的方法,其特征在于,所述方法还包括重复执行以下过程,直至未经过所述第一预设方式处理的当前剩余请求的数量变为0:The method according to claim 1, characterized in that the method further includes repeatedly executing the following process until the number of current remaining requests that have not been processed in the first preset manner becomes 0:
    响应于完成基于所述第一预设方式对当前待处理请求的处理,从当前剩余请求中再次确定待处理请求;In response to completing the processing of the currently pending request based on the first preset manner, determining the pending request again from the current remaining requests;
    基于所述第一预设方式对当前待处理请求进行处理。Process the currently pending request based on the first preset method.
  7. 一种请求处理装置,其特征在于,应用于服务端,所述装置包括:A request processing device, characterized in that it is applied to the server, and the device includes:
    数量确定模块,用于确定当前时刻之前预设时间段内接收到设备连接请求的总数量;The quantity determination module is used to determine the total number of device connection requests received within the preset time period before the current moment;
    请求确定模块,用于响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求;A request determination module, configured to determine the current pending request from the total number of device connection requests in response to detecting that the total number meets the set condition;
    第一处理模块,用于基于第一预设方式对所述当前待处理请求进行处理;A first processing module, configured to process the currently pending request based on a first preset method;
    第二处理模块,用于基于第二预设方式对当前剩余请求进行处理,所述当前待处理请求的第一数量与所述当前剩余请求的第二数量之和为所述总数量,所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求。The second processing module is configured to process the current remaining requests based on the second preset method. The sum of the first number of the current pending requests and the second number of the current remaining requests is the total number. The processing speed of the second preset method is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending messages to the service. The client then sends a device connection request.
  8. 根据权利要求7所述的装置,其特征在于,所述设备连接请求的总数量满足设定条件,包括以下至少一项:The device according to claim 7, characterized in that the total number of device connection requests meets set conditions, including at least one of the following:
    所述设备连接请求的总数量大于或等于设定数量阈值,且大于或等于所述设定数量阈值的持续时间超过第一设定时间阈值;The total number of device connection requests is greater than or equal to the set quantity threshold, and the duration greater than or equal to the set quantity threshold exceeds the first set time threshold;
    所述设备连接请求的总数量大于或等于所述预设时间段内所述服务端能够处理的设备连接请求的目标数量,且大于或等于所述目标数量的持续时间超过第二设定时间阈值。The total number of device connection requests is greater than or equal to the target number of device connection requests that the server can handle within the preset time period, and the duration that is greater than or equal to the target number exceeds the second set time threshold .
  9. 根据权利要求7所述的装置,其特征在于,所述请求确定模块,包括:The device according to claim 7, characterized in that the request determination module includes:
    目标数量确定单元,用于基于所述服务端的中央处理器CPU的当前负载大小,确定当前时间段内所述服务端能够处理的设备连接请求的目标数量;A target number determination unit configured to determine the target number of device connection requests that the server can handle within the current time period based on the current load size of the central processing unit CPU of the server;
    第一数量确定单元,用于基于所述目标数量确定所述第一数量,所述第一数量小于或等于所述目标数量;A first quantity determining unit configured to determine the first quantity based on the target quantity, where the first quantity is less than or equal to the target quantity;
    第一请求确定单元,用于基于预设规则从所述总数量中确定所述第一数量的设备连接请求。A first request determining unit configured to determine the first number of device connection requests from the total number based on a preset rule.
  10. 根据权利要求7所述的装置,其特征在于,所述第一处理模块,包括:The device according to claim 7, characterized in that the first processing module includes:
    信息获取单元,用于获取所述当前待处理请求的第一发送设备的鉴权信息;An information acquisition unit, configured to acquire the authentication information of the first sending device of the currently pending request;
    连接鉴权单元,用于基于所述鉴权信息对所述第一发送设备进行连接鉴权;A connection authentication unit, configured to perform connection authentication on the first sending device based on the authentication information;
    第一发送单元,用于响应于连接鉴权通过,向所述第一发送设备发送第一预设信息,所述第一预设信息用于表征所述第一发送设备与所述服务端已成功建立连接。A first sending unit, configured to send first preset information to the first sending device in response to the connection authentication being passed, where the first preset information is used to represent that the first sending device and the server have Connection established successfully.
  11. 根据权利要求7所述的装置,其特征在于,所述第二处理模块还用于向所述当前剩余请求的第二发送设备发送第二预设信息,所述第二预设信息用于表征所述第二发送设备与所述服务端已成功建立连接。The apparatus according to claim 7, wherein the second processing module is further configured to send second preset information to the second sending device of the current remaining request, and the second preset information is used to characterize The second sending device and the server have successfully established a connection.
  12. 根据权利要求7述的装置,其特征在于,所述装置还包括过程重复执行模块;The device according to claim 7, characterized in that the device further includes a process repeat execution module;
    所述过程重复执行模块用于重复执行以下过程,直至未经过所述第一预设方式处理的当前剩余请求的数量变为0:The process repeat execution module is used to repeatedly execute the following process until the number of current remaining requests that have not been processed in the first preset manner becomes 0:
    响应于完成基于所述第一预设方式对当前待处理请求的处理,从当前剩余请求中再次确定待处理请求;In response to completing the processing of the currently pending request based on the first preset manner, determining the pending request again from the current remaining requests;
    基于所述第一预设方式对当前待处理请求进行处理。Process the currently pending request based on the first preset method.
  13. 一种服务端,其特征在于,所述服务端包括:A server, characterized in that the server includes:
    处理器以及用于存储计算机程序的存储器;Processor and memory for storing computer programs;
    其中,所述处理器被配置为在执行所述计算机程序时,实现:Wherein, the processor is configured to, when executing the computer program, implement:
    确定当前时刻之前预设时间段内接收到设备连接请求的总数量;Determine the total number of device connection requests received within the preset time period before the current moment;
    响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前 待处理请求;In response to detecting that the total number meets the set condition, determining the current pending request from the total number of device connection requests;
    基于第一预设方式对所述当前待处理请求进行处理;Process the currently pending request based on the first preset method;
    基于第二预设方式对当前剩余请求进行处理,所述当前待处理请求的第一数量与所述当前剩余请求的第二数量之和为所述总数量,所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向所述服务端再发送设备连接请求。The current remaining requests are processed based on the second preset method. The sum of the first number of the current pending requests and the second number of the current remaining requests is the total number. The processing of the second preset method The speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server.
  14. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现:A computer-readable storage medium on which a computer program is stored, characterized in that, when executed by a processor, the program implements:
    确定当前时刻之前预设时间段内接收到设备连接请求的总数量;Determine the total number of device connection requests received within the preset time period before the current moment;
    响应于检测到所述总数量满足设定条件,从所述总数量的设备连接请求中确定当前待处理请求;In response to detecting that the total number satisfies the set condition, determining a current pending request from the total number of device connection requests;
    基于第一预设方式对所述当前待处理请求进行处理;Process the currently pending request based on the first preset method;
    基于第二预设方式对当前剩余请求进行处理,所述当前待处理请求的第一数量与所述当前剩余请求的第二数量之和为所述总数量,所述第二预设方式的处理速度高于所述第一预设方式的处理速度,且经过所述第二预设方式的处理后,所述当前剩余请求的第二发送设备将停止向服务端再发送设备连接请求。The current remaining requests are processed based on the second preset method. The sum of the first number of the current pending requests and the second number of the current remaining requests is the total number. The processing of the second preset method The speed is higher than the processing speed of the first preset method, and after processing in the second preset method, the second sending device of the current remaining requests will stop sending device connection requests to the server.
PCT/CN2022/099017 2022-06-15 2022-06-15 Request processing method and apparatus, server, and storage medium WO2023240506A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2022/099017 WO2023240506A1 (en) 2022-06-15 2022-06-15 Request processing method and apparatus, server, and storage medium
CN202280004482.0A CN117716736A (en) 2022-06-15 2022-06-15 Request processing method, device, server side and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/099017 WO2023240506A1 (en) 2022-06-15 2022-06-15 Request processing method and apparatus, server, and storage medium

Publications (1)

Publication Number Publication Date
WO2023240506A1 true WO2023240506A1 (en) 2023-12-21

Family

ID=89192746

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/099017 WO2023240506A1 (en) 2022-06-15 2022-06-15 Request processing method and apparatus, server, and storage medium

Country Status (2)

Country Link
CN (1) CN117716736A (en)
WO (1) WO2023240506A1 (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100153659A1 (en) * 2008-12-17 2010-06-17 Hewlett-Packard Development Company, L.P. Servicing memory read requests
CN106385459A (en) * 2016-10-20 2017-02-08 杭州迪普科技有限公司 Method and device for distributing connection request message
CN107635267A (en) * 2017-08-31 2018-01-26 努比亚技术有限公司 A kind of method, apparatus, base station and computer-readable recording medium for establishing connection
CN109062706A (en) * 2018-06-29 2018-12-21 Oppo(重庆)智能科技有限公司 The method that is communicated between electronic device and its limiting process, storage medium
CN110380982A (en) * 2019-07-31 2019-10-25 浪潮商用机器有限公司 A kind of flow control methods and relevant apparatus
CN113765998A (en) * 2021-07-12 2021-12-07 北京沃东天骏信息技术有限公司 Access limiting method and device based on cluster system and server
CN114465959A (en) * 2021-12-24 2022-05-10 南京苏宁电子信息技术有限公司 Interface dynamic flow control method and device, computer equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100153659A1 (en) * 2008-12-17 2010-06-17 Hewlett-Packard Development Company, L.P. Servicing memory read requests
CN106385459A (en) * 2016-10-20 2017-02-08 杭州迪普科技有限公司 Method and device for distributing connection request message
CN107635267A (en) * 2017-08-31 2018-01-26 努比亚技术有限公司 A kind of method, apparatus, base station and computer-readable recording medium for establishing connection
CN109062706A (en) * 2018-06-29 2018-12-21 Oppo(重庆)智能科技有限公司 The method that is communicated between electronic device and its limiting process, storage medium
CN110380982A (en) * 2019-07-31 2019-10-25 浪潮商用机器有限公司 A kind of flow control methods and relevant apparatus
CN113765998A (en) * 2021-07-12 2021-12-07 北京沃东天骏信息技术有限公司 Access limiting method and device based on cluster system and server
CN114465959A (en) * 2021-12-24 2022-05-10 南京苏宁电子信息技术有限公司 Interface dynamic flow control method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN117716736A (en) 2024-03-15

Similar Documents

Publication Publication Date Title
RU2643473C2 (en) Method and tools for fingerprinting identification
US20170163626A1 (en) Method and device for network access of a smart terminal device
US10608988B2 (en) Method and apparatus for bluetooth-based identity recognition
EP3076716A1 (en) Method and apparatus for network access
RU2655971C2 (en) Method, device for implementation of terminal device access to wireless network
EP3163834B1 (en) Method and device for equipment control
WO2017156960A1 (en) Method and device for accessing smart camera
RU2628478C2 (en) Method and device for network access
CN108811179B (en) Wireless network connection method, device and storage medium
US20170223493A1 (en) Method, apparatus, and storage medium for acquiring terminal information
EP3382527B1 (en) Method and apparatus for managing a shared storage system
CN107888965B (en) Image gift display method and device, terminal, system and storage medium
US20160314292A1 (en) Security verification method and apparatus
CN109039860B (en) Method and device for sending and displaying message and method and device for identity authentication
JP6126755B2 (en) Terminal verification method, apparatus, program, and recording medium
CN107959757B (en) User information processing method and device, APP server and terminal equipment
CN106302528B (en) Short message processing method and device
CN106375350B (en) Flashing verification method and device
CN110008668B (en) Data processing method, device and storage medium
CN109885360B (en) Data processing method, device and storage medium
US9674768B2 (en) Method and device for accessing wireless network
WO2023240506A1 (en) Request processing method and apparatus, server, and storage medium
US10091236B2 (en) Methods apparatuses, and storage mediums for acquiring legitimate installation packages
CN111723353A (en) Identity authentication method, device, terminal and storage medium based on face recognition
CN106060104B (en) Application management method and device

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 202280004482.0

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22946200

Country of ref document: EP

Kind code of ref document: A1