CN114866556B - Server resource request method and device, electronic equipment and storage medium - Google Patents

Server resource request method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114866556B
CN114866556B CN202210579176.1A CN202210579176A CN114866556B CN 114866556 B CN114866556 B CN 114866556B CN 202210579176 A CN202210579176 A CN 202210579176A CN 114866556 B CN114866556 B CN 114866556B
Authority
CN
China
Prior art keywords
server
main server
time period
resource request
returned
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210579176.1A
Other languages
Chinese (zh)
Other versions
CN114866556A (en
Inventor
曹敏隆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Zhongyuan Network Co ltd
Original Assignee
Shanghai Zhongyuan Network Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Zhongyuan Network Co ltd filed Critical Shanghai Zhongyuan Network Co ltd
Priority to CN202210579176.1A priority Critical patent/CN114866556B/en
Publication of CN114866556A publication Critical patent/CN114866556A/en
Application granted granted Critical
Publication of CN114866556B publication Critical patent/CN114866556B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/21Flow control; Congestion control using leaky-bucket
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/215Flow control; Congestion control using token-bucket
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The application relates to a server resource request method, a device, electronic equipment and a storage medium, wherein the server resource request method comprises the following steps: recording the number of task requests received in a current time period, generating target resource requests according to the number of task requests received in the current time period after the current time period is finished, and sending the target resource requests to a main server; and receiving the resources returned by the main server according to the target resource request, responding to the task requests received in the current time period by utilizing the resources returned by the main server, and carrying out resource requests in batches according to the number of the tasks received in the current time period by gathering the task requests received in the current time period, thereby reducing the interaction times between a server and the main server, improving the number of inquiry requests per second, improving the efficiency of the resource requests, further saving the communication resources of the system and improving the user experience.

Description

Server resource request method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for requesting server resources, an electronic device, and a storage medium.
Background
With the development of the internet, various novel multimedia services, such as Video telephony, video-On-Demand (VOD), high-definition digital television, internet of things and the like, are continuously emerging, and the number of broadband users is continuously and steadily increasing, meanwhile, the broadband users send resource requests to a server through a server, and if the server receives multiple task requests in unit time, the server needs to communicate with the server for multiple times, so that the communication resource requirements between the server and the server are large, and the performance of the server is affected.
Disclosure of Invention
The application provides a server resource request method, a device, electronic equipment and a storage medium, which are used for solving the problems that in the related technology, a server interacts with a server for many times in unit time, so that the communication resource requirement between the server and the server is large, and the performance of the server is influenced.
In a first aspect, the present application provides a server resource request method, where the server resource request method includes: recording the number of task requests received in a current time period, generating target resource requests according to the number of task requests received in the current time period after the current time period is finished, and sending the target resource requests to a main server; and receiving the resources returned by the main server according to the target resource request, and responding to the task request received in the current time period by utilizing the resources returned by the main service.
Optionally, before sending the target resource request to the primary server, the method further includes: the sequential nodes established by a plurality of servers under the selected main catalog are obtained, wherein the sequential nodes comprise a plurality of sequentially arranged nodes, and each node corresponds to one server; and taking the server corresponding to the first node in the sequence nodes as the main server.
Optionally, after the server corresponding to the first node in the sequence nodes is used as the main server, the method further includes: when a server corresponding to a first node in the sequence nodes fails, updating the sequence nodes to remove the first node corresponding to the failed server in the sequence nodes; and after updating the sequence node, taking the server corresponding to the first node in the updated sequence node as the main server.
Optionally, sending the target resource request to the primary server includes: the target resource request is sent to the main server through an asynchronous network, so that when the main server receives the target resource request, the current supported returned resources are obtained through a preset current limiting mode, and the current supported returned resources are returned to a server; the preset current limiting mode is as follows: one of token bucket current limiting mode and leaky bucket current limiting mode.
Optionally, receiving the resource returned by the main server according to the target resource request, and responding to the task request received in the current time period by using the resource returned by the main service, including: receiving a resource returned by the main server according to the target resource request; and when the resources returned by the main server correspond to the target resource requests, responding to all task requests received in the current time period.
Optionally, receiving the resource returned by the main server according to the target resource request, and responding to the task request received in the current time period by using the resource returned by the main service, including: receiving a resource returned by the main server according to the target resource request; and rejecting all task requests received in the current time period when the resources returned by the main server are empty.
Optionally, receiving the resource returned by the main server according to the target resource request, and responding to the task request received in the current time period by using the resource returned by the main service, including: receiving a resource returned by the main server according to the target resource request; and when the resources returned by the main server are lower than the resources corresponding to the target resource requests, determining the task requests which can be responded by the resources returned by the main server, and responding to the task requests which can be responded by the resources returned by the main server.
In a second aspect, the present application provides a server resource request device, including: the recording module is used for recording the number of task requests received in a current time period, generating target resource requests according to the number of task requests received in the current time period after the current time period is finished, and sending the target resource requests to the main server, wherein the main server is determined by the sequence nodes established under the selected main catalog; and the receiving module is used for receiving the resources returned by the main server according to the target resource request and responding to the task request received in the current time period by utilizing the resources returned by the main server.
In a third aspect, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
A memory for storing a computer program;
and a processor, configured to implement the steps of the server resource request method according to any one of the embodiments of the first aspect when executing the program stored in the memory.
In a fourth aspect, a computer readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the server resource request method according to any of the embodiments of the first aspect.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
According to the method provided by the embodiment of the application, the number of the task requests received in the current time period is recorded, and after the current time period is finished, a target resource request is generated according to the number of the task requests received in the current time period, and the target resource request is sent to a main server; and receiving the resources returned by the main server according to the target resource request, responding to the task requests received in the current time period by utilizing the resources returned by the main server, and carrying out resource requests in batches according to the number of the tasks received in the current time period by gathering the task requests received in the current time period, thereby reducing the interaction times between the server and the main server, improving the efficiency of the resource requests, further saving the communication resources between the server and the server, and improving the user experience.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a schematic flow chart of an alternative server resource request method according to an embodiment of the present application;
FIG. 2 is a flowchart of yet another alternative server resource request method according to an embodiment of the present application;
fig. 3 is a schematic basic structure diagram of an alternative server resource request device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the invention.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
The implementation details of the technical scheme of the embodiment of the invention are described in detail below:
Fig. 1 is a flow chart of a server resource request method according to an embodiment of the present application, as shown in fig. 1, where the server resource request method includes:
s101, recording the number of task requests received in a current time period, generating target resource requests according to the number of task requests received in the current time period after the current time period is finished, and sending the target resource requests to a main server;
s102, receiving the resources returned by the main server according to the target resource request, and responding to the task request received in the current time period by utilizing the resources returned by the main server.
It should be understood that the server resource request method provided in this example is applied to a server, which is provided on a terminal, where the terminal may be implemented in various forms. For example, the terminal described in the present invention may include a mobile terminal such as a mobile phone, a tablet computer, a notebook computer, a palm computer, a Personal digital assistant (Personal DIGITAL ASSISTANT, PDA), a Portable media player (Portable MEDIA PLAYER, PMP), a navigation device, a wearable device, a smart bracelet, a pedometer, and a fixed terminal such as a digital TV, a desktop computer, a workstation, and the like, and the description is given below taking a service side set in the workstation as an example.
It can be understood that, the main server is determined according to the sequence node established under the selected main directory, and will be described in detail later, which is not described herein; the time period is a period duration set by related personnel according to actual use requirements, and the unit of the period duration can be a unit of seconds, milliseconds, and the like, for example, 10 seconds is taken as a time period, namely, the time period is 10 seconds, the number of task requests received in 10 seconds at present is recorded, then when the time period is finished, a target resource request is generated according to the number of task requests received in 10 seconds and is sent to a main server, and when the time period of the last 10 seconds is finished, the time period of the next 10 seconds is started immediately; it should be appreciated that the duration of the time period may be a fixed duration, and in addition, the duration of the time period may vary with external conditions, and in particular, in some examples, the duration of the time period varies with time period, e.g., a day divided into 24 hours, with 12 hours having a duration of 10s and another 12 hours having a duration of 20s; in some examples, the duration of the time period varies with the number of task requests received per unit time, e.g., the time period is in seconds, if the number of task requests received per second exceeds a set number, the duration of the time period is set to 10s, otherwise the duration of the time period is set to 20s.
The server resource request method provided by the embodiment is used for recording the number of task requests received in the current time period, generating target resource requests according to the number of task requests received in the current time period after the current time period is finished, and sending the target resource requests to a main server; and receiving the resources returned by the main server according to the target resource requests, and responding to the task requests received in the current time period by utilizing the resources returned by the main server, so that even if N task requests are received in the current time period, only one target resource request is generated for the N task requests, and the resources corresponding to the N task requests are requested to the server through one target resource request, thereby avoiding the problem that when the N task requests are met, the N resource requests are sent to the server, and the problem of frequent communication with the server is caused, and further saving the communication resources of the system.
In some examples of this embodiment, before sending the target resource request to the primary server, the method further comprises: the sequential nodes established by a plurality of servers under the selected main catalog are obtained, wherein the sequential nodes comprise a plurality of sequentially arranged nodes, and each node corresponds to one server; and taking the server corresponding to the first node in the sequence nodes as the main server. It should be appreciated that the plurality of servers, prior to establishing the sequence node under the master catalog, the method further comprises: a plurality of servers establish a selection master catalog; wherein the plurality of servers are capable of creating a master catalog through a distributed coordination service, including but not limited to: zooKeeper; after the master catalog is established, a sequence node is established for the master catalog, and then the master server is determined.
For example, a plurality of servers establish a master catalog through a ZooKeeper, and then establish sequence nodes to the master catalog established by the ZooKeeper; the node that the ZooKeeper can establish comprises: persistent node (PERSISTENT), persistent sequence node (PERSISTENT _sequence), temporary node (EPHEMERAL), temporary sequence node (EPHEMERAL _sequence), the characteristics of each node are as follows:
Persistent node (PERSISTENT): after the node is established, the node always exists on the Zookeeper server until the deleting operation actively deletes the node;
Persistent sequence node (PERSISTENT _sequence): the basic characteristics are consistent with those of the persistent nodes, and the additional characteristics are that the Zookeeper records the creation sequence of the child nodes;
Temporary node (EPHEMERAL): the declaration period is bound with the session of the server, and the node is automatically cleared when the session of the server fails;
Temporary sequence node (EPHEMERAL _sequence): the basic characteristics are consistent with the temporary nodes, but sequential characteristics are added;
that is, the set-up sequence node for the master catalog set up to the ZooKeeper is: establishing a persistent sequence node to a master catalog established by the ZooKeeper or establishing a temporary sequence node to the master catalog established by the ZooKeeper; it may be appreciated that, where the sequence node is used to determine the primary server, that is, the sequence node is the primary selection data, in some examples, a persistent sequence node is established for the primary selection directory established by the ZooKeeper, so that the primary selection data of the primary server (when the primary selection data is the persistent sequence node) can be stored each time is determined, so that subsequent related personnel can conveniently adjust each server according to the primary selection data; in some examples, when the temporary sequence node is established to the master selection directory established by the ZooKeeper, the previous master selection data (the master selection data is the temporary data node at this time) can be deleted when the temporary sequence node is updated, so that the beneficial effect of saving the system storage resources is achieved.
In some examples of this embodiment, after the server corresponding to the first node in the sequence node is used as the main server, the method further includes: when a server corresponding to a first node in the sequence nodes fails, updating the sequence nodes to remove the first node corresponding to the failed server in the sequence nodes; and after updating the sequence node, taking the server corresponding to the first node in the updated sequence node as the main server. It can be understood that the server only requests resources to the main server, so when the server corresponding to the first node fails (i.e. when the current main server fails), the sequential nodes need to be updated so as to determine a new main server, thereby ensuring high availability of the server;
specifically, after the main server is down, the plurality of servers re-establish sequence nodes to the main selection directory, the server re-acquires a first node in the sequence nodes under the main selection directory, takes the server corresponding to the re-determined first node as the main server, and sends a subsequent resource request to the re-determined main server.
In some examples of this embodiment, sending the target resource request to the primary server includes: the target resource request is sent to the main server through an asynchronous network, so that when the main server receives the target resource request, the current supported returned resources are obtained through a preset current limiting mode, and the current supported returned resources are returned to a server; the preset current limiting mode is as follows: one of token bucket current limiting mode and leaky bucket current limiting mode. It should be understood that, in this embodiment, the communication manner between the server and the main server is not limited, and preferably, the server uses an asynchronous network to communicate with the main server; meanwhile, the resources supporting the return are resources capable of returning according to the target resource request in a preset current limiting mode, the number of requests in a certain time window is limited in the current limiting mode in the preset current limiting mode, the availability and stability of the system are maintained, and slow or downtime of the system caused by sudden increase of the flow is prevented; taking a token bucket throttling mode as an example, a token bucket throttling mode is adopted by a main server, wherein the token bucket throttling mode adopts a token bucket algorithm, the token bucket algorithm takes resources as a bucket, uniformly puts tokens into the bucket, and controls the maximum capacity of the bucket (the maximum number of tokens) and the token rate (the generation of tokens/second). All requests need to take an available token before being processed, and if there is no token in the bucket, service is denied; specifically, the speed of generating tokens by the main server is fixed, wherein the tokens correspond to resources, when the main server receives a target resource request, the main server checks the tokens in the current control barrel, and if the number of the tokens possessed by the current main server is not lower than the number of the tokens corresponding to the target resource request, the token corresponding to the target resource request is returned, namely all the resources corresponding to the target resource request; if the number of tokens owned by the current main server is lower than the number of tokens corresponding to the target resource request, returning the tokens owned by the current main server, namely resources owned by the current main server, or caching the current target resource request when the number of tokens owned by the current main server is lower than the number of tokens corresponding to the target resource request, and returning the number of tokens corresponding to the target resource request when the number of tokens owned by the main server is not lower than the number of tokens corresponding to the target resource request, namely all resources corresponding to the target resource request; and then, or when the number of tokens owned by the current main server is lower than the number of tokens corresponding to the target resource requests, discarding the current target resource requests, and returning zero tokens.
In the above example, the server sends the target resource request to the main server through Netty, where Netty is a network application framework based on Java NIO client-server, and compared with other network application frameworks, netty has better throughput, lower latency, less resource consumption, and minimized unnecessary memory copy besides providing asynchronous network communication for the server and the main server, the main server determines the number of tokens that can be returned through a token bucket throttling mode after receiving the target resource request, and then the main server returns the number of tokens that are currently supported to be returned to the server through Netty.
In some examples of this embodiment, receiving the resource returned by the primary server according to the target resource request, and responding to the task request received in the current time period by using the resource returned by the primary server, where the response includes one of the following: receiving a resource returned by the main server according to the target resource request; when the resources returned by the main server correspond to the target resource requests, responding to all task requests received in the current time period; receiving a resource returned by the main server according to the target resource request; when the resources returned by the main server are empty, rejecting all task requests received in the current time period; receiving a resource returned by the main server according to the target resource request; when the resources returned by the main server are lower than the resources corresponding to the target resource requests, determining the task requests which can be responded by the resources returned by the main server, responding the task requests which can be responded by the resources returned by the main server, and rejecting other non-responded task requests.
It should be understood that, when the resource returned by the main server is lower than the resource corresponding to the target resource request, the task request that the resource returned by the main server can respond is determined, and in the step of responding to the task request that the resource returned by the main server can respond, the task request that the resource returned by the main server can respond may be: determining the sequence of all task requests received in the current time period, sequentially responding according to the sequence of all task requests received in the current time period until the resources returned by the main server are exhausted, and rejecting other non-responded task requests; the task request for determining that the resource returned by the main server can respond may also be: and determining the important sequence of all the received task requests in the current time period, responding sequentially according to the important sequence until the resources returned by the main server are exhausted, and rejecting other unresponsive task requests.
The server resource request method provided by the embodiment comprises the following steps: recording the number of task requests received in a current time period, generating target resource requests according to the number of task requests received in the current time period after the current time period is finished, and sending the target resource requests to a main server; and receiving the resources returned by the main server according to the target resource request, responding to the task requests received in the current time period by utilizing the resources returned by the main server, and carrying out resource requests in batches according to the number of the tasks received in the current time period by gathering the task requests received in the current time period, thereby reducing the interaction times between a server and the main server, improving the number of inquiry requests per second, improving the efficiency of the resource requests, further saving the communication resources of the system and improving the user experience.
For a better understanding of the present invention, the present embodiment provides a more specific example for explaining the present invention;
The distributed speed limit is a very common scene in daily work, for example, the gateway current limit is used. However, if the number of query requests per second (QPS) is high, the distributed constraint may not withstand the high concurrent pressures, which may be a performance bottleneck. If the distributed speed limit is abandoned, the error of the speed limit is relatively high, the requirement for fine control is not met, the performance loss is serious, and the problem of speed limit under high QPS is solved.
In order to solve the problem of distributed speed limitation under the high QPS, the scheme combines a plurality of technologies such as batch request invoice of a server side, an invoice server, a token bucket algorithm, netty interaction and the like, and reduces the performance consumption of the distributed speed limitation under the high QPS as much as possible. 1. The interaction efficiency between the server and the invoice server is improved through Netty, 2, the interaction between the server and the invoice server is reduced through batch request, 3, the flow limitation is carried out by using a token bucket algorithm in the invoice server, the calculation of a token bucket and the issuing of the token are calculated in a memory mode, the result is timed and synchronized to zk, in order to solve the single-point problem of the invoice server, zk is introduced, if the invoice server is hung off, zk is reselected, the server can be switched to the latest invoice server, and the flow limitation can be degraded to be local in the switching process. Specifically, as shown in fig. 2, the server resource request method includes the following steps:
Step1 invoice Server Cluster registration
Firstly, registering an invoice server with zk, and establishing a master catalog by utilizing zk, wherein an invoice server cluster establishes a temporary sequence node under the zk master catalog to determine a master invoice server;
Step 2, the server side obtains the address of the invoice server;
Then, the server acquires the invoice server node under the zk selected main directory, and the first node is defined as the address of the main invoice server, and it should be understood that after the main invoice server is down, the server monitors the zk temporary directory change, acquires the first temporary node under the zk selected main directory again, requests a new invoice server, and continues to provide service for the server after acquiring the token bucket information from the zk shared directory.
Step3, the server receives the request
The server receives requests sent by other services depending on the server to the server;
Step4, server side batch request invoice server
After counting the number of requests in the time window, the server side requests an invoice to the invoice server, the invoice server returns the number of invoices, the number of invoices is greater than 0, the request is executed, and the number of invoices is less than or equal to 0, and the request is refused; specifically, the server uses 10ms as a time window, records the number of requests in the time window, applies for an invoice to the invoice server through Netty according to the number of requests in the last time window, executes the request if the server obtains the invoice, and refuses the request in batches if the server does not obtain the invoice. The method is a behavior of firstly consuming in batches and then buying tickets, so that interaction between a server side and an invoice server is reduced;
it should be appreciated that before the invoice server returns an invoice, the invoice server also needs to define the number of invoices returned, specifically: the invoice server performs the flow restriction in a memory token bucket manner, and the token bucket flow restriction manner is described above and is not described here.
Step5, timing synchronization token bucket information
The main server returns the invoice obtained by the current limit to the server, and the data of the token bucket is synchronized to the zk shared directory at regular time for persisting the token bucket information.
According to the server resource request method provided by the example, the server side sends the batch request to the main invoice server through Netty, so that the interaction times of the server side and the invoice server are reduced, the interaction efficiency of word interaction is improved, and the upper limit of the QPS is further improved; meanwhile, zk is introduced to ensure high availability of the invoice server, so that user experience is improved.
Based on the same concept, the present embodiment provides a server resource request device, as shown in fig. 3, including:
The recording module 1 is used for recording the number of task requests received in a current time period, generating a target resource request according to the number of task requests received in the current time period after the current time period is finished, and sending the target resource request to the main server, wherein the main server is determined by a sequence node established under a selected main catalog;
And the receiving module 2 is used for receiving the resources returned by the main server according to the target resource request and responding to the task request received in the current time period by utilizing the resources returned by the main server.
It should be understood that, each module combination of the server resource request device provided in this embodiment can implement each step of the server resource request method, so as to achieve the same technical effects as each step of the server resource request method, which are not described herein in detail.
As shown in fig. 4, an embodiment of the present application provides an electronic device including a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 perform communication with each other through the communication bus 114,
A memory 113 for storing a computer program;
in one embodiment of the present application, the processor 111 is configured to implement the server resource request method provided in any one of the foregoing method embodiments when executing the program stored in the memory 113, where the method includes:
Recording the number of task requests received in a current time period, generating target resource requests according to the number of task requests received in the current time period after the current time period is finished, and sending the target resource requests to a main server;
and receiving the resources returned by the main server according to the target resource request, and responding to the task request received in the current time period by utilizing the resources returned by the main service.
The embodiment of the present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the server resource request method provided in any one of the method embodiments described above.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing is only a specific embodiment of the invention to enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (9)

1. A server resource request method, characterized in that the server resource request method comprises:
Recording the number of task requests received in a current time period, generating target resource requests according to the number of task requests received in the current time period after the current time period is finished, and sending the target resource requests to a main server;
receiving the resources returned by the main server according to the target resource request, and responding to the task request received in the current time period by utilizing the resources returned by the main service;
Before sending the target resource request to the primary server, the method further includes: acquiring sequence nodes established under a selected main catalog by a plurality of servers, wherein the sequence nodes comprise a plurality of nodes which are sequentially arranged, and each node corresponds to one server; and taking the server corresponding to the first node in the sequence nodes as the main server.
2. The method of claim 1, wherein after the server corresponding to the first node in the sequence nodes is used as the main server, the method further comprises:
when a server corresponding to a first node in the sequence nodes fails, updating the sequence nodes to remove the first node corresponding to the failed server in the sequence nodes;
and after updating the sequence node, taking the server corresponding to the first node in the updated sequence node as the main server.
3. The server resource request method according to claim 1, wherein transmitting the target resource request to the host server includes:
and sending the target resource request to the main server through an asynchronous network, so that the main server obtains the resources currently supported to return through a preset current limiting mode when receiving the target resource request, and returns the resources currently supported to return to the server.
4. The server resource request method according to claim 1, wherein receiving the resource returned by the main server according to the target resource request, and responding to the task request received in the current time period by using the resource returned by the main server, includes:
Receiving a resource returned by the main server according to the target resource request;
and when the resources returned by the main server correspond to the target resource requests, responding to all task requests received in the current time period.
5. The server resource request method according to claim 1, wherein receiving the resource returned by the main server according to the target resource request, and responding to the task request received in the current time period by using the resource returned by the main server, includes:
Receiving a resource returned by the main server according to the target resource request;
and rejecting all task requests received in the current time period when the resources returned by the main server are empty.
6. The server resource request method according to claim 1, wherein receiving the resource returned by the main server according to the target resource request, and responding to the task request received in the current time period by using the resource returned by the main server, includes:
Receiving a resource returned by the main server according to the target resource request;
and when the resources returned by the main server are lower than the resources corresponding to the target resource requests, determining the task requests which can be responded by the resources returned by the main server, and responding to the task requests which can be responded by the resources returned by the main server.
7. A server resource requesting device, characterized in that the server resource requesting device comprises:
The recording module is used for recording the number of task requests received in the current time period, generating target resource requests according to the number of task requests received in the current time period after the current time period is finished, and sending the target resource requests to a main server, wherein the main server is determined by a sequence node established under a selected main catalog;
The receiving module is used for receiving the resources returned by the main server according to the target resource request and responding to the task request received in the current time period by utilizing the resources returned by the main server;
The acquisition module is used for acquiring the sequence nodes established by the servers under the selected main catalog before the target resource request is sent to the main server, wherein the sequence nodes comprise a plurality of nodes which are sequentially arranged, and each node corresponds to one server; and taking the server corresponding to the first node in the sequence nodes as the main server.
8. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
A memory for storing a computer program;
A processor for implementing the steps of the server resource request method of any one of claims 1-6 when executing a program stored on a memory.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the server resource request method according to any of claims 1-6.
CN202210579176.1A 2022-05-25 2022-05-25 Server resource request method and device, electronic equipment and storage medium Active CN114866556B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210579176.1A CN114866556B (en) 2022-05-25 2022-05-25 Server resource request method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210579176.1A CN114866556B (en) 2022-05-25 2022-05-25 Server resource request method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114866556A CN114866556A (en) 2022-08-05
CN114866556B true CN114866556B (en) 2024-04-19

Family

ID=82638919

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210579176.1A Active CN114866556B (en) 2022-05-25 2022-05-25 Server resource request method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114866556B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108055311A (en) * 2017-12-07 2018-05-18 畅捷通信息技术股份有限公司 HTTP Asynchronous Requests method, apparatus, server, terminal and storage medium
CN109299049A (en) * 2018-10-11 2019-02-01 郑州云海信息技术有限公司 A kind of processing method and processing device of file access request
CN111064771A (en) * 2019-11-14 2020-04-24 福建天晴数码有限公司 Network request processing method and system
CN112231075A (en) * 2020-09-07 2021-01-15 武汉市九格合众科技有限责任公司 Server cluster load balancing control method and system based on cloud service
CN112905926A (en) * 2021-02-07 2021-06-04 微民保险代理有限公司 Data processing method, device, equipment and storage medium
CN113134228A (en) * 2020-01-20 2021-07-20 腾讯科技(深圳)有限公司 Request information response method and related equipment
CN113268327A (en) * 2021-05-25 2021-08-17 北京金山云网络技术有限公司 Transaction request processing method and device and electronic equipment
CN113641505A (en) * 2021-10-14 2021-11-12 阿里云计算有限公司 Resource allocation control method and device for server cluster
CN113806050A (en) * 2021-09-22 2021-12-17 济南浪潮数据技术有限公司 Processing method and device of computing resources, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6807354B2 (en) * 2018-07-13 2021-01-06 株式会社日立製作所 Storage system and information management method

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108055311A (en) * 2017-12-07 2018-05-18 畅捷通信息技术股份有限公司 HTTP Asynchronous Requests method, apparatus, server, terminal and storage medium
CN109299049A (en) * 2018-10-11 2019-02-01 郑州云海信息技术有限公司 A kind of processing method and processing device of file access request
CN111064771A (en) * 2019-11-14 2020-04-24 福建天晴数码有限公司 Network request processing method and system
CN113134228A (en) * 2020-01-20 2021-07-20 腾讯科技(深圳)有限公司 Request information response method and related equipment
CN112231075A (en) * 2020-09-07 2021-01-15 武汉市九格合众科技有限责任公司 Server cluster load balancing control method and system based on cloud service
CN112905926A (en) * 2021-02-07 2021-06-04 微民保险代理有限公司 Data processing method, device, equipment and storage medium
CN113268327A (en) * 2021-05-25 2021-08-17 北京金山云网络技术有限公司 Transaction request processing method and device and electronic equipment
CN113806050A (en) * 2021-09-22 2021-12-17 济南浪潮数据技术有限公司 Processing method and device of computing resources, electronic equipment and storage medium
CN113641505A (en) * 2021-10-14 2021-11-12 阿里云计算有限公司 Resource allocation control method and device for server cluster

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
智能数据批量处理控制模型;孙长乐;郭东明;高航;邹灵浩;;计算机工程与应用;20100501(第13期);全文 *

Also Published As

Publication number Publication date
CN114866556A (en) 2022-08-05

Similar Documents

Publication Publication Date Title
US20150213134A1 (en) Data query method and system and storage medium
US20170126583A1 (en) Method and electronic device for bandwidth allocation based on online media services
WO2014101433A1 (en) Method and device for accessing application server
WO2019237594A1 (en) Session persistence method and apparatus, and computer device and storage medium
US7877515B2 (en) Identity assignment for software components
CN110727738B (en) Global routing system based on data fragmentation, electronic equipment and storage medium
CN114827145B (en) Server cluster system, metadata access method and device
CN111083199A (en) High-concurrency, high-availability and service-extensible platform-based processing architecture
WO2014177085A1 (en) Distributed multicopy data storage method and device
US9386353B2 (en) Child node, parent node, and caching method and system for multi-layer video network
CN107172214A (en) A kind of service node with load balancing finds method and device
CN104954444A (en) Cached data migration method and device
US20090157896A1 (en) Tcp offload engine apparatus and method for system call processing for static file transmission
CN114866556B (en) Server resource request method and device, electronic equipment and storage medium
WO2023169106A1 (en) Method and apparatus for scheduling content delivery network domain name
WO2016000303A1 (en) Resource allocation method and system, and computer storage medium
CN110933196A (en) ID distribution method, system and storage medium for global uniform framework
CN113873502B (en) IP address management method, NEF entity and communication system
CN114338832B (en) Network protocol conversion method and system of container cloud platform
CN111752717B (en) SMF intelligent expansion method and device and SMF session establishment communication method
TWI766387B (en) Reverse proxy method and storage device with delay sensing and load balancing
US11847161B2 (en) Data processing method and apparatus, device, and storage medium
CN110753043B (en) Communication method, device, server and medium
CN109460293B (en) Computing resource selection method under distributed computing environment in wireless cloud computing system
CN112073223A (en) System and method for managing and controlling operation of cloud computing terminal and cloud server

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant