CN108572870B - Data acquisition method, device, electronic equipment, storage medium and system - Google Patents
Data acquisition method, device, electronic equipment, storage medium and system Download PDFInfo
- Publication number
- CN108572870B CN108572870B CN201711183112.5A CN201711183112A CN108572870B CN 108572870 B CN108572870 B CN 108572870B CN 201711183112 A CN201711183112 A CN 201711183112A CN 108572870 B CN108572870 B CN 108572870B
- Authority
- CN
- China
- Prior art keywords
- pass
- service
- server
- request
- management server
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/52—Program synchronisation; Mutual exclusion, e.g. by means of semaphores
- G06F9/526—Mutual exclusion algorithms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/506—Constraint
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The embodiment of the invention provides a data acquisition method, a data acquisition device, electronic equipment, a storage medium and a data acquisition system, wherein the method comprises the following steps: receiving N pass obtaining requests sent by N service servers, judging whether N is larger than a preset pass issuing number M, selecting M pass obtaining requests from the N pass obtaining requests when N is larger than M, and obtaining identification information of M request sender service servers which belong to the M pass obtaining requests; respectively adding M pre-stored passes to M pass response messages; and respectively sending M pieces of pass response information to the service servers corresponding to the identification information of the M pieces of request sender service servers, so that each service server acquires the data to be acquired according to the pass response information. Therefore, the number of the service servers which can simultaneously acquire the required data from the service control server can be automatically limited, and the pressure of the service control server is reduced.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a data acquisition method, apparatus, electronic device, storage medium, and system.
Background
With the rapid development of internet technology, cloud computing is widely used as an internet-based computing mode. The core idea of cloud computing is to uniformly manage and schedule a large number of computing resources connected by a network to form a uniform resource pool to provide on-demand services for users. Cloud computing is a product of development and fusion of traditional computer and network technologies, such as grid computing, distributed computing, parallel computing, utility computing, network storage, virtualization, load balancing and the like.
Through cloud computing, computing may be distributed in a distributed system, which may include business control servers and business servers. The service control server is used for carrying out unified management and scheduling on the computing resources, and the service server is used for executing specific services according to the scheduling instruction of the service control server. Generally, the number of service control servers is small, and the number of service servers is large. The service server needs to acquire necessary data from the service control server on an irregular basis. When more Service servers need to acquire data from the Service control server at the same time, and the number of the Service servers acquiring the data is large, the pressure of the Service control server is increased, so that the Service control server runs slowly, the Service control server cannot return the data required by the Service server within a set time, even a DDOS (Distributed Denial of Service) condition is formed, and the Service control server is disabled due to a more serious condition.
In order to avoid the above problems, the following schemes are generally adopted:
the first scheme is as follows: the data acquisition sequence of all the service servers is prevented from being acquired simultaneously, and the data acquisition sequence of the service servers is manually controlled. For example, 1000 service servers are controlled to obtain data in batches, so that the pressure of the service control servers is always within the bearable range of the service control servers. However, in the first solution, the operation and maintenance manager needs to control all the service servers to acquire data in batches and manually, which causes low efficiency of acquiring data by the service servers.
Scheme II: and increasing the number of the service control servers, so that the service control servers can return the data required by the service servers to all the service servers within preset time. However, in a normal case, the service control server does not need to return the data required by the service server within a preset time at every time point. In order to deal with the situation that more service servers acquire data at the same time, increasing service control server nodes causes cost increase, and is not an optimal scheme.
The third scheme is as follows: and setting different data acquisition time for each service server, so that each service server acquires data from the service control server according to the different data acquisition time. The third scheme seems to avoid that all the service servers simultaneously acquire the required data from the service control server, but when the service servers are frequently added, the data acquisition time needs to be frequently reset, which is more complicated.
It can be seen that the three solutions of the prior art are not the preferred solutions to the above-mentioned problems.
Disclosure of Invention
Embodiments of the present invention provide a data acquisition method, an apparatus, an electronic device, a storage medium, and a system, so as to automatically limit the number of service servers that simultaneously acquire data from a service control server, thereby reducing the pressure of the service control server. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a data acquisition method, which is applied to a pass management server, and the method includes:
receiving N pass obtaining requests sent by N service servers, wherein each service server sends a pass obtaining request, each pass obtaining request carries identification information of a service server of a request sending party, each pass obtaining request is sent to a pass management server when data to be obtained exist in the service server of the request sending party, and N is an integer greater than or equal to 1;
judging whether N is larger than a preset number M of issued passes or not; wherein M is an integer greater than or equal to 1;
when N is larger than M, M pass obtaining requests are selected from the N pass obtaining requests, and identification information of M request sending party service servers which belong to the M pass obtaining requests is obtained;
respectively adding M pre-stored passes to M pass response messages;
and respectively sending M pieces of pass response information to the service servers corresponding to the identification information of the M pieces of request sender service servers, so that each service server acquires the data to be acquired according to the pass response information.
Optionally, before receiving N pass obtaining requests sent by N service servers, a data obtaining method according to an embodiment of the present invention further includes:
receiving a pass generation instruction;
and generating M passes according to the pass generation instruction and the preset pass issuing quantity M, and storing the M passes.
Optionally, after receiving the pass generation instruction, the data obtaining method according to the embodiment of the present invention further includes:
judging whether the pass generation instruction carries a distributed lock or not;
correspondingly, according to the pass generation instruction, according to predetermineeing number M, generate M passes to store M passes, include:
when the distributed locks are carried in the pass generation instruction, M passes are generated according to the preset number M of the passes, and the M passes are stored.
Optionally, the step of storing M passes includes:
adding M passes to a preset pass set;
after adding the M passes to the preset set of passes, the data acquisition method according to the embodiment of the present invention further includes:
setting the mark state of a preset pass set as a setting state;
correspondingly, each pass acquiring request is sent to the pass management server when the data to be acquired exists in each service server and the marking state of the preset pass set is confirmed to be a setting state.
In a second aspect, an embodiment of the present invention further provides a data obtaining method, which is applied to a service server, and the method includes:
when the data to be acquired exist, a pass acquiring request is sent to a pass management server, so that the pass management server constructs pass response information containing a pass according to the pass acquiring request and sends the pass response information to the service server;
when receiving the pass response information sent by the pass management server, acquiring a pass in the pass response information;
and adding the pass to the data acquisition request, and sending the data acquisition request to the service control server.
Optionally, before sending the request for obtaining a pass to the pass management server, the data obtaining method according to the embodiment of the present invention further includes:
acquiring a mark state of a pass set for storing the pass in a pass management server;
correspondingly, sending the pass obtaining request to the pass management server includes:
and when the marking state of the pass set is a setting state, sending a pass obtaining request to the pass management server.
Optionally, after the obtaining of the mark state of the pass set of the pass is stored in the pass management server, the data obtaining method according to the embodiment of the present invention further includes:
when the marked state of the pass set is a reset state, sending a distributed lock acquisition request to a pass management server;
after receiving distributed lock response information carrying distributed locks sent by a pass management server, adding the distributed locks to a pass generation instruction;
and sending a pass generation instruction carrying the distributed lock to a pass management server.
Optionally, after sending the request for obtaining a pass to the pass management server, the data obtaining method according to the embodiment of the present invention further includes:
when the pass response information corresponding to the pass acquisition request is not received, entering sleep according to first preset sleep time;
and after the first preset dormancy time is finished, repeatedly sending a pass obtaining request to the pass management server.
Optionally, after sending the data acquisition request to the service control server, the data acquisition method according to the embodiment of the present invention further includes:
and after receiving the data corresponding to the data acquisition request sent by the service control server, sending the pass to a pass management server.
In a third aspect, an embodiment of the present invention further provides a data obtaining apparatus, which is applied to a pass management server, and the apparatus includes:
the first receiving module is used for receiving N pass obtaining requests sent by N service servers, wherein each service server sends a pass obtaining request, each pass obtaining request carries identification information of the service server of the corresponding request sending party, each pass obtaining request is sent to the pass management server when data to be obtained exist in the service server of the corresponding request sending party, and N is an integer greater than or equal to 1;
the first judgment module is used for judging whether N is larger than the preset number M of issued passes or not; wherein M is an integer greater than or equal to 1;
the selection module is used for selecting M pass acquisition requests from the N pass acquisition requests when N is larger than M, and acquiring identification information of M request sender service servers which belong to the M pass acquisition requests and are carried in the M pass acquisition requests;
the adding module is used for respectively adding the pre-stored M passes into the M pass response messages;
and the response module is used for respectively sending M pieces of pass response information to the service servers corresponding to the identification information of the M service servers of the request sender, so that each service server can obtain the data to be obtained according to the pass response information.
Optionally, the data obtaining apparatus in the embodiment of the present invention further includes:
the second receiving module is used for receiving the pass generation instruction;
and the storage module is used for generating M passes according to the pass generation instruction and the preset pass issuing quantity M, and storing the M passes.
Optionally, the data obtaining apparatus in the embodiment of the present invention further includes:
the second judgment module is used for judging whether the pass generation instruction carries the distributed lock or not;
correspondingly, the storage module is specifically configured to:
when the distributed locks are carried in the pass generation instruction, M passes are generated according to the preset number M of the passes, and the M passes are stored.
Optionally, the storage module is specifically configured to:
adding M passes to a preset pass set;
correspondingly, the data acquisition device of the embodiment of the invention further comprises:
the mark state setting module is used for setting the mark state of the preset pass set to be a setting state;
correspondingly, each pass acquiring request is sent to the pass management server when the data to be acquired exists in each service server and the marking state of the preset pass set is confirmed to be a setting state.
In a fourth aspect, an embodiment of the present invention further provides a data obtaining apparatus, which is applied to a service server, and the apparatus includes:
the first sending module is used for sending a pass obtaining request to the pass management server when the data to be obtained exist, so that the pass management server constructs pass response information containing a pass according to the pass obtaining request and sends the pass response information to the service server;
the first receiving module is used for acquiring the pass in the pass response information when the pass response information sent by the pass management server is received;
and the second sending module is used for adding the pass to the data acquisition request and sending the data acquisition request to the service control server.
Optionally, the data obtaining apparatus in the embodiment of the present invention further includes:
the system comprises a mark state acquisition module, a password management module and a password processing module, wherein the mark state acquisition module is used for acquiring the mark state of a password set of a password in a password management server and storing the mark state;
correspondingly, the first sending module is specifically configured to:
and when the marking state of the pass set is a setting state, sending a pass obtaining request to the pass management server.
Optionally, the data obtaining apparatus in the embodiment of the present invention further includes:
the third sending module is used for sending a distributed lock acquisition request to the pass management server when the marking state of the pass set is a reset state;
the second receiving module is used for adding the distributed lock to the pass generation instruction after receiving the distributed lock response information carrying the distributed lock sent by the pass management server;
and the fourth sending module is used for sending the pass generation instruction carrying the distributed lock to the pass management server.
Optionally, the data obtaining apparatus in the embodiment of the present invention further includes:
the dormancy setting module is used for entering dormancy according to first preset dormancy time when the pass response information corresponding to the pass obtaining request is not received; and after the first preset sleep time is over, triggering the first sending module.
Optionally, the data obtaining apparatus in the embodiment of the present invention further includes:
and the fifth sending module is used for sending the pass to the pass management server after receiving the data corresponding to the data acquisition request sent by the service control server.
In a fifth aspect, an embodiment of the present invention further provides a passport management server, including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: the steps of a data acquisition method provided by the first aspect are implemented.
In a sixth aspect, an embodiment of the present invention further provides a service server, including a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions capable of being executed by the processor, and the processor is caused by the machine-executable instructions to: the steps of a data acquisition method provided by the second aspect are implemented.
In a seventh aspect, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the data acquisition method provided in the first aspect are implemented.
In an eighth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the data acquisition method provided in the second aspect are implemented.
In a ninth aspect, an embodiment of the present invention further provides a computer program product containing instructions, which when run on a computer, causes the computer to execute the steps of the data acquisition method provided in the first aspect.
In a tenth aspect, embodiments of the present invention further provide a computer program product containing instructions, which when run on a computer, cause the computer to perform the steps of the data acquisition method provided in the second aspect.
In an eleventh aspect, an embodiment of the present invention further provides a computer program, which when run on a computer, causes the computer to execute the steps of the data acquisition method provided in the first aspect.
In a twelfth aspect, an embodiment of the present invention further provides a computer program, which, when running on a computer, causes the computer to execute the steps of the data acquisition method provided in the second aspect.
In a thirteenth aspect, an embodiment of the present invention further provides a data acquisition system, where the system includes: the system comprises a pass management server, a service server and a service control server;
the system comprises a service server and a pass management server, wherein the service server is used for sending a pass acquisition request to the pass management server when data to be acquired exist, and N is an integer which is greater than or equal to 1;
the system comprises a pass management server, a plurality of request sending servers and a plurality of pass acquiring servers, wherein the pass management server is used for receiving N pass acquiring requests sent by N service servers, judging whether N is larger than a preset pass issuing quantity M, selecting M pass acquiring requests from the N pass acquiring requests when N is larger than M, acquiring identification information of M service servers carried in the M pass acquiring requests, respectively adding M pre-stored passes into M pass response information, and respectively sending the M pass response information to the service servers corresponding to the identification information of the M request sending party service servers, wherein each pass acquiring request carries the identification information of the corresponding request sending party service server, and M is an integer larger than or equal to 1;
the service server is also used for acquiring the pass in the pass response information when receiving the pass response information sent by the pass management server, adding the pass in the pass response information into the data acquisition request and sending the data acquisition request to the service control server;
and the service control server is used for receiving the data acquisition request sent by the service server and sending the data to be acquired corresponding to the data acquisition request to the service server.
According to the data acquisition method, the data acquisition device, the electronic equipment, the storage medium and the data acquisition system, after N pass acquisition requests sent by N service servers are received, whether N is larger than a preset pass issuing quantity M or not is judged, when N is larger than M, M pass acquisition requests are selected from the N pass acquisition requests, then identification information of M service servers carried in the M pass acquisition requests is acquired, M pre-stored passes are respectively added into M pass response information, and finally M pass response information is respectively sent to the service servers corresponding to the identification information of the service servers of the M request senders, so that each service server can acquire data to be acquired according to the pass response information. Therefore, the number of the service servers which can simultaneously acquire the required data from the service control server can be automatically limited, and the pressure of the service control server is reduced. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic system diagram illustrating a data acquisition method applied to a distributed system according to an embodiment of the present invention;
fig. 2 is a flowchart of a first implementation manner in which a data acquisition method according to an embodiment of the present invention is applied to a pass management server;
fig. 3 is a flowchart of a first implementation manner in which a data acquisition method according to an embodiment of the present invention is applied to a service server;
fig. 4 is a schematic structural diagram of a data acquisition device applied to a pass management server according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a data acquisition apparatus applied to a service server according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a passport management server according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a service server according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a data acquisition system according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to solve the problems in the prior art, embodiments of the present invention provide a data acquisition method, an apparatus, an electronic device, a storage medium, and a system, so as to automatically limit the number of service servers that simultaneously acquire data required by the service control servers from the service control servers, thereby reducing the pressure of the service control servers.
First, a data obtaining method according to an embodiment of the present invention may be applied to a distributed system, as shown in fig. 1, which is a system schematic diagram of the data obtaining method according to the embodiment of the present invention applied to the distributed system, and the system may include: a pass management server 101, a service control server 102, a first service server 103, a second service server 104 and a third service server 105, wherein a line segment 106 may represent a communication line between the service server and the pass management server 101, and a line segment 107 may represent a communication line between the service server and the service control server 102.
In this system, the first service server 103, the second service server 104, and the third service server 105 may first acquire a pass from the pass management server 101 before sending a data acquisition request to the service control server 102. After acquiring the pass from the pass management server 101, the data acquisition request is sent to the service control server 102, and when the pass is not acquired from the pass management server 101, the data acquisition request is not sent to the service control server 102. Therefore, the number of the service servers which can obtain the required data from the service control server at the same time is automatically limited, and the pressure of the service control server is reduced. For example, after acquiring the pass from the pass management server 101, the first service server 103 may send a data acquisition request to the service control server 102. The second service server 104 does not acquire the pass from the pass management server 101, and does not send the data acquisition request to the service control server 102.
Next, a data obtaining method according to an embodiment of the present invention is described, and as shown in fig. 2, the data obtaining method according to the embodiment of the present invention is applied to a flowchart of a first implementation manner of a pass management server, where the method may include:
s201, receiving N pass obtaining requests sent by N service servers.
Each service server sends a pass acquiring request, each pass acquiring request carries identification information of the service server of the request sending party, each pass acquiring request is sent to a pass management server when data to be acquired exist in the service server of the request sending party, N is an integer greater than or equal to 1, and the identification information can be an IP address, an MAC address and the like of the service server.
Specifically, before the service server acquires the data to be acquired from the service control server, a pass acquisition request may be first sent to the pass management server to acquire a pass. Therefore, in this step, the pass management server applying the data acquisition method according to the embodiment of the present invention may receive N pass acquisition requests sent by N service servers.
In some examples, the service server may be a virtual server implemented by a virtual technology on one physical server, and each virtual server may have independent identification information.
In some examples, the business servers described above may also be physical servers, each of which may have different identification information.
In some examples, the traffic server may also have a virtual switch or a virtual router loaded therein.
In still other examples, a part of the N service servers may be virtual servers, and another part may be physical servers.
For example, the first service server 103, the second service server 104, and the third service server 105 shown in fig. 1 may all be virtual servers, or may all be physical servers; any two of the three service servers may also be virtual servers, or any one of the three service servers may be a virtual server.
Specifically, after receiving N pass acquisition requests sent by N service servers, the pass management server applying the data acquisition method of the embodiment of the present invention can count the number of the pass acquisition requests.
S202, judging whether N is larger than the preset number M of issued passes.
Wherein, M is an integer greater than or equal to 1, and the preset number of issued passes can be set according to experience or performance of the service control server.
Specifically, after receiving the N pass acquiring requests in the above steps, the size relationship between N and the preset pass issuing number M may be determined, that is, it is determined whether N is greater than the preset pass issuing number M or less than or equal to the preset pass issuing number M.
In some examples, the preset number of issued passes in the pass management server to which the data acquisition method according to the embodiments of the present invention is applied may limit the number of service servers that acquire a pass from the pass management server, thereby reducing the number of service servers that simultaneously send data acquisition requests and reducing the pressure of the service control server.
In other examples, the preset number of issued passes in this step may be preset by the service control server. Specifically, the service control server may send a setting instruction carrying the number M of issued passes to the pass management server in advance, and after receiving the setting instruction, the pass management server may obtain the number M of issued passes from the setting instruction and record the number M of issued passes.
S203, when N is larger than M, M pass obtaining requests are selected from the N pass obtaining requests, and identification information of M request sending party service servers which belong to the M pass obtaining requests is obtained.
Specifically, after determining whether N is greater than M through the above steps, the data acquisition method according to the embodiment of the present invention provides a feasible implementation manner: when N is greater than M, M pass acquisition requests are first selected from the N pass acquisition requests.
In some examples, when selecting M passcard acquisition requests from the N passcard acquisition requests, the M passcard acquisition requests may be randomly selected.
In some examples, after receiving N pass acquisition requests sent by N service servers in step S201, an identification number may be generated for each pass acquisition request, so that when M pass acquisition requests are selected from the N pass acquisition requests in this step, the M pass acquisition requests may be selected according to the descending order or ascending order of the identification number.
In still other examples, after selecting M pass acquisition requests, the identification information of M service servers carried in the M pass acquisition requests may be acquired. Through the step, the pass management server applying the data acquisition method provided by the embodiment of the invention can only acquire the identification information of the M service servers, so that the quantity of the identification information acquired by the pass management server is reduced, and the workload of the pass management server is reduced.
S204, respectively adding the M pre-stored passes to the M pass response messages.
The M pre-stored passes may be generated and stored in advance by the pass management server to which the data acquisition method according to the embodiment of the present invention is applied.
In some examples, the M passes in this step may be generated and stored in advance by a pass management server to which a data acquisition method according to an embodiment of the present invention is applied. By pre-generating and storing, the time overhead of obtaining the pass by the service server can be reduced, so that the service server can send a data obtaining request to the service control server in time to obtain the data to be obtained.
In some examples, after the M pass acquisition requests are selected through the above steps, generation of pass response information may be triggered, in this step, M passes stored in advance may be added to the M pass response information, respectively, to generate M pass response information carrying M passes, respectively, where one pass response information carries one pass.
Through the steps, each pass response message only carries one pass, and after the service server acquires the pass response message through the subsequent steps, the service server can send a data acquisition request through the pass only. The service server is prevented from sending data acquisition requests for multiple times after acquiring the pass response information once. Thereby the pressure of the service control server can be reduced.
S205, respectively sending M pieces of pass response information to the service servers corresponding to the identification information of the M pieces of request sender service servers, so that each service server can obtain the data to be obtained according to the pass response information.
After the identification information of the M service servers is respectively obtained through the steps and the M pass response information is obtained, the service servers can obtain the data to be obtained from the service control server through the pass. In this step, M pieces of pass response information may be sent to the service servers corresponding to the identification information of the M pieces of request sender service servers to which the pass response information belongs. Each service server can obtain a pass response message.
In some examples, M pieces of pass response information may be sequentially transmitted to the service servers corresponding to the identification information of the M pieces of request sender service servers to which the pass response information belongs. The instantaneous bandwidth occupation of the pass management server can be reduced.
In some examples, M pieces of pass response information may be sent to the service servers corresponding to the identification information of the M pieces of request sender service servers to which the pass response information belongs, respectively, at the same time. The time for sending the pass response information can be shortened, so that the service server can obtain the communication pass response information in time, and further obtain the data to be obtained according to the pass response information.
According to the data acquisition method provided by the embodiment of the invention, after N pass acquisition requests sent by N service servers are received, whether N is larger than a preset pass issuing quantity M is judged, when N is larger than M, M pass acquisition requests are selected from the N pass acquisition requests, then identification information of M service servers carried in the M pass acquisition requests is acquired, M pre-stored passes are respectively added into M pass response information, and finally M pass response information is respectively sent to the service servers corresponding to the identification information of the service servers of the M request senders to which the pass acquisition requests belong, so that each service server acquires data to be acquired according to the pass response information. Therefore, the number of the service servers which can simultaneously acquire the required data from the service control server can be automatically limited, and the pressure of the service control server is reduced.
In a possible implementation manner of the embodiment of the present invention, in a start-up stage of a service server, a data acquisition method according to the embodiment of the present invention may be applied, where a pass acquisition request is first sent to a pass management server to which the data acquisition method according to the embodiment of the present invention is applied, the pass management server may send pass response information to the service server through the first implementation manner of the data acquisition method according to the embodiment of the present invention after receiving the pass acquisition request, the service server acquires a pass from corresponding information of the pass after receiving the corresponding information of the pass, and then acquires data to be acquired from a service control server according to the pass.
In particular, the pass may be a distributed lock. When the pass is a distributed lock, the distributed lock may be stored in advance in a pass management server to which the data acquisition method of the embodiment of the present invention is applied.
It should be understood that, as the distributed lock of the pass, a plurality of distributed locks may be generated by the pass management server through the plurality of distributed lock generation applications, respectively, and stored locally in the pass management server.
In some examples, the pass may also be a token, and when the pass is a token, the embodiment of the present invention further provides a possible implementation manner, before receiving N pass acquisition requests sent by N service servers, the embodiment of the present invention may further receive a pass generation instruction, and then generate and store M passes according to the pass generation instruction.
Specifically, before receiving N pass acquisition requests sent by N service servers in S201, the data acquisition method according to the embodiment of the present invention may further include:
and S2010, receiving a pass generation instruction.
In some examples, the passgeneration instruction may be sent by the traffic control server, e.g., in fig. 1, the passgeneration instruction may be sent by the traffic control server 102. Specifically, the service control server may store identification information of the pass management server, and after the service control server generates the pass generation instruction, the identification information of the pass management server may be added to the pass generation instruction and sent to the pass management server.
In some examples, the pass generation instruction may also be sent by the traffic server. Specifically, before the service server sends the pass acquiring request, the service server may first send a pass generating instruction, so that the pass management server generates a pass according to the pass generating instruction, and then sends the pass acquiring request, thereby ensuring that some service servers of the N service servers can acquire the pass returned by the pass management server after the N service servers send the N pass acquiring requests.
And S2011, generating M passes according to the preset pass issuing quantity M according to the pass generating instruction, and storing the M passes.
In some examples, after receiving a pass generation instruction, a pass management server applying the data acquisition method according to the embodiment of the present invention may trigger a corresponding application program to generate a pass.
Specifically, M passes may be generated according to a preset pass issuing number M, and stored in the pass management server.
In some examples, the M passes may be stored in a database of the pass management server.
In this step, by generating M passes, the number of service servers that acquire the passes can be limited, thereby limiting the number of data acquisition requests sent to the service control servers, and further reducing the pressure of the service control servers.
In some examples, the above implementation may be applied to the case where there is only one service control server. When there are a plurality of service control servers, there may be a plurality of service control servers sending a plurality of pass generation instructions to the pass management server, so that the pass management server generates a pass according to the plurality of pass generation instructions, thereby affecting the efficiency of the pass management server.
In a possible implementation manner of the embodiment of the present invention, in order to avoid that the pass management server repeatedly generates the pass according to the plurality of pass generation instructions after receiving the plurality of pass generation instructions, the pass management server receives the plurality of pass generation instructions sent by the plurality of service control servers, and the embodiment of the present invention further provides a possible implementation manner, and after receiving the pass generation instructions, the data acquisition method according to the embodiment of the present invention may further include:
and judging whether the pass generation instruction carries the distributed lock or not.
In some examples, a pass management server applying the data acquisition method according to the embodiments of the present invention may receive a plurality of pass generation instructions, and after the pass management server receives the plurality of pass generation instructions, it may determine whether the plurality of pass generation instructions carry a distributed lock, so as to determine which pass generation instruction of the plurality of pass generation instructions generates a pass.
In some examples, after receiving only one pass generation instruction, the pass management server applying the data acquisition method according to the embodiments of the present invention may determine whether the pass generation instruction carries a distributed lock, and determine whether to generate a pass according to the pass generation instruction.
Through judging whether the pass generation instruction carries the distributed lock or not, the pass management server can generate the pass only according to the pass generation instruction carrying the distributed lock, repeated generation of the pass according to a plurality of pass generation instructions not carrying the distributed lock can be avoided, and resource waste of the pass management server is avoided.
Correspondingly, after judging whether carry the distributed lock in the pass generating instruction, in the above-mentioned step, according to the pass generating instruction, according to predetermineeing the pass and issuing quantity M, generate M passes to store M passes, can include:
when the distributed locks are carried in the pass generation instruction, M passes are generated according to the preset number M of the passes, and the M passes are stored.
Specifically, after judging whether the pass generation instruction carries the distributed lock, the pass management server applying the data acquisition method of the embodiment of the present invention determines that the pass generation instruction carries the distributed lock, and then may generate M passes according to the preset number M of issued passes, and store the M passes in the database of the pass management server.
In a possible application scenario of the embodiment of the present invention, the pass generation instruction may be sent by the service server, and when the pass generation instruction is sent by the service server, it may also be determined whether the pass generation instruction sent by the service server carries a distributed lock.
In some examples, there is only one pass generation instruction carrying the distributed lock.
Through the steps, the pass management server can be ensured to generate the pass only according to one pass generation instruction, the pass management server is prevented from receiving a plurality of pass generation instructions sent by a plurality of service control servers, and the efficiency of the pass management server is improved.
In another possible implementation manner of the embodiment of the present invention, when storing M passes, the M passes may be added to a preset set of passes for storage.
Wherein, the preset pass set can be preset in the pass management server.
Through adding M passes to preset pass set and storing, can make things convenient for this pass management server to manage this M passes.
In some examples, after adding M passes to a preset set of passes, a data acquisition method according to an embodiment of the present invention further provides a possible implementation method, where the method includes:
and setting the marking state of the preset pass set as a setting state.
In some examples, when the preset set of passes is preset, a flag state may be set for the preset set of passes, for example, when no pass is stored in the preset set of passes, the flag state is a reset state, and when a pass is stored in the preset set of passes, the flag state is a set state.
In some examples, the set state and the reset state may be represented by "1" and "0" in a binary number, respectively, e.g., the set state is represented by "1" and the reset state is represented by "0".
In some examples, each pass acquiring request is sent to the pass management server when the data to be acquired exists in each service server and the flag state of the preset pass set is confirmed to be a set state.
By setting the marking state of the preset pass set to be the setting state, the marking state of the preset pass set can be checked before the service server sends the pass acquisition request, so that whether the pass is stored in the preset pass set or not is judged, and the problem that all service servers cannot acquire the pass after sending the pass acquisition request is avoided.
An embodiment of the present invention further provides a data acquisition method, which is applied to a service server, and as shown in fig. 3, is a flowchart of a first implementation manner in which the data acquisition method according to the embodiment of the present invention is applied to the service server, where the method may include:
s301, when the data to be acquired exist, a pass acquiring request is sent to the pass management server, so that the pass management server constructs pass response information containing a pass according to the pass acquiring request and sends the pass response information to the service server.
In some examples, to limit the number of traffic servers that simultaneously send data acquisition requests to the traffic control server, a pass acquisition request may first be sent to a pass management server before the traffic server is to acquire data to be acquired from the traffic control server.
Specifically, the identification information of the pass management server may be stored in the service server, and before the data to be acquired is acquired from the service control server, a pass acquisition request carrying the identification information of the pass management server may be generated, and then the pass acquisition request is sent to the pass management server.
In some examples, the pass acquiring request may further carry identification information of the service server, so that the pass management server may correctly send the pass response information corresponding to the pass acquiring request to the service server corresponding to the identification information when sending the pass response information corresponding to the pass acquiring request.
S302, when the pass response information sent by the pass management server is received, obtaining the pass in the pass response information.
In some examples, the number of the service servers sending the pass acquisition request may be multiple, and in order to limit the number of the service servers sending the data acquisition request to the service control server at the same time, the number of the pass response messages carrying the pass sent by the pass management server may be less than the number of the service servers sending the pass acquisition request, so that, among the multiple service servers sending the pass acquisition request, a part of the service servers may receive the pass response messages, and a part of the service servers may not receive the pass response messages.
When the service server receives the pass response information sent by the pass management server, the carried pass can be obtained from the pass response information. So that in the subsequent step, the data acquisition request is sent to the service control server through the pass to acquire the data to be acquired.
And S303, adding the pass to the data acquisition request, and sending the data acquisition request to the service control server.
In some examples, when the service server to which the data acquisition method according to the embodiment of the present invention is applied receives the pass response information sent by the pass management server, and acquires the pass, the service server may call a corresponding application program to generate the data acquisition request.
Specifically, when the data acquisition request is generated, the pass may be added to the data acquisition request, and then the data acquisition request may be sent to the service control server.
In some examples, the service server may further store identification information of the service control server, and when the data acquisition request is generated, the identification information of the service control server may be further added to the data acquisition request and sent to the service control server.
According to the data acquisition method provided by the embodiment of the invention, before the service server sends the data acquisition request, the service server can firstly send the pass acquisition request, after the service server receives corresponding pass information which is sent by the pass management server and corresponds to the pass acquisition request, the pass is acquired from the pass response information, and then the data acquisition request is sent to the service control server according to the pass so as to acquire the data to be acquired. Therefore, the number of the service servers which can simultaneously acquire the required data from the service control server can be automatically limited, and the pressure of the service control server is reduced.
When the pass in the pass management server is stored in a preset pass set and the mark state of the preset pass set is set, the pass management server corresponds to the pass management server to which the data acquisition method of the embodiment of the invention is applied.
In some examples, the service server may send a tag status obtaining request to the pass management server, and the pass management server may obtain the tag status of the local pass set after receiving the tag status obtaining request, then generate a tag status response message, and send the tag status response message to the service server, so that the service server may receive the tag status response message sent by the pass management server, and may determine, according to the tag status response message, that the tag status of the pass set stored in the pass management server is a set status or a reset status.
Correspondingly, the service server applying the data acquisition method of the embodiment of the invention can send the pass acquisition request to the pass management server when the marking state of the pass set is the setting state.
In some examples, when the service server obtains the tagged state of the pass set of the pass stored in the pass management server, and the tagged state of the pass set is a reset state, a possible implementation method is further provided in the embodiments of the present invention, and the method may include:
and step A, when the marking state of the pass set is a reset state, sending a distributed lock acquisition request to a pass management server.
In some examples, when the service server stores the marked state of the pass set of the pass in the obtaining pass management server, and determines that the marked state is the reset state, the service server may call a corresponding application program, generate a distributed lock obtaining request, and then send the distributed lock obtaining request to the pass management server. Wherein the distributed lock may be stored in the pass-through management server in advance, and the distributed lock may have only one.
In some examples, identification information of the pass management server may also be added to the distributed lock acquisition request when the distributed lock acquisition request is generated.
And step B, after receiving the distributed lock response information carrying the distributed lock sent by the pass management server, adding the distributed lock to a pass generation instruction.
In some examples, there may be multiple service servers that send distributed lock acquisition requests. For example, the first service server 103, the second service server 104, and the third service server 105 shown in fig. 1 may all send distributed lock acquisition requests to the aforementioned pass management server. After receiving the distributed lock acquisition requests sent by the plurality of service servers, the pass management server may randomly select one distributed lock acquisition request sent by one service server, generate distributed lock response information corresponding to the distributed lock acquisition request, and send the distributed lock response information to the service server corresponding to the distributed lock acquisition request.
And step C, sending the pass generation instruction carrying the distributed lock to a pass management server.
In some examples, after the service server sending the distributed lock acquisition request receives the distributed lock response information sent by the pass management server, the service server may acquire the distributed lock in the distributed lock response information and trigger generation of the pass generation instruction.
Specifically, when the pass generation instruction is generated, the identification information of the distributed lock and the service server may be added to the pass generation instruction and sent to the pass management server.
It should be understood that, in the pass management server to which the data acquisition method according to the embodiment of the present invention is applied, two distributed locks may be managed, where a first distributed lock is used to return a distributed lock response message carrying the first distributed lock when a first distributed lock acquisition request is received, so that a service server can send a pass generation instruction carrying the first distributed lock to the pass management server after acquiring the first distributed lock. The pass management server may further manage a second distributed lock, and the second distributed lock may be generated by the pass management server through a plurality of distributed lock generation application programs after receiving the pass generation instruction, and may be stored locally in the pass management server.
Through the data acquisition method provided by the embodiment of the invention, when the pass is stored in the pass set of the pass management server, the pass acquisition request is sent by the service server, so that the frequency of sending the pass acquisition request by the service server is reduced, and unnecessary waste of the bandwidth of the pass management server is avoided.
In some examples, when the service server does not receive the pass response information, the embodiment of the present invention further provides a possible implementation manner, in S301, after sending a pass acquisition request to the pass management server when there is data to be acquired, the data acquisition method according to the embodiment of the present invention may further include:
s304, when the pass response information corresponding to the pass obtaining request is not received, the system enters the sleep mode according to the first preset sleep time.
In some examples, a first preset sleep time may be preset for each service server, and when the service server does not receive the pass response information corresponding to the pass acquisition request sent by the pass management server, the service server applying the data acquisition method according to the embodiment of the present invention may enter a sleep state according to the first preset sleep time.
S305, after the first preset sleep time is over, repeatedly sending a pass obtaining request to the pass management server.
In some examples, after the service server that does not receive the pass response information enters the sleep state, the time when the service server enters the sleep state may be counted, and after the counting is finished, the service server that does not receive the pass response information may send the pass acquisition request to the pass management server again.
Through the steps, the service server which does not receive the pass response information can be enabled to enter the dormant state in time, and the energy expenditure is reduced.
In a possible implementation manner of the embodiment of the present invention, after sending the data acquisition request to the service control server, the data acquisition method according to the embodiment of the present invention may further include:
and after receiving the data corresponding to the data acquisition request sent by the service control server, sending the pass to a pass management server.
In some examples, when the service server that acquires the pass response information receives the data corresponding to the data acquisition request sent by the service control server, the pass in the acquired pass response information may be sent to the pass management server.
In some examples, the above-described pass management server maintains the total number of M passes after generating the M passes. After the pre-stored M passes are respectively added to the M pass response messages by the pass management server and the M pass response messages are respectively sent to the service servers corresponding to the identification information of the M service servers of the request senders to which the pass management server belongs, the number of the passes in the pass management server is zero, at this time, the pass management server does not regenerate the passes, and the corresponding passes can be returned to the pass management server by the M service servers acquiring the M passes, so that the total number of the passes in the pass management server can be kept to be M.
Through the steps, the service server of the pass response information can timely return the obtained pass, and the service server which does not obtain the pass response information can timely obtain the pass response information after the pass request information is sent again, and sends the data acquisition request according to the pass in the pass response information so as to acquire the data to be acquired.
Furthermore, through the step, the step of generating the pass does not need to be executed again under the condition that the number of the service servers and the number of the service control servers are not changed after the pass is generated, and the number of times of generating the pass is reduced.
In some examples, when the service server that acquires the pass response information sends a data acquisition request to the service control server and does not acquire the data to be acquired corresponding to the data acquisition request, an abnormal event log may be generated and the event that does not acquire the data to be acquired corresponding to the data acquisition request may be recorded.
Further, the abnormal event log may also record the time for sending the data acquisition request to the service control server, the identification information of the service control server, and the like.
An embodiment of the present invention further provides a data obtaining apparatus, which is applied to a passport management server, and as shown in fig. 4, is a schematic structural diagram of the data obtaining apparatus applied to the passport management server in the embodiment of the present invention, and the apparatus may include:
the first receiving module 401 is configured to receive N pass obtaining requests sent by N service servers, where each service server sends a pass obtaining request, each pass obtaining request carries identification information of a service server of a request sender to which the pass obtaining request belongs, and each pass obtaining request is sent to a pass management server when there is data to be obtained in the service server of the request sender to which the pass obtaining request belongs, where N is an integer greater than or equal to 1;
a first judging module 402, configured to judge whether N is greater than a preset number M of issued passes; wherein M is an integer greater than or equal to 1;
a selecting module 403, configured to select M pass acquisition requests from the N pass acquisition requests when N is greater than M, and acquire identification information of the M request sender service servers belonging to the M pass acquisition requests, where the identification information is carried in the M pass acquisition requests;
an adding module 404, configured to add M pre-stored passes to M pass response messages respectively;
the response module 405 is configured to send M pieces of pass response information to the service servers corresponding to the identification information of the M service servers of the request sender, respectively, so that each service server obtains the data to be obtained according to the pass response information.
Through the data acquisition device provided by the embodiment of the invention, after N pass acquisition requests sent by N service servers are received, whether N is larger than a preset pass issuing quantity M is judged, when N is larger than M, M pass acquisition requests are selected from the N pass acquisition requests, then identification information of M service servers carried in the M pass acquisition requests is acquired, M pre-stored passes are respectively added into M pass response information, and finally M pass response information is respectively sent to the service servers corresponding to the identification information of the service servers of the M request senders, so that each service server acquires data to be acquired according to the pass response information. Therefore, the number of the service servers which can simultaneously acquire the required data from the service control server can be automatically limited, and the pressure of the service control server is reduced.
Specifically, the data acquiring apparatus according to the embodiment of the present invention may further include:
the second receiving module is used for receiving the pass generation instruction;
and the storage module is used for generating M passes according to the pass generation instruction and the preset pass issuing quantity M, and storing the M passes.
Specifically, the data acquiring apparatus according to the embodiment of the present invention may further include:
the second judgment module is used for judging whether the pass generation instruction carries the distributed lock or not;
correspondingly, the storage module is specifically configured to:
when the distributed locks are carried in the pass generation instruction, M passes are generated according to the preset number M of the passes, and the M passes are stored.
Specifically, the storage module is specifically configured to:
adding M passes to a preset pass set;
correspondingly, the data acquisition apparatus according to the embodiment of the present invention may further include:
the mark state setting module is used for setting the mark state of the preset pass set to be a setting state;
correspondingly, each pass acquiring request is sent to the pass management server when the data to be acquired exists in each service server and the marking state of the preset pass set is confirmed to be a setting state.
An embodiment of the present invention further provides a data obtaining apparatus, which is applied to a service server, and as shown in fig. 5, is a schematic structural diagram of the data obtaining apparatus applied to the service server in the embodiment of the present invention, and the apparatus may include:
a first sending module 501, configured to send a pass obtaining request to a pass management server when there is data to be obtained, so that the pass management server constructs a pass response message including a pass according to the pass obtaining request and sends the pass response message to a service server;
a first receiving module 502, configured to, when receiving the pass response information sent by the pass management server, obtain a pass in the pass response information;
a second sending module 503, configured to add the pass to the data obtaining request, and send the data obtaining request to the service control server.
With the data acquisition device according to the embodiment of the present invention, before sending the data acquisition request, the pass acquisition request may be sent first, after the service server receives the corresponding information of the pass corresponding to the pass acquisition request sent by the pass management server, the pass is acquired from the pass response information, and then the data acquisition request is sent to the service control server according to the pass, so as to acquire the data to be acquired. Therefore, the number of the service servers which can simultaneously acquire the required data from the service control server can be automatically limited, and the pressure of the service control server is reduced.
Specifically, the data acquiring apparatus according to the embodiment of the present invention may further include:
the system comprises a mark state acquisition module, a password management module and a password processing module, wherein the mark state acquisition module is used for acquiring the mark state of a password set of a password in a password management server and storing the mark state;
correspondingly, the first sending module 501 is specifically configured to:
and when the marking state of the pass set is a setting state, sending a pass obtaining request to the pass management server.
Specifically, the data acquiring apparatus according to the embodiment of the present invention may further include:
the third sending module is used for sending a distributed lock acquisition request to the pass management server when the marking state of the pass set is a reset state;
the second receiving module is used for adding the distributed lock to the pass generation instruction after receiving the distributed lock response information carrying the distributed lock sent by the pass management server;
and the fourth sending module is used for sending the pass generation instruction carrying the distributed lock to the pass management server.
Specifically, the data acquiring apparatus according to the embodiment of the present invention may further include:
the dormancy setting module is used for entering dormancy according to first preset dormancy time when the pass response information corresponding to the pass obtaining request is not received; after the first preset sleep time is over, the first sending module 501 is triggered.
Specifically, the data acquiring apparatus according to the embodiment of the present invention may further include:
and the fifth sending module is used for sending the pass to the pass management server after receiving the data corresponding to the data acquisition request sent by the service control server.
An embodiment of the present invention further provides a passport management server, as shown in fig. 6, which is a schematic structural diagram of a passport management server to which a data acquisition method according to an embodiment of the present invention is applied, where the passport management server may include a processor 601 and a machine-readable storage medium 602, where the machine-readable storage medium 602 stores machine-executable instructions capable of being executed by the processor 601, and the processor 601 is caused by the machine-executable instructions to implement the following steps:
receiving N pass obtaining requests sent by N service servers;
judging whether N is larger than a preset number M of issued passes or not;
when N is larger than M, selecting M pass obtaining requests from the N pass obtaining requests, and obtaining identification information of M service servers carried in the M pass obtaining requests;
respectively adding M pre-stored passes to M pass response messages;
and respectively sending M pieces of pass response information to the service servers corresponding to the identification information of the M pieces of request sender service servers, so that each service server acquires the data to be acquired according to the pass response information.
Through the pass management server provided by the embodiment of the invention, after N pass acquiring requests sent by N service servers are received, whether N is larger than a preset pass issuing quantity M is judged, when N is larger than M, M pass acquiring requests are selected from the N pass acquiring requests, then identification information of M service servers carried in the M pass acquiring requests is acquired, M pre-stored passes are respectively added into M pass response information, and finally M pass response information is respectively sent to the service servers corresponding to the identification information of the service servers of the M request senders, so that each service server acquires data to be acquired according to the pass response information. Therefore, the number of the service servers which can simultaneously acquire the required data from the service control server can be automatically limited, and the pressure of the service control server is reduced.
An embodiment of the present invention further provides a service server, as shown in fig. 7, which is a schematic structural diagram of a data acquisition method applied to a service server according to an embodiment of the present invention, where the service server may include a processor 701 and a machine-readable storage medium 702, where the machine-readable storage medium 702 stores a machine-executable instruction capable of being executed by the processor 701, and the processor 701 is caused by the machine-executable instruction to implement the following steps:
when the data to be acquired exist, a pass acquiring request is sent to a pass management server, so that the pass management server constructs pass response information containing a pass according to the pass acquiring request and sends the pass response information to the service server;
when receiving the pass response information sent by the pass management server, acquiring a pass in the pass response information;
and adding the pass to the data acquisition request, and sending the data acquisition request to the service control server.
Through the service server of the embodiment of the present invention, before sending the data acquisition request, the pass acquisition request may be sent first, after the service server receives the corresponding information of the pass, which is sent by the pass management server and corresponds to the pass acquisition request, the pass is acquired from the pass response information, and then the data acquisition request is sent to the service control server according to the pass, so as to acquire the data to be acquired. Therefore, the number of the service servers which can simultaneously acquire the required data from the service control server can be automatically limited, and the pressure of the service control server is reduced.
The machine-readable storage medium may include Random Access Memory (RAM) and may also include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
The embodiment of the invention also provides a computer readable storage medium, which is applied to the pass management server, wherein a computer program is stored in the computer readable storage medium, and when the computer program is executed by a processor, the following steps are realized:
receiving N pass obtaining requests sent by N service servers;
judging whether N is larger than a preset number M of issued passes or not;
when N is larger than M, selecting M pass obtaining requests from the N pass obtaining requests, and obtaining identification information of M service servers carried in the M pass obtaining requests;
respectively adding M pre-stored passes to M pass response messages;
and respectively sending M pieces of pass response information to the service servers corresponding to the identification information of the M pieces of request sender service servers, so that each service server acquires the data to be acquired according to the pass response information.
Through the computer-readable storage medium provided by the embodiment of the invention, after N pass obtaining requests sent by N service servers are received, whether N is larger than a preset pass issuing quantity M is judged, when N is larger than M, M pass obtaining requests are selected from the N pass obtaining requests, then identification information of M service servers carried in the M pass obtaining requests is obtained, M pre-stored passes are respectively added to M pass response information, and finally M pass response information is respectively sent to the service servers corresponding to the identification information of the service servers of the M request senders, so that each service server obtains data to be obtained according to the pass response information. Therefore, the number of the service servers which can simultaneously acquire the required data from the service control server can be automatically limited, and the pressure of the service control server is reduced.
The embodiment of the present invention further provides a computer-readable storage medium, which is applied to a service server, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the following method steps are implemented:
when the data to be acquired exist, a pass acquiring request is sent to a pass management server, so that the pass management server constructs pass response information containing a pass according to the pass acquiring request and sends the pass response information to the service server;
when receiving the pass response information sent by the pass management server, acquiring a pass in the pass response information;
and adding the pass to the data acquisition request, and sending the data acquisition request to the service control server.
With the computer-readable storage medium according to an embodiment of the present invention, before sending the data acquisition request, the pass acquisition request may be sent first, after the traffic server receives the corresponding information of the pass corresponding to the pass acquisition request sent by the pass management server, the pass is acquired from the pass response information, and then the data acquisition request is sent to the traffic control server according to the pass, so as to acquire the data to be acquired. Therefore, the number of the service servers which can simultaneously acquire the required data from the service control server can be automatically limited, and the pressure of the service control server is reduced.
An embodiment of the present invention further provides a computer program product including instructions, which is applied to a pass management server, and when the computer program product runs on a computer, the computer program product causes the computer to execute the following steps:
receiving N pass obtaining requests sent by N service servers;
judging whether N is larger than a preset number M of issued passes or not;
when N is larger than M, selecting M pass obtaining requests from the N pass obtaining requests, and obtaining identification information of M service servers carried in the M pass obtaining requests;
respectively adding M pre-stored passes to M pass response messages;
and respectively sending M pieces of pass response information to the service servers corresponding to the identification information of the M pieces of request sender service servers, so that each service server acquires the data to be acquired according to the pass response information.
An embodiment of the present invention further provides a computer program product including instructions, which is applied to a service server, and when the computer program product runs on a computer, the computer program product causes the computer to execute the following steps:
when the data to be acquired exist, a pass acquiring request is sent to a pass management server, so that the pass management server constructs pass response information containing a pass according to the pass acquiring request and sends the pass response information to the service server;
when receiving the pass response information sent by the pass management server, acquiring a pass in the pass response information;
and adding the pass to the data acquisition request, and sending the data acquisition request to the service control server.
The embodiment of the invention also provides a computer program which is applied to the pass management server, and when the computer program runs on a computer, the computer program causes the computer to execute the following steps:
receiving N pass obtaining requests sent by N service servers;
judging whether N is larger than a preset number M of issued passes or not;
when N is larger than M, selecting M pass obtaining requests from the N pass obtaining requests, and obtaining identification information of M service servers carried in the M pass obtaining requests;
respectively adding M pre-stored passes to M pass response messages;
and respectively sending M pieces of pass response information to the service servers corresponding to the identification information of the M pieces of request sender service servers, so that each service server acquires the data to be acquired according to the pass response information.
The embodiment of the invention also provides a computer program, which is applied to the service server, and when the computer program runs on a computer, the computer is enabled to execute the following steps:
when the data to be acquired exist, a pass acquiring request is sent to a pass management server, so that the pass management server constructs pass response information containing a pass according to the pass acquiring request and sends the pass response information to the service server;
when receiving the pass response information sent by the pass management server, acquiring a pass in the pass response information;
and adding the pass to the data acquisition request, and sending the data acquisition request to the service control server.
An embodiment of the present invention further provides a data acquisition system, as shown in fig. 8, which is a schematic structural diagram of the data acquisition system according to the embodiment of the present invention, and the system may include: a pass management server 801, a service server 802, and a service control server 803;
the service server 802 is configured to send a pass acquisition request to a pass management server when there is data to be acquired, where the service server includes N number, where N is an integer greater than or equal to 1;
the pass management server 801 is configured to receive N pass acquisition requests sent by N service servers, determine whether N is greater than a preset pass issuing number M, select M pass acquisition requests from the N pass acquisition requests when N is greater than M, acquire identification information of M service servers carried in the M pass acquisition requests, add M pre-stored passes to the M pass response information, respectively send the M pass response information to a service server corresponding to the identification information of the affiliated M service servers of the request sender, where each pass acquisition request carries the identification information of the affiliated service server of the request sender, and M is an integer greater than or equal to 1;
the service server 802 is further configured to, when receiving the pass response information sent by the pass management server, obtain a pass in the pass response information, add the pass in the pass response information to the data acquisition request, and send the data acquisition request to the service control server;
the service control server 803 is configured to receive a data acquisition request sent by the service server, and send data to be acquired corresponding to the data acquisition request to the service server.
Through the data acquisition system provided by the embodiment of the invention, the pass management server can select M passes when the number N of pass acquisition requests sent by N service servers is greater than the preset number M of issued passes, and generates M pass response messages which are returned to the M service servers, so that the M service servers in the N service servers can acquire the passes from the received pass response messages, and send the data acquisition requests through the passes, and acquire the data to be acquired from the service control server, thereby automatically limiting the number of the service servers which acquire the data required by the service control server from the service control server, and further reducing the pressure of the service control server.
It is noted that, herein, relational terms such as first and second, and the like may be 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. Also, 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 an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.
Claims (23)
1. A data acquisition method is applied to a pass management server, and comprises the following steps:
receiving N pass obtaining requests sent by N service servers, wherein each service server sends a pass obtaining request, each pass obtaining request carries identification information of a service server of a request sending party, each pass obtaining request is sent to a pass management server when data to be obtained exist in the service server of the request sending party, N is an integer greater than or equal to 1, the service servers are virtual servers realized on one physical server through a virtual technology, and the physical server is provided with a plurality of service servers;
judging whether N is larger than a preset number M of issued passes or not; wherein M is an integer greater than or equal to 1;
when N is larger than M, selecting M pass obtaining requests from the N pass obtaining requests, and obtaining identification information of M request sender service servers which belong to the M pass obtaining requests;
respectively adding M pre-stored passes to M pass response messages;
and respectively sending the M pieces of pass response information to the service servers corresponding to the identification information of the service servers of the M request senders, so that each service server acquires the pass in the pass response information when receiving the pass response information sent by the pass management server, adds the acquired pass to the data acquisition request, and sends the data acquisition request to the service control server to acquire the data to be acquired.
2. The method of claim 1, wherein before said receiving N pass acquisition requests sent by N service servers, the method further comprises:
receiving a pass generation instruction;
and generating M passes according to the pass generation instruction and the preset pass issuing quantity M, and storing the M passes.
3. The method of claim 2, wherein after said receiving a pass generation instruction, the method further comprises:
judging whether the pass generation instruction carries a distributed lock or not;
correspondingly, according to the pass generation instruction, according to presetting the number M of issued passes, generating M passes, and storing M passes, include:
and when the distributed locks are carried in the pass generation instruction, generating M passes according to the preset number M of the issued passes, and storing the M passes.
4. The method of claim 2 or 3, wherein said step of storing said M passes comprises:
adding the M passes to a preset pass set;
after the adding the M passes to a preset set of passes, the method further comprises:
setting the marking state of the preset pass set as a setting state;
correspondingly, each pass acquiring request is sent to the pass management server when each service server has data to be acquired and the mark state of the preset pass set is confirmed to be a set state.
5. A data acquisition method is applied to a service server, and the method comprises the following steps:
when data to be acquired exist, a pass acquiring request is sent to a pass management server, so that the pass management server judges whether N is greater than a preset pass issuing quantity M or not when receiving N pass acquiring requests sent by N service servers, and when N is greater than M, M pass acquiring requests are selected from the N pass acquiring requests, and identification information of the service servers of M request sending parties belonging to the M pass acquiring requests is acquired; respectively adding M pre-stored passes to M pass response messages; respectively sending the M pieces of pass response information to service servers corresponding to the identification information of the M pieces of request sender service servers, wherein the service servers are virtual servers realized on one physical server through a virtual technology, and the physical server is provided with a plurality of service servers;
when the pass response information sent by the pass management server is received, obtaining a pass in the pass response information;
and adding the pass to a data acquisition request, and sending the data acquisition request to a service control server.
6. The method of claim 5, wherein prior to said sending a request for obtaining a passport to a passport manager server, the method further comprises:
acquiring a mark state of a pass set for storing the pass in the pass management server;
correspondingly, the sending of the pass acquiring request to the pass management server includes:
and when the marking state of the pass set is a setting state, sending a pass obtaining request to a pass management server.
7. The method of claim 6, wherein after said obtaining the tagged state of the set of passes for the pass is stored in the pass management server, the method further comprises:
when the marked state of the pass set is a reset state, sending a distributed lock acquisition request to the pass management server;
after receiving distributed lock response information carrying distributed locks sent by the pass management server, adding the distributed locks to a pass generation instruction;
and sending a pass generation instruction carrying the distributed lock to the pass management server.
8. The method of claim 5, wherein after sending the request for obtaining a pass to the pass management server, the method further comprises:
entering the sleep mode according to a first preset sleep time when the pass response information corresponding to the pass acquisition request is not received;
and after the first preset dormancy time is finished, repeatedly sending a pass obtaining request to the pass management server.
9. The method of claim 5, wherein after the sending the data acquisition request to a service control server, the method further comprises:
and after receiving the data corresponding to the data acquisition request sent by the service control server, sending the pass to the pass management server.
10. A data acquisition apparatus applied to a passport management server, the apparatus comprising:
the system comprises a first receiving module, a second receiving module and a third receiving module, wherein the first receiving module is used for receiving N pass obtaining requests sent by N service servers, each service server sends a pass obtaining request, each pass obtaining request carries identification information of the service server of a corresponding request sending party, each pass obtaining request is sent to a pass management server when data to be obtained exist in the service server of the corresponding request sending party, N is an integer greater than or equal to 1, the service servers are virtual servers realized on one physical server through a virtual technology, and the physical server is provided with a plurality of service servers;
the first judgment module is used for judging whether N is larger than the preset number M of issued passes or not; wherein M is an integer greater than or equal to 1;
the selection module is used for selecting M pass acquisition requests from the N pass acquisition requests when N is larger than M, and acquiring the identification information of the M request sender service servers which belong to the M pass acquisition requests;
the adding module is used for respectively adding the pre-stored M passes into the M pass response messages;
and the response module is used for respectively sending the M pieces of pass response information to the service servers corresponding to the identification information of the M service servers of the request sending party, so that each service server obtains the pass in the pass response information when receiving the pass response information sent by the pass management server, adds the obtained pass to the data acquisition request, and sends the data acquisition request to the service control server to acquire the data to be acquired.
11. The apparatus of claim 10, further comprising:
the second receiving module is used for receiving the pass generation instruction;
and the storage module is used for generating M passes according to the pass generation instruction and the preset pass issuing quantity M, and storing the M passes.
12. The apparatus of claim 11, further comprising:
the second judgment module is used for judging whether the pass generation instruction carries a distributed lock or not;
correspondingly, the storage module is specifically configured to:
and when the distributed locks are carried in the pass generation instruction, generating M passes according to the preset number M of the issued passes, and storing the M passes.
13. The apparatus according to claim 11 or 12, wherein the storage module is specifically configured to:
adding the M passes to a preset pass set;
correspondingly, the device further comprises:
the mark state setting module is used for setting the mark state of the preset pass set to be a setting state;
correspondingly, each pass acquiring request is sent to the pass management server when each service server has data to be acquired and the mark state of the preset pass set is confirmed to be a set state.
14. A data acquisition apparatus, applied to a service server, the apparatus comprising:
the system comprises a first sending module, a second sending module and a third sending module, wherein the first sending module is used for sending a pass obtaining request to a pass management server when data to be obtained exist, so that the pass management server judges whether N is larger than a preset pass issuing quantity M or not when receiving N pass obtaining requests sent by N service servers, and selects M pass obtaining requests from the N pass obtaining requests and obtains identification information of M request sender service servers belonging to the M pass obtaining requests when the N is larger than the M; respectively adding M pre-stored passes to M pass response messages; respectively sending the M pieces of pass response information to service servers corresponding to the identification information of the M pieces of request sender service servers, wherein the service servers are virtual servers realized on one physical server through a virtual technology, and the physical server is provided with a plurality of service servers;
the first receiving module is used for acquiring the pass in the pass response information when receiving the pass response information sent by the pass management server;
and the second sending module is used for adding the pass to the data acquisition request and sending the data acquisition request to the service control server.
15. The apparatus of claim 14, further comprising:
the system comprises a mark state acquisition module, a password acquisition module and a password processing module, wherein the mark state acquisition module is used for acquiring the mark state of a password set of the password in the password management server and storing the password;
correspondingly, the first sending module is specifically configured to:
and when the marking state of the pass set is a setting state, sending a pass obtaining request to a pass management server.
16. The apparatus of claim 15, further comprising:
a third sending module, configured to send a distributed lock acquisition request to the pass management server when the marked state of the pass set is a reset state;
the second receiving module is used for adding the distributed lock to the pass generation instruction after receiving the distributed lock response information carrying the distributed lock sent by the pass management server;
and the fourth sending module is used for sending the pass generation instruction carrying the distributed lock to the pass management server.
17. The apparatus of claim 14, further comprising:
the dormancy setting module is used for entering dormancy according to first preset dormancy time when the pass response information corresponding to the pass obtaining request is not received; and after the first preset sleep time is over, triggering the first sending module.
18. The apparatus of claim 14, further comprising:
and the fifth sending module is used for sending the pass to the pass management server after receiving the data corresponding to the data acquisition request sent by the service control server.
19. A passport management server, comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: carrying out the process steps of any one of claims 1 to 4.
20. A traffic server comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: -carrying out the process steps of any one of claims 5 to 9.
21. A computer-readable storage medium for a passport management server, having a computer program stored thereon, which, when being executed by a processor, carries out the method steps of any one of claims 1 to 4.
22. A computer-readable storage medium for a service server, the computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method steps of any of claims 5 to 9.
23. A data acquisition system, characterized in that the system comprises: the system comprises a pass management server, a service server and a service control server;
the service server is used for sending a pass acquisition request to the pass management server when data to be acquired exist, wherein the number of the service servers is N, and N is an integer greater than or equal to 1;
the pass management server is used for receiving N pass acquisition requests sent by N service servers, judging whether N is greater than a preset pass issuing quantity M, when N is greater than M, selecting M pass acquisition requests from the N pass acquisition requests, acquiring identification information of M service servers carried in the M pass acquisition requests, respectively adding M pre-stored passes into M pass response information, and respectively sending the M pass response information to the service servers corresponding to the identification information of the affiliated M service servers of the request sender, wherein each pass acquisition request carries the identification information of the affiliated service server of the request sender, and M is an integer greater than or equal to 1;
the service server is further configured to, when receiving the pass response information sent by the pass management server, acquire a pass in the pass response information, add the pass in the pass response information to a data acquisition request, and send the data acquisition request to the service control server;
and the service control server is used for receiving the data acquisition request sent by the service server and sending the data to be acquired corresponding to the data acquisition request to the service server.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711183112.5A CN108572870B (en) | 2017-11-23 | 2017-11-23 | Data acquisition method, device, electronic equipment, storage medium and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711183112.5A CN108572870B (en) | 2017-11-23 | 2017-11-23 | Data acquisition method, device, electronic equipment, storage medium and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108572870A CN108572870A (en) | 2018-09-25 |
CN108572870B true CN108572870B (en) | 2020-11-06 |
Family
ID=63575914
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711183112.5A Active CN108572870B (en) | 2017-11-23 | 2017-11-23 | Data acquisition method, device, electronic equipment, storage medium and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108572870B (en) |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102546532B (en) * | 2010-12-07 | 2016-03-30 | 中国移动通信集团公司 | Capacity calling method, request unit, platform and system |
CN103514164B (en) * | 2012-06-15 | 2016-12-21 | 阿里巴巴集团控股有限公司 | Data migration method and system |
CN105610934A (en) * | 2015-12-25 | 2016-05-25 | 北京奇虎科技有限公司 | Data request concurrency processing method and apparatus |
CN106843170B (en) * | 2016-11-30 | 2019-06-14 | 浙江中控软件技术有限公司 | Method for scheduling task based on token |
-
2017
- 2017-11-23 CN CN201711183112.5A patent/CN108572870B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN108572870A (en) | 2018-09-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20190123963A1 (en) | Method and apparatus for managing resources of network slice | |
US10225145B2 (en) | Method and device for updating client | |
WO2020052605A1 (en) | Network slice selection method and device | |
CN111130825B (en) | Network slice template generation method, device, equipment and storage medium | |
US10530726B2 (en) | Email notifications | |
CN108370328B (en) | Management method and device of NFV MANO policy descriptor | |
CN109756528B (en) | Frequency control method and device, equipment, storage medium and server | |
CN107276970B (en) | Unbinding and binding method and device | |
US20170126828A1 (en) | Sending Method and Apparatus and Computer Storage Medium of Notification Message | |
CN106533961B (en) | Flow control method and device | |
CN113127192A (en) | Method, system, device and medium for sharing same GPU by multiple services | |
US10219133B2 (en) | Notification message transmission method and device, and computer storage medium | |
CN106571933A (en) | Service processing method and device | |
US8224933B2 (en) | Method and apparatus for case-based service composition | |
CN110768818B (en) | Network management method and device | |
CN108572870B (en) | Data acquisition method, device, electronic equipment, storage medium and system | |
CN112260962A (en) | Bandwidth control method and device | |
CN101753561B (en) | Business cluster processing method and cluster system | |
CN105323186B (en) | Notification message load control method and device | |
CN115002117B (en) | Dynamic scheduling method, system, equipment and storage medium for content distribution network | |
CN113596105B (en) | Content acquisition method, edge node and computer readable storage medium | |
CN116389385A (en) | System resource processing method, device, storage medium and equipment | |
CN104580098B (en) | A kind of service sharing method and device | |
CN109005122A (en) | File transmitting method, device and the network equipment | |
CN114281476A (en) | Kubernetes cloud native cluster resource deletion protection method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |