CN114095576B - Call request sending method and device - Google Patents
Call request sending method and device Download PDFInfo
- Publication number
- CN114095576B CN114095576B CN202111387647.0A CN202111387647A CN114095576B CN 114095576 B CN114095576 B CN 114095576B CN 202111387647 A CN202111387647 A CN 202111387647A CN 114095576 B CN114095576 B CN 114095576B
- Authority
- CN
- China
- Prior art keywords
- call request
- request
- data security
- target
- security level
- 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
- 238000000034 method Methods 0.000 title claims abstract description 162
- 238000012545 processing Methods 0.000 claims abstract description 115
- 238000003860 storage Methods 0.000 claims description 38
- 238000004891 communication Methods 0.000 claims description 21
- 238000004590 computer program Methods 0.000 claims description 11
- 230000003139 buffering effect Effects 0.000 claims 1
- 239000000758 substrate Substances 0.000 claims 1
- 239000002699 waste material Substances 0.000 abstract description 5
- 230000008569 process Effects 0.000 description 77
- 230000004044 response Effects 0.000 description 23
- 238000010586 diagram Methods 0.000 description 13
- 230000006870 function Effects 0.000 description 11
- 238000011084 recovery Methods 0.000 description 5
- 230000007246 mechanism Effects 0.000 description 4
- 238000012546 transfer Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000013500 data storage Methods 0.000 description 3
- 230000005012 migration Effects 0.000 description 3
- 238000013508 migration Methods 0.000 description 3
- 230000001419 dependent effect Effects 0.000 description 2
- 238000012432 intermediate storage Methods 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 230000003111 delayed effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
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/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
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)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The embodiment of the invention provides a method and a device for sending a call request, which relate to the technical field of software and are applied to a request processing end, wherein the method comprises the following steps: generating a call request for calling a target service, wherein the target service is: the service to be called of the client embedded with the request processing end; sending the call request to the target service; and if the target service is determined to not successfully receive the call request, requesting preset network equipment to temporarily store the call request so that the network equipment forwards the call request to the target service. The proposal provided by the embodiment of the invention can reduce resource waste by sending the call request.
Description
Technical Field
The present invention relates to the field of software technologies, and in particular, to a method and an apparatus for sending a call request.
Background
With the development of software technology, there may be a service call demand for applications, various services, and the like to realize more abundant functions. Applications, services, etc. for which there is a service call need may be referred to as clients for ease of presentation. For example, the client a needs to call the service B in the execution flow, and obtains the execution result of the service B, so as to complete the execution flow according to the execution result of the service B.
In the prior art, a client a generally sends a call request to a service B through a specific process, so as to ensure that the client a successfully obtains an execution result of the service B, the client a can confirm whether the call request is successfully sent to the service B. Upon confirming that the call request was not successfully sent to service B, the specific process generally repeatedly sends the call request to service B at preset time intervals. Although the probability of successfully sending the call request to the service B can be improved, the resources of the specific process are occupied for a long time, and are difficult to be used for executing other tasks, so that the resource waste is caused.
Disclosure of Invention
The embodiment of the invention aims to provide a call request sending method and device so as to reduce resource waste. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for sending a call request, which is applied to a request processing end, where the method includes:
generating a call request for calling a target service, wherein the target service is: the service to be called of the client embedded with the request processing end;
sending the call request to the target service;
and if the target service is determined to not successfully receive the call request, requesting preset network equipment to temporarily store the call request so that the network equipment forwards the call request to the target service.
In a second aspect, an embodiment of the present invention provides a call request sending method, which is applied to a network device, and includes:
obtaining a call request for calling a target service, wherein the target service is: the method comprises the steps that a service to be called of a client embedded with a request processing end is provided, and the request processing end is used for generating a call request;
temporarily storing the call request;
sending the call request to the target service;
and if the target service is determined to not successfully receive the call request, migrating the call request to other network equipment so that the other network equipment temporarily stores the call request and forwards the call request to the target service, wherein the data security level of the other network equipment is higher than that of the network equipment.
In a third aspect, an embodiment of the present invention provides a call request sending device, which is applied to a request processing end, where the device includes:
the request generation module is used for generating a call request for calling a target service, wherein the target service is: the service to be called of the client embedded with the request processing end;
the first request sending module is used for sending the call request to the target service;
And the first request temporary storage module is used for requesting preset network equipment to temporarily store the call request if the target service is determined to not successfully receive the call request, so that the network equipment forwards the call request to the target service.
In a fourth aspect, an embodiment of the present invention provides a call request sending apparatus, which is applied to a network device, including:
the request acquisition module is used for acquiring a call request for calling a target service, wherein the target service is: the method comprises the steps that a service to be called of a client embedded with a request processing end is provided, and the request processing end is used for generating a call request;
the second request temporary storage module is used for temporarily storing the call request;
the second request sending module is used for sending the call request to the target service; and if the target service is determined to not successfully receive the call request, migrating the call request to other network equipment so that the other network equipment temporarily stores the call request and forwards the call request to the target service, wherein the data security level of the other network equipment is higher than that of the network equipment.
In a fifth aspect, an embodiment of the present invention provides a network device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any calling request sending method step when executing the program stored in the memory.
In a sixth aspect, an embodiment of the present invention provides a computer readable storage medium, in which a computer program is stored, the computer program implementing any one of the above-described call request sending methods when executed by a processor.
In a seventh aspect, embodiments of the present invention provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform any of the above-described call request sending methods.
In view of the above, in the solution provided by the embodiment of the present invention, the request processing end is embedded in the client, and when the client needs to call the target service, the request processing end generates a call request and sends the call request to the target service, so that a specific process corresponding to the client is not required to participate in the call of the target service, thereby saving the resources of the specific process.
In addition, in the scheme provided by the embodiment of the invention, when the request processing end determines that the target service does not successfully receive the call request, the call request is not retransmitted according to a certain time interval, but is temporarily stored in the preset network equipment, and the call request is forwarded to the target service by the preset network equipment, so that the resources of a specific process corresponding to the client are not occupied under the condition that the target service does not successfully receive the call request, and the resources of the specific process are further saved.
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.
Fig. 1 is a schematic diagram of a first network structure according to an embodiment of the present invention.
Fig. 2 is a flowchart of a first call request sending method according to an embodiment of the present invention.
Fig. 3a is a flowchart of a second call request sending method according to an embodiment of the present invention.
Fig. 3b is a schematic diagram of a scenario of a first call request sending method according to an embodiment of the present invention.
Fig. 4 is a flowchart of a third call request sending method according to an embodiment of the present invention.
Fig. 5a is a flowchart of a fourth call request sending method according to an embodiment of the present invention.
Fig. 5b is a schematic diagram of a scenario of a second call request sending method according to an embodiment of the present invention.
Fig. 6 is a flowchart of a fifth call request sending method according to an embodiment of the present invention.
Fig. 7a is a flowchart of a sixth call request sending method according to an embodiment of the present invention.
Fig. 7b is a schematic flow chart of a concurrency limit provided in an embodiment of the present invention.
Fig. 8 is a flowchart of a seventh call request sending method according to an embodiment of the present invention.
Fig. 9 is a schematic structural diagram of a first call request sending device according to an embodiment of the present invention.
Fig. 10 is a schematic structural diagram of a second call request sending device according to an embodiment of the present invention.
Fig. 11 is a schematic structural diagram of a third call request sending device according to an embodiment of the present invention.
Fig. 12 is a schematic structural diagram of a fourth call request sending device according to an embodiment of the present invention.
Fig. 13 is a schematic structural diagram of a network device for implementing a call request sending method according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the accompanying drawings in the embodiments of the present invention.
In the prior art, when a client needs to call a service, a problem of resource waste of a specific process of the client may exist due to long-term occupation of the specific process when a call request is sent to the service.
In one embodiment of the present invention, a call request sending method is provided, applied to a request processing end, and the method includes:
generating a call request for calling a target service, wherein the target service is: the service to be called of the client embedded with the request processing end;
sending the call request to a target service;
and if the target service is determined to not successfully receive the call request, temporarily storing the call request by the network equipment which is required to be preset, so that the network equipment forwards the call request to the target service.
In another embodiment of the present invention, there is also provided a call request sending method, applied to a network device, including:
obtaining a call request for calling a target service, wherein the target service is: the method comprises the steps that a service to be called of a client embedded with a request processing end is provided, and the request processing end is used for generating the call request;
Temporarily storing the call request;
sending the call request to a target service;
and if the target service is determined to not successfully receive the call request, migrating the call request to other network equipment so that the other network equipment temporarily stores the call request and forwards the call request to the target service, wherein the data security level of the other network equipment is higher than that of the network equipment.
In the scheme provided by the embodiment of the invention, the request processing end generates the call request and sends the call request to the target service, so that a specific process corresponding to the client is not required to participate in the call of the target service, and the resources of the specific process are saved; in addition, under the condition that the target service does not successfully receive the call request, the call request is temporarily stored in preset network equipment, and the call request is forwarded to the target service by the preset network equipment, so that resources of a specific process corresponding to the client are not occupied, and resources of the specific process are further saved.
The application scenario of the embodiment of the present invention and the call request sending scheme provided by the embodiment of the present invention are described in detail below with reference to the network structure schematic diagram shown in fig. 1.
Referring to fig. 1, the network includes a client, a target service located at a server, and a network device 1 and … ….
The client needs to call the target service of the server, and to achieve the target service call, a call request needs to be sent to the target service, and further call response of the target service is obtained to complete the call process. Specifically, the client is embedded with a request processing end, and the client can send a service call parameter to the request processing end, generate a call request by using the parameter by the request processing end, and send the call request.
In addition, the entire network may be divided into different areas, such as network area 1 … … network area N-1, network area N, and the like in FIG. 1. Different network devices exist in different network areas. The network area may be DC (Data Center), AZ (Available Zone), region, or full network area, which is not limited in the embodiment of the present invention.
The network areas are not isolated, the coverage of different network areas may be different, some network areas may be located within other network areas, for example, a whole network area may include multiple regions, multiple AZs may be included in a Region, and so on.
The network device may be configured to register and forward call requests. Network devices in different network areas may have different levels of data security; the data security level is used for indicating the security degree of the call request stored by the network equipment. The data security level may be expressed as a positive integer, for example, the higher the data security level is, the larger the corresponding integer may be, whereas the lower the data security level is, the smaller the corresponding integer may be. When judging the sizes of the two data security levels, the sizes of positive integers representing the two data security levels can be compared; the data security level may also be represented by letters and be relatively large in the order of letters representing the data security level in the alphabet, e.g., data security level a is greater than data security level B. In general, the greater the security level of data in a network device, the more secure it is considered that call requests or other types of data are stored in the network device and less prone to loss.
Referring to the interaction process shown by the arrow in fig. 1, S101, a request processing end first attempts to send a call request to a target service, and if the target service successfully receives the call request, the target of sending the call request in the scheme is completed; if the target service does not successfully receive the call request, the request processing end tries to forward the call request to the network device N with the highest data security level in all network devices. If the network device N successfully receives the call request, the network device N temporarily stores the call request, and forwards the call request to the target service as shown in S102 in fig. 1, so that the call request is successfully forwarded to the target service.
If the network equipment N does not successfully receive the call request, the request processing end sends the call request to the network equipment N-1 with the data security level lower than that of the network equipment N by one level; if the network device N-1 successfully receives the call request, the network device N-1 temporarily stores the call request, and forwards the call request to the target service as shown in S103 in fig. 1. When the network device N-1 forwards the call request to the target service, the call request may be sent to the target service first; if the target service does not successfully receive the call request, the call request is tried to be sent to the network equipment with the higher data security level than the target service according to the sequence from the higher data security level to the lower data security level.
If the network device N-1 does not successfully receive the call request, the call request is continuously sent to the network device N-2 with the data security level lower by one level. After that, if there is still a case that the network device fails to receive the call request, the attempt to send the call request is continued in the foregoing manner until the network device with the lowest data security level is not described herein.
From the above, according to the scheme provided by the embodiment of the invention, the client does not participate in the process of sending the call request, but the request processing end embedded in the client sends the call request, so that occupation of a client process is reduced, and resources of the client process are saved.
In addition, when the request processing end fails to send the request to the target service successfully, a series of network devices with different data security levels are used for forwarding the call request, and the network devices with higher data security levels are prioritized to forward the call request, so that the probability of losing the call request is reduced as much as possible, and the probability of finally being successfully received by the target service is increased.
The following describes concepts related to embodiments of the present invention.
Target service: the target service may be a micro service or a cloud service, which is not limited by the embodiment of the present invention. The target service is a provider of functions and data required to be called by a call request, and after receiving the call request, the target service can run a process corresponding to the target service according to information provided by the call request, obtain a call response corresponding to the call request, and return the call response to the client.
Client side: a client may be understood as a software end for providing a certain service to a user, and may also be referred to as a service end. Specifically, the service may be a service, for example, a video playing service, a commodity transaction service, or the like, and the service may also be an application software, which is not limited in the embodiment of the present invention.
A request processing end: the request processing side may be understood as a software side for sending call requests. The software end can implement a method specified by a network protocol, for example, the network protocol can be an HTTP protocol, the HTTP protocol specifies that the GET method can be used to send an HTTP call request, and defines a format in which the GET method sends the call request, and then the software end can generate and send the HTTP call request according to the format.
In one embodiment of the present invention, the request processing end may be presented in the form of an SDK (Software Development Kit ), so that the SDK corresponding to the request processing end may be directly embedded in the code of the client. When the target service needs to be called, the client can transmit the called parameters to the request processing end, and the request processing end generates a call request.
The call request sending method provided by the embodiment of the invention is described in detail below through a specific embodiment.
Referring to fig. 2, a flowchart of a first method for calling a request to send is provided, where the method is applied to a request processing end, and the method includes the following steps: S201-S203.
Step S201: a call request is generated for invoking the target service.
Wherein, the target service is: and the service to be called by the client of the request processing end is embedded.
The above-mentioned client may need a function which the client cannot realize in the working process, and then needs to be executed by other services with the function, and the other services are target services for the client. To obtain the execution result of the target service, the client may call the target service such that the target service returns the execution result to the client as a call response. The process resources are occupied when the client finishes the calling process, and the operation of other business functions is affected, so that the information required by the calling can be transmitted to the request processing end, and the request processing end finishes the calling process. If a commodity transaction client needs to use a target service with commodity information inquiry and auditing functions, for example, the client can transmit the address of the target service, the name of the commodity to be transacted, the inquiry method and other information to an embedded request processing end, the request processing end generates and sends a call request according to the transmitted information, and after receiving the call request, the target service inquires commodity price information in a database according to the information carried in the call request and returns an inquiry result to the client.
In one embodiment of the invention, the call request is a POST request specified by the HTTP protocol; the call request may also be a GET request, or other HTTP protocol specified request, or other type of network protocol specified request.
In one embodiment of the present invention, the call request may carry the URL (Uniform Resource Locator ) of the target service, and in some cases, the call request may also carry the encoding format of the sending request, the application name of the sending request, and so on.
Because the target service is a service that the client needs to call, the client may know the access information of the target service, and in this way, in one implementation manner, when the client needs to call the target service, the client may send the URL of the target service to the request processing end, and then the request processing end generates a call request carrying the URL of the target service.
In addition, various devices in the network may implement network communication based on HTTP, so in an embodiment of the present invention, the call request generated in the step S101 may be an HTTP request, and the request processing end may be a request processing end that implements data communication based on HTTP, and may also be referred to as an HTTP request processing end.
Step S202: and sending a call request to the target service.
In another embodiment of the present invention, the request processing end may correspondingly create a plurality of processes, and when sending a call request to the target service, the request processing end may place the call request into a message queue, and another process corresponding to the request processing end takes the call request out of the message queue and sends the call request, and after the call request is sent successfully, the target service returns call response information to the other process.
Step S203: and if the target service is determined to not successfully receive the call request, temporarily storing the call request by the preset network equipment, so that the preset network equipment forwards the call request to the target service.
The preset network device may be any network device capable of interacting with the target service in the network. For example, there may be the network devices located in the DC Region, the AZ Region, the Region, or the full network Region mentioned in the foregoing embodiments.
The preset temporary network equipment call request can be understood as: the preset network equipment stores the call request in a limited time, for example, the call request is put into a message queue and waits to be sent according to the queuing process of the queue; or after the call request is stored in the memory, a timer is used to set time for delaying retransmission of the call request, for example, 20 seconds and 2 minutes, and the call request is resent after the timing is finished.
When the preset network equipment temporarily stores the call request, the call request can be analyzed. For example, the data necessary for sending the request to the target service by traversing and searching the target address, the request body data, the identification of the judgment mode and the like from the call request. Because part of the information in the received call request is not used in the forwarding process mentioned later, for example, the address of the network equipment A exists in the call request sent to the network equipment A, but the address is not needed when the network equipment A sends the request to the target service, so that the whole content of the call request is directly temporarily stored, and the storage space is wasted because useless data is stored; and only placing the analyzed result into a message queue or writing the analyzed result into a file on a hard disk, and generating and sending a calling request which does not contain useless data according to the analyzed result when the calling request needs to be forwarded, wherein the functions and the characteristics of the calling request are equivalent to those of the calling request before the analysis is sent, so that the resource waste is reduced.
The specific implementation manner of determining that the target service does not successfully receive the call request in this step may be referred to as step S203A in the embodiment shown in fig. 3A, which is not described in detail herein.
From the above, when the scheme provided by the embodiment is applied to send the call request, the call request is generated by the request processing end embedded in the client, and the client does not generate the call request. The process of sending the call request is that the request processing end sends the call request, and if the target service does not successfully receive the call request, the preset network equipment is requested to temporarily store the call request; after the preset network equipment temporarily stores the call request, forwarding the call request to the target service. Therefore, the client runs the own service process and waits for the call response, and does not participate in the process of sending the request, and does not participate in the process of temporarily storing the call request after the request processing end sends the call request to the target service unsuccessfully, so that the resources of the client and the service process are saved.
In addition, under the condition that the request processing end sends a call request and the target service does not successfully receive the call request, the network equipment is requested to temporarily store the call request, so that the probability of losing the call request can be effectively reduced; the network device forwards the call request to the target service, so that the sending result of the call request is not only dependent on the result of the call request sent by the request processing end, and the retransmission process increases the success probability of the call request.
Furthermore, the network equipment is used for forwarding the call request instead of the client, so that the cost of the client is saved; the network equipment is used for temporarily storing the call requests, so that excessive call request accesses in a short time cannot exceed the upper limit of the number of call requests which can be processed by the server, and the working stability of the server can be improved.
The following describes a procedure for scheduling a target service by means of specific embodiments.
In one embodiment of the present invention, the client may be an application with a video playing function, where the video file needs to be converted into a coding format supported by the application through a transcoding service; the target service may be a transcoding service. The application transmits the address of the server of the transcoding service and the video file to be transcoded as parameters to a request processing end, and the request processing end sends a calling request;
when the call request sent by the request processing end is not received by the transcoding service, the request processing end sends the call request to preset network equipment, such as a server or one equipment in a computer cluster; the network device receives the call request and stores the call request by using the cache, and resends the call request to the transcoding service after a period of time until the call request is successfully received by the transcoding service.
In order to send the call request to the preset network device, the request processing end needs to configure the address of the network device. These address information may be stored in a list; the address of the network equipment can be automatically configured through the technologies of DNS (Domain Name System ) or service discovery and the like, wherein the mapping relation exists between the domain name and the IP address, so that the domain name can be queried, and the corresponding IP address can be obtained as the address of the network equipment with the domain name; the acquisition of the network device address by service discovery is understood to mean that a service provider having a target service registers in a server acting as an intermediary, a client requiring the service accesses the intermediary, and the intermediary returns the address of the target service from the registration information. The present embodiment does not limit the manner in which the network device address is obtained.
The application can assign a callback address, receive the call response of the transcoding service, and access the callback address to obtain the result after the transcoding of the video file is completed according to the call response information. The callback address may be some URL specifying the jump page.
In an embodiment of the present invention, referring to fig. 3A, a flowchart of a second method for sending a call request is provided, and in this embodiment, if it is determined that the target service does not successfully receive the call request, step S203 requests a preset network device to temporarily store the call request, so that the preset network device forwards the call request to the target service, which may be implemented by the following steps S203A-S203C, compared with the embodiment shown in fig. 2.
Step S203A: and determining that the target service does not successfully receive the call request.
In the implementation process, the unsuccessful receiving of the call request by the target service can be determined in different manners, and the following description is made by three different implementation manners.
In one implementation, whether the target service successfully receives the call request can be determined through response information of the target service. For example, the target service may send an acknowledgement message directly back to the client when receiving the call request, where the acknowledgement message includes an ACK field, and when the client parses the ACK field, the client may determine that the target service successfully receives the call request, and notify the request processing end of the determination result. The confirmation message may not contain the results of the target service processing the call request and may be sent out within a preset time period after the call request is received so that the client reacts faster instead of waiting for the call request to be processed before getting call response information.
In another implementation, a determination may be made as to whether the invocation request was successfully received by the target service based on the request expiration time. Specifically, after the request processing end sends the call request, the waiting time timing can be started, and if the call response fed back by the target service is received, the timing is ended. In the timing process, if the waiting time reaches the preset request expiration time, the target service can be considered to be unsuccessful in receiving the call request, otherwise, if the call response is received before the waiting time reaches the request expiration time, the target service can be considered to be successful in receiving the call request. For example, the request expiration time may be 10 seconds, 30 seconds, 5 minutes, etc.
In still another implementation manner, a specified judgment manner corresponding to the target service may be determined, and then, whether the target service successfully receives the call request is judged based on the specified judgment manner.
Specifically, in one case, the identifier of the specified judgment mode corresponding to the target service may be obtained according to the preset correspondence between the service and the identifier of the judgment mode, and then the specified judgment mode corresponding to the target service may be determined according to the obtained identifier.
The identification of the judging mode can be set different modes for specifying how to judge that the call request is successfully sent according to different target services.
For example, if the identifier of the specified judgment mode corresponding to the target service is the identifier of the response status code, the request processing end can judge whether the target service receives the call request through the response status code fed back by the target service. If the request processing end receives the response status code 404, the target service is considered to not find the requested web page, and it may be determined that the request processing end sends the call request unsuccessfully, that is, the target service fails to receive the call request successfully. If the identification of the specified judgment mode corresponding to the target service is the identification of the response content, the request processing end can judge whether the target service receives the call request or not through the response content fed back by the target service. If the response content received by the request processing end has an OK word, the request processing end can be judged to send the call request successfully, that is, the target service successfully receives the call request.
The above-mentioned various judgment modes may be preset numbers, for example, 1 is the identification of the response status code, 2 is the identification of the response content, and the various judgment modes may also be a character string for identifying the semantic meaning, for example, "status code" is the identification of the response status code.
In another case, the identification of the above-mentioned judgment manner may be specified by the client. In this case, the client may carry the identification of the judgment manner as one of the parameters in the call request and send the call request to the request processing end. After receiving the call request, the request processing end analyzes the identification of the judging mode from the call request, and after the target service feeds back the call response, judges whether the target service successfully receives the call request according to the mode indicated by the identification.
Step S203B: and sending a call request to target network equipment with the target data security level in the preset network equipment.
Specifically, there may be a plurality of preset network devices having different data security levels, so that when the target service does not successfully receive the call request, a specific data security level may be selected as the target data security level, and the call request may be sent to the network device having the target data security level.
The initial value of the target data security level is the highest data security level, and the call request is preferentially sent to the network device of the data security level, so that the call request is stored as safely as possible.
In one embodiment of the present invention, the preset network device may be one or more devices capable of temporarily storing the call request, and the devices may communicate through a network. The devices may be a machine, or a cluster of computers, etc.
The network equipment can temporarily store the call request by using a storage mode with relatively high safety such as forced data disc drop, two-place three-center deployment, data disaster recovery and the like, and the call request is prevented from being lost. The network device may store the call request in other manners for guaranteeing data security.
Step S203C: if the target network device does not successfully receive the call request and the target data security level is not the lowest data security level, setting the target data security level to be one-level lower data security level. The process returns to step S203B.
If the condition "the target network device does not successfully receive the call request and the target data security level is not the lowest data security level" in step S203C is not satisfied, one of the following two cases will occur: in the first case, if the target network device successfully receives the call request, whether the target data security level is the lowest data security level or not; the second case is that the target network device did not successfully receive the call request and the target data security level is the lowest data security level. In both cases, the call request may continue to be forwarded by the target network device to the target service.
In one embodiment of the present invention, after the security level of the target data is reduced to the lowest data security level, at this time, the further reduction of the security level of the target data may result in no network device capable of sending the call request to the target service, so that the network device with the lowest security level of the target data may be disposed on the physical machine where the client and the request processing end are located, and since the same physical machine does not have a network failure, the call request can always be received by the network device with the lowest data security level, and the call request is not lost.
The data security level may be preset according to experience of a worker, or may be set according to a network area where the network device is located, which is described in detail in the following embodiments.
In one embodiment of the present invention, the data security level set to the lower level may be the target data security level is subtracted, for example, the target security level 8 is adjusted to 7.
If the network device does not receive the call request, the step S203B is executed again, that is, the call request is sent to the target network device with the target data security level, and if the target network device does not successfully receive the call request, the target security level is continuously adjusted, and the above procedure is repeated. Since the target data security level is actually updated, there is no constant attempt to send a call request to the same network device, resulting in the call request not being successfully received at all times, but instead being sent to different network devices in the order of the data security level from high to low, and then being sent to the target service by different network devices until the call request is received.
In one embodiment of the invention, the level of data security increases as the network area to which the network device belongs increases.
Network devices within different network areas may have different levels of data connectivity. The data connectivity level may be a series of positive integers. Because more routers are more likely to be traversed when call requests are sent over a larger network area, and the risk of network outages increases for every router that spans, the likelihood of failure across the regional network, such as operator failure, optical failure, etc., is high, and therefore the level of data connectivity may decrease as the network area increases. In view of the above, in the present embodiment, the data integrity level is set to rise as the network area of the network device increases, and the accuracy of the set data security level can be improved.
In addition, the data connection level may be preset according to the experience of the staff, which is not limited in the embodiment of the present invention.
In connection with the foregoing, it will be appreciated that the highest data connectivity level network device may be the lowest data security level network device. The network device with the lowest data security level may be a physical machine node, and the network device with the lowest data security level and the client that sends the call request, the request processing end, are located at the physical machine node. This node can be used to address the problem of transient failures of the physical machine network, such as pulling out the network cable of the physical machine node. For the process, the same physical machine is not easy to generate any network non-communication faults, so that when the physical machine network fails, the call request can be temporarily stored by the network equipment.
The above procedure is described with reference to fig. 3b, where the portion indicated by the service code in fig. 3b represents the client, and the target URL and the request Body information (Body in fig. 3) and the success identifier are sent as parameters to the request processing end, so as to generate the call request. Wherein the successful identifier represents the identifier of the above judgment mode. The request processing end firstly sends a call request to the target server and carries out successful judgment, namely judges whether the target service successfully receives the call request. If the call request is not successfully received, the target data security level is reduced according to the steps, the call request is sent to the intermediate storage 1 with one level lower data security level, and if the call request is unsuccessful, the call request is sent to the intermediate storage 2 with lower data security level. The sending sequence of the call requests can be seen that the call requests are stored in the network equipment with higher data security level with higher probability, and the call requests are located in a larger network area with higher probability, so that the call request storage security can be increased maximally.
From the above, when the solution provided by the present embodiment is applied to send a call request, after the request processing end fails to send the call request to the target service, the request processing end requests the network device to temporarily store the call request. And the network equipment has different data security levels, when the network equipment is requested to be temporarily stored, the client side can preferentially select the network equipment with the highest data security level, the data security level is reduced only when the request is unsuccessful, and the network equipment with the different data security levels is selected according to the sequence from the high data security level to the low data security level.
In addition, in the case that the call request is not successfully received by the target service, because the request processing end preferentially requests the network device with the highest data security level to temporarily store the call request, compared with the network device with the lower data security level, the call request which is not successfully received by the target service is temporarily stored in the network device with the highest data security level with higher probability, especially in the case that a non-network fault such as downtime of the target server occurs, the call request which is not successfully sent to the target service is concentrated in the network device with the highest data security level with high probability. The centralized storage mode is convenient for collecting the data of the call request during data statistics, maintenance and obstacle removal; and the network equipment in the call request set is selected to set the concurrency mechanism when the concurrency restriction is carried out, so that the concurrency amount of the call requests in the network can be effectively reduced, and the number of network equipment needing to set the concurrency restriction mechanism is further reduced.
Furthermore, the call request is used for communicating with the target service, so that the method has better universality than the prior art that the message queue is used for communicating with the target service, the problems of excessive message queue products and non-uniform protocols are solved, and the authentication process using the call request is simpler than the authentication process using the message queue.
In an embodiment of the present invention, referring to fig. 4, a flowchart of a third call request sending method is provided, and compared with the embodiment shown in fig. 2, in this embodiment, before executing step S201 to generate a call request for calling a target service, the following step S200 is executed:
step S200: and receiving the service call parameters sent by the client.
Since the client needs to use the target service, the request processing end does not generate relevant information of the call request, such as an address of the target service, before generating the call request, so that the client sets the relevant information as a parameter to be sent to the request processing end, and the client completes the task of generating and sending the call request. The parameters are service call parameters. That is, after receiving the service call parameter sent by the client, the request processing unit generates a call request for calling the target service according to the service call parameter, that is, performs step S201 described above.
Wherein, the service call parameters include: the identification of the judging mode and/or the request expiration time length. The judgment mode is as follows: means for determining whether the call request was successfully received by the target service.
In addition, the service invocation parameters may also include the address of the target service, the service name, the type of data contained in the invocation request, etc.
Because the service call parameters used for generating the call request are provided by the client in the scheme provided by the embodiment, and because the client wants to use the service provided by the target service, the client can provide accurate service call parameters for the request processing end, so that the request processing end can generate an accurate call request, and the probability of successful sending of the call request is improved.
Corresponding to the call request sending method applied to the request processing end, the embodiment of the invention also provides a call request sending method applied to the network equipment.
In one embodiment of the present invention, referring to fig. 5a, a flowchart of a fourth call request sending method is provided, and applied to a network device, the method includes the following steps: S501-S504.
Step S501: a call request for invoking a target service is obtained.
In one embodiment of the invention, the call request sent by the request processing end or other network device may be received by calling a target API (Application Programming Interface, application program interface). The target API is used for realizing a method specified by the network protocol.
For example, when the call request is an HTTP request, the target API may implement a method related to request receiving specified by the HTTP protocol, for example, a GET method, so that the network device calls the target API to determine a field in the received request, where the field value is "GET", and considers that the call request is received, so that the call request is obtained.
Step S502: temporarily storing the call request.
The network device stores the call request in its own storage resource, and the storage duration may be a preset storage duration. The call request storage may be implemented by referring to the method of temporarily storing the call request by the network device preset in step S203.
Step S503: and sending a call request to the target service.
In one embodiment of the present invention, after receiving the call request, the network device may store the call request in a message queue, and then when the call request is at the head of the queue, take the call request out of the head of the queue, and send the call request to the target service. The manner of sending the call request is similar to step S202, and will not be described in detail.
Step S504: and if the target service is determined to not successfully receive the call request, migrating the call request to other network equipment so that the other network equipment temporarily stores the call request and forwards the call request to the target service.
The data security level of other network devices is higher than that of the network devices.
The migration process refers to: and after the call request is successfully received by the other network equipment, the call request is not reserved in the current network equipment, and is stored by the other network equipment. The specific migration method can be referred to steps S504A-S504C in the embodiment shown in fig. 6, and will not be described again.
In one embodiment of the present invention, the network device may locally store a list of transmission parameters, where addresses of different network devices are stored, and may also store data security levels of different network devices.
Reference is also made here to the embodiment shown in fig. 5b, in which the API, message queue and sending means are part of the network device described above. The API is an API in the network equipment and is used for obtaining a call request for calling the target service. After obtaining the call request, the call request is put into a message queue, and the process of temporarily storing the call request is completed. Because the messages in the message queue are continually fetched, sent to the sending device in the figure, and sent to the target server or other network device, the invocation request is stored only for a period of time in the message queue, and therefore is considered to be temporarily stored in the network device. The sending means in fig. 5b is used to send a call request to the target service. The transmitting means may be a request processing end for transmitting the call request, similar to the request processing end described in the foregoing step S201. After the sending device takes out the call request in the message queue, the sending device sequentially tries to send the call request to the target server, the full-network temporary storage device and the high-level temporary storage device shown in the figure until the call request is successfully received by one of the devices. The target server is a server providing a target service, the whole-network temporary storage device is a network device with the highest data security level, and the data security level of the high-level temporary storage device is lower than that of the whole-network temporary storage device and higher than that of the network device where the sending device is located in the figure. Therefore, when the target service does not successfully receive the call request, the call request is migrated to other network equipment, so that the other network equipment temporarily stores the call request and forwards the call request to the target service.
From the above, when the solution provided by the present embodiment is applied to send a call request, the network device temporarily stores the call request under the condition that the request processing end is not able to send the call request to the target service successfully, and the network device sends the call request to the target service, which means that the process does not need to send the call request to the target service continuously by the request processing end, nor does the client end send the call request to the target service.
In addition, the network equipment which obtains the call request temporarily stores the call request and then sends the call request, so that the delay retry process is realized, concurrency can be limited, normal operation of the target service is ensured, the security of the data storage of the request can be ensured by temporarily storing the call request, and the call request is prevented from being lost.
Furthermore, if the target service does not successfully receive the call request, the network device temporarily storing the call request will migrate the call request to the network device with the data security level higher than that of the network device and forward the call request. The process ensures that the storage mode of the call request in the temporary storage process is safer than the storage mode of the call request in the same network equipment which is temporarily stored all the time, and the probability that the call request is finally successfully received by the target service is increased by forwarding the call request again.
In an embodiment of the present invention, referring to fig. 6, a flowchart of a fifth call request sending method is provided, and compared with the embodiment shown in fig. 5a, in this embodiment, if it is determined that the target service does not successfully receive the call request, the step S504 of migrating the call request to other network devices so that the other network devices temporarily store the call request and forward the call request to the target service includes the following steps S504A-S504E:
step S504A: and determining that the target service does not successfully receive the call request.
Step S504B: and if the data security level of the network equipment is not the target data security level, sending a call request to the target network equipment with the target data security level in other network equipment.
The initial value of the target data security level is the highest data security level among the data security levels.
Step S504C: and if the target network equipment does not successfully receive the call request, setting the target data security level to be one-level lower data security level. The process returns to step S504B.
The method for determining that the target network device does not successfully receive the call request may refer to step S203A.
As above, after the target service is judged to not successfully receive the call request, it is required to judge that the data security level of the current network device is not the target data security level, if yes, it means that no network device with higher data security level is available, that is, the data security is guaranteed to the call request most in the current network device, so that migration is not performed; if not, sending a call request to the network device with the target security level, if the network device does not receive the call request, adjusting the target security level, and returning to execute step S504B, that is, sending the call request to the target network device with the target data security level in other network devices. If the target network equipment does not successfully receive the call request, continuing to adjust the target security level, and repeating the process. Because the target data security level is actually updated, no attempt is made to send a request to the same network device at all times, resulting in a call request not being successfully received at all times, but instead to send call requests to different network devices in the order of the data security level from high to low until either a call request is received or the current device's data security level is the adjusted target data security level. The above procedure causes the current network device to migrate call requests to all network devices with higher data security levels.
In view of the above, in the solution provided in this embodiment, on one hand, it is first determined whether there is a network device with a data security level meeting the condition, and this step may be omitted when checking that there is no network device that can be used for transfer, so as to save processing resources of the network device.
On the other hand, if the call request can be transferred to the network equipment with higher data security level, the transfer of the call request is performed, so that the security storage of the call request is facilitated.
In an embodiment of the present invention, referring to fig. 7a, a flowchart of a sixth call request sending method is provided, and in this embodiment, before the step S503 sends a call request to a target service, the method further includes the following step S505:
step S505: judging whether the current call concurrency of the target service is smaller than the preset maximum call concurrency; if yes, step S503 is executed.
The concurrency amount is understood to be an access amount of accessing the target service simultaneously.
In one embodiment of the invention, a concurrency record table may be provided, which records the maximum call concurrency addressed to different target services. The table may record a value that indicates the current call concurrency, which is incremented each time a call request is sent. The added value may be 1 or other values. The table can record the current call concurrency and the maximum call concurrency corresponding to each IP address, can record the current call concurrency and the maximum call concurrency corresponding to each domain name, or calculates the result of the IP address or the domain name by using a hash algorithm to obtain a hash value, and records the current call concurrency and the maximum call concurrency corresponding to the hash value.
In another embodiment of the present invention, concurrency locks may be used to control the current call concurrency. Wherein, concurrent lock can be understood as: an identification to limit the amount of concurrency, and process resources with this identification are not available to other processes or threads. Referring to fig. 7b, the network device sends the call request, and the sending device fetches the call request from the message queue and sends the call request, and the specific process may refer to the embodiment shown in fig. 5b, which will not be described in detail herein. Before sending a call request to a target server, distributing concurrent locks for the call request, wherein the number of the concurrent locks is the maximum concurrent quantity, and only the call request for obtaining the concurrent locks is sent. Thus, the number of concurrent locks corresponds to the maximum call concurrency, and the number of assigned concurrent locks corresponds to the current call concurrency.
Because the number of concurrent locks is the maximum amount of concurrency and can be set to be released after a period of time after the call request is sent and can be allocated to the next call request, it is ensured that the call request that the target server can receive from the current network device does not exceed the maximum amount of concurrency during the period of time, and thus a concurrency limit is formed.
In view of the above, in the solution provided in this embodiment, before sending a call request to a target service, the current call concurrency of the target service is determined, and the call request is sent only when the current call concurrency is less than the maximum call concurrency; therefore, concurrency limitation can be effectively carried out, the problem that the target service cannot work normally due to the fact that backlog excessive call requests are completely sent at the moment of target service recovery is avoided, and the stability of the target service is improved.
In one embodiment of the invention, the call request may be staged using a message queue. The message queue may be a Kafka message queue, a RocketMQ message queue, etc.;
in an embodiment of the present invention, referring to fig. 8, a flowchart of a seventh call request sending method is provided, and compared with the embodiment shown in fig. 5, in this embodiment, the step of temporarily storing the call request in S502 includes the following step S502A:
step S502A: the call request is temporarily stored in a message queue in the network device.
For example, the message queue may be a first-in first-out queue, i.e. a call request newly entered into the queue is placed at the end of the message queue, and the call request must undergo the queuing process of the message queue, i.e. after waiting for all other call requests entered into the message queue prior to the call request to be fetched from the head of the queue, the call request is fetched and subjected to the conditional sending process described in step S505.
On the basis of the above, the call request sending method further comprises the following steps:
step S506: and if the current call concurrency is not less than the maximum call concurrency, migrating the call request from the head of the message queue to the tail of the message queue.
Referring to step S505, the call request is moved from the head of the queue to the tail of the queue, which corresponds to a process of queuing the message queue once again, and the above-mentioned process of concurrency determination is performed again after the completion of the round of queuing process. The process ensures that the call request is not sent all the time when the current call concurrency is not smaller than the maximum concurrency, and the call request is continuously delayed through the queuing process, so that concurrency limit is formed.
The queuing process needs time to wait for other calling requests which are queued in front in the message queue to be dequeued first, so that the sending process of the calling requests is not performed too frequently.
In view of the above, in the solution provided in this embodiment, the call request is temporarily stored by using the message queue, and when the current call concurrency is greater than the maximum call concurrency, the position of the call request in the message queue is adjusted to be re-queued. The message queue is used for temporarily storing the call request, so that the function of time delay retry can be realized, sufficient time is provided for waiting for the recovery of the target service through the queuing process of the message queue, the concurrency of the call request is reduced, and the stability of the target service is further improved.
Corresponding to the call request sending method applied to the request processing end, the embodiment of the invention also provides a call request sending device.
Referring to fig. 9, a schematic structural diagram of a first call request sending device is provided, and the first call request sending device is applied to a request processing end, and the device includes:
a request generation module 901, configured to generate a call request for calling a target service, where the target service is: the service to be called of the client embedded with the request processing end;
a first request sending module 902, configured to send the call request to the target service;
the first request temporary storage module 903 is configured to request a preset network device to temporarily store the call request if it is determined that the target service does not successfully receive the call request, so that the network device forwards the call request to the target service.
From the above, when the scheme provided by the embodiment is applied to send the call request, the call request is generated by the request processing end embedded in the client, and the client does not generate the call request. The process of sending the call request is that the request processing end sends the call request, and if the target service does not successfully receive the call request, the preset network equipment is requested to temporarily store the call request; after the preset network equipment temporarily stores the call request, forwarding the call request to the target service. Therefore, the client runs the own service process and waits for the call response, and does not participate in the process of sending the request, and does not participate in the process of temporarily storing the call request after the request processing end sends the call request to the target service unsuccessfully, so that the resources of the client and the service process are saved.
In addition, under the condition that the request processing end sends a call request and the target service does not successfully receive the call request, the network equipment is requested to temporarily store the call request, so that the probability of losing the call request can be effectively reduced; the network device forwards the call request to the target service, so that the sending result of the call request is not only dependent on the result of the call request sent by the request processing end, and the retransmission process increases the success probability of the call request.
Furthermore, the network equipment is used for forwarding the call request instead of the client, so that the cost of the client is saved; the network equipment is used for temporarily storing the call requests, so that excessive call request accesses in a short time cannot exceed the upper limit of the number of call requests which can be processed by the server, and the working stability of the server can be improved.
In one embodiment of the present invention, the preset network device includes a plurality of network devices with different data security levels;
the first request temporary storage module 903 is specifically configured to send the call request to a target network device having a target data security level in the preset network devices if it is determined that the target service does not successfully receive the call request, where an initial value of the target data security level is: the highest data security level; if the target network equipment does not successfully receive the call request and the target data security level is not the lowest data security level, setting the target data security level to be one-level lower data security level; and returning to the step of sending the call request to the target network equipment with the target data security level in the preset network equipment, so that the network equipment forwards the call request to the target service.
From the above, when the solution provided by the present embodiment is applied to send a call request, after the request processing end fails to send the call request to the target service, the request processing end requests the network device to temporarily store the call request. And the network equipment has different data security levels, when the network equipment is requested to be temporarily stored, the client side can preferentially select the network equipment with the highest data security level, the data security level is reduced only when the request is unsuccessful, and the network equipment with the different data security levels is selected according to the sequence from the high data security level to the low data security level.
In addition, in the case that the call request is not successfully received by the target service, because the request processing end preferentially requests the network device with the highest data security level to temporarily store the call request, compared with the network device with the lower data security level, the call request which is not successfully received by the target service is temporarily stored in the network device with the highest data security level with higher probability, especially in the case that a non-network fault such as downtime of the target server occurs, the call request which is not successfully sent to the target service is concentrated in the network device with the highest data security level with high probability. The centralized storage mode is convenient for collecting the data of the call request during data statistics, maintenance and obstacle removal; and the network equipment in the call request set is selected to set the concurrency mechanism when the concurrency restriction is carried out, so that the concurrency amount of the call requests in the network can be effectively reduced, and the number of network equipment needing to set the concurrency restriction mechanism is further reduced.
Furthermore, the call request is used for communicating with the target service, so that the method has better universality than the prior art that the message queue is used for communicating with the target service, the problems of excessive message queue products and non-uniform protocols are solved, and the authentication process using the call request is simpler than the authentication process using the message queue.
In one embodiment of the present invention, the data security level increases as the network area to which the network device belongs increases.
In view of the above, in the present embodiment, the data integrity level is set to rise as the network area of the network device increases, and the accuracy of the set data security level can be improved.
In one embodiment of the present invention, referring to fig. 10, there is provided a schematic structural diagram of a second call request sending apparatus, the apparatus further including:
the parameter receiving module 900 is configured to receive a service call parameter sent by a client before the request generating module generates the call request, where the service call parameter includes: the method comprises the steps of judging the identification and/or the request expiration time of a mode, wherein the judging mode is as follows: means for determining whether the call request was successfully received by the target service.
Because the service call parameters used for generating the call request are provided by the client in the scheme provided by the embodiment, and because the client wants to use the service provided by the target service, the client can provide accurate service call parameters for the request processing end, so that the request processing end can generate an accurate call request, and the probability of successful sending of the call request is improved.
Corresponding to the call request sending method applied to the network equipment, the embodiment of the invention also provides a call request sending device applied to the network equipment.
Referring to fig. 11, there is provided a schematic structural diagram of a third call request transmitting apparatus, which is applied to a network device, the apparatus including:
a request obtaining module 1101, configured to obtain a call request for calling a target service, where the target service is: the method comprises the steps that a service to be called of a client embedded with a request processing end is provided, and the request processing end is used for generating a call request;
a second request temporary storage module 1102, configured to temporarily store the call request;
a second request sending module 1103, configured to send the call request to the target service; and if the target service is determined to not successfully receive the call request, migrating the call request to other network equipment so that the other network equipment temporarily stores the call request and forwards the call request to the target service, wherein the data security level of the other network equipment is higher than that of the network equipment.
From the above, when the solution provided by the present embodiment is applied to send a call request, the network device temporarily stores the call request under the condition that the request processing end is not able to send the call request to the target service successfully, and the network device sends the call request to the target service, which means that the process does not need to send the call request to the target service continuously by the request processing end, nor does the client end send the call request to the target service.
In addition, the network equipment which obtains the call request temporarily stores the call request and then sends the call request, so that the delay retry process is realized, concurrency can be limited, normal operation of the target service is ensured, the security of the data storage of the request can be ensured by temporarily storing the call request, and the call request is prevented from being lost.
Furthermore, if the target service does not successfully receive the call request, the network device temporarily storing the call request will migrate the call request to the network device with the data security level higher than that of the network device and forward the call request. The process ensures that the storage mode of the call request in the temporary storage process is safer than the storage mode of the call request in the same network equipment which is temporarily stored all the time, and the probability that the call request is finally successfully received by the target service is increased by forwarding the call request again.
In one embodiment of the present invention, the second request sending module 1103 is specifically configured to:
sending the call request to the target service; if the target service is determined to not successfully receive the call request, if the data security level of the network device is not the target data security level, sending the call request to a target network device with the target data security level in other network devices, wherein the initial value of the target data security level is as follows: the highest data security level; if the target network equipment does not successfully receive the call request, setting the target data security level to be one-level lower data security level; and returning to the step of executing the call request sent to the target network equipment with the target data security level in other network equipment if the data security level of the network equipment is not the target data security level, so that the other network equipment forwards the call request to the target service.
In view of the above, in the solution provided in this embodiment, on one hand, it is first determined whether there is a network device with a data security level meeting the condition, and this step may be omitted when checking that there is no network device that can be used for transfer, so as to save processing resources of the network device.
On the other hand, if the call request can be transferred to the network equipment with higher data security level, the transfer of the call request is performed, so that the security storage of the call request is facilitated.
In one embodiment of the present invention, referring to fig. 12, there is provided a schematic structural diagram of a fourth call request sending apparatus, the apparatus further including:
the concurrency limiting submodule 1102A is configured to determine whether a current call concurrency amount of the target service is less than a preset maximum call concurrency amount before the second request sending module sends the call request to the target service; and if yes, triggering the second request sending module to send the calling request to the target service.
In view of the above, in the solution provided in this embodiment, before sending a call request to a target service, the current call concurrency of the target service is determined, and the call request is sent only when the current call concurrency is less than the maximum call concurrency; therefore, concurrency limitation can be effectively carried out, the problem that the target service cannot work normally due to the fact that backlog excessive call requests are completely sent at the moment of target service recovery is avoided, and the stability of the target service is improved.
In one embodiment of the present invention, the second request temporary storage module 1102 is specifically configured to:
if the target service is determined to not successfully receive the call request, temporarily storing the call request to a message queue in the network equipment;
the apparatus further comprises:
the concurrency limiting submodule 1102A is specifically configured to migrate the call request from the head of the message queue to the tail of the message queue if the current call concurrency is not less than the maximum call concurrency.
In view of the above, in the solution provided in this embodiment, the call request is temporarily stored by using the message queue, and when the current call concurrency is greater than the maximum call concurrency, the position of the call request in the message queue is adjusted to be re-queued. The message queue is used for temporarily storing the call request, so that the function of time delay retry can be realized, sufficient time is provided for waiting for the recovery of the target service through the queuing process of the message queue, the concurrency of the call request is reduced, and the stability of the target service is further improved.
The embodiment of the present invention further provides a network device, as shown in fig. 13, including a processor 1301, a communication interface 1302, a memory 1303 and a communication bus 1304, where the processor 1301, the communication interface 1302, and the memory 1303 complete communication with each other through the communication bus 1304,
A memory 1303 for storing a computer program;
the processor 1301 is configured to implement the foregoing step of the call request sending method applied to the request processing end, or implement the foregoing step of the call request sending method applied to the network device when executing the program stored in the memory 1303.
The communication bus mentioned by the network device may be a peripheral component interconnect standard (Peripheral Component Interconnect, abbreviated as PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated as EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the network device and other devices.
The memory may include random access memory (Random Access Memory, RAM) or non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processor, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present invention, there is further provided a computer readable storage medium having a computer program stored therein, which when executed by a processor, implements the call request sending method according to any one of the foregoing embodiments.
In yet another embodiment of the present invention, a computer program product containing instructions that, when executed on a computer, cause the computer to perform the call request sending method of any of the above embodiments is also provided.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments in part.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims (10)
1. A method for sending a call request, which is applied to a request processing end, the method comprising:
generating a call request for calling a target service, wherein the target service is: the service to be called of the client embedded with the request processing end;
sending the call request to the target service;
if the target service is determined to not successfully receive the call request, requesting preset network equipment to temporarily store the call request so that the network equipment forwards the call request to the target service;
the preset network equipment comprises a plurality of network equipment with different data security levels;
the temporary storage of the call request by the network equipment preset by the request comprises the following steps:
the call request is sent to a target network device with a target data security level in the preset network devices, wherein the initial value of the target data security level is: the highest data security level;
If the target network equipment does not successfully receive the call request and the target data security level is not the lowest data security level, setting the target data security level to be one-level lower data security level; and returning to the step of executing the call request to the target network equipment with the target data security level in the preset network equipment.
2. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the level of data security increases as the network area to which the network device belongs increases.
3. The method according to claim 1 or 2, further comprising, prior to said generating a call request for invoking the target service:
receiving a service call parameter sent by a client, wherein the service call parameter comprises: the method comprises the steps of judging the identification and/or the request expiration time of a mode, wherein the judging mode is as follows: means for determining whether the call request was successfully received by the target service.
4. A call request sending method, applied to a network device, comprising:
obtaining a call request for calling a target service, wherein the target service is: the method comprises the steps that a service to be called of a client embedded with a request processing end is provided, and the request processing end is used for generating a call request;
Temporarily storing the call request;
sending the call request to the target service;
if the target service is determined to not successfully receive the call request, migrating the call request to other network equipment so that the other network equipment temporarily stores the call request and forwards the call request to the target service, wherein the data security level of the other network equipment is higher than that of the network equipment;
said migrating said call request to said other network device comprises:
if the data security level of the network device is not the target data security level, sending the call request to a target network device with the target data security level in other network devices, wherein the initial value of the target data security level is: the highest data security level;
if the target network equipment does not successfully receive the call request, setting the target data security level to be one-level lower data security level; and returning to the step of executing the call request to the target network equipment with the target data security level in other network equipment if the data security level of the network equipment is not the target data security level.
5. The method of claim 4, wherein prior to sending the call request to the target service, further comprising:
judging whether the current call concurrency of the target service is smaller than a preset maximum call concurrency;
and if yes, executing the step of sending the call request to the target service.
6. The method of claim 5, wherein the buffering the call request comprises:
temporarily storing the call request to a message queue in the network equipment;
the method further comprises the steps of:
and if the current call concurrency is not less than the maximum call concurrency, migrating the call request from the queue head to the queue tail of the message queue.
7. A call request sending device, applied to a request processing end, comprising:
the request generation module is used for generating a call request for calling a target service, wherein the target service is: the service to be called of the client embedded with the request processing end;
the first request sending module is used for sending the call request to the target service;
the first request temporary storage module is used for requesting preset network equipment to temporarily store the call request if the target service is determined to not successfully receive the call request, so that the network equipment forwards the call request to the target service;
The preset network equipment comprises a plurality of network equipment with different data security levels;
the first request temporary storage module is specifically configured to send the call request to a target network device having a target data security level in the preset network device if it is determined that the target service does not successfully receive the call request, where an initial value of the target data security level is: the highest data security level; if the target network equipment does not successfully receive the call request and the target data security level is not the lowest data security level, setting the target data security level to be one-level lower data security level; and returning to the step of sending the call request to the target network equipment with the target data security level in the preset network equipment, so that the network equipment forwards the call request to the target service.
8. A call request transmitting apparatus, applied to a network device, comprising:
the request acquisition module is used for acquiring a call request for calling a target service, wherein the target service is: the method comprises the steps that a service to be called of a client embedded with a request processing end is provided, and the request processing end is used for generating a call request;
The second request temporary storage module is used for temporarily storing the call request;
the second request sending module is used for sending the call request to the target service; if the target service is determined to not successfully receive the call request, migrating the call request to other network equipment so that the other network equipment temporarily stores the call request and forwards the call request to the target service, wherein the data security level of the other network equipment is higher than that of the network equipment;
the second request sending module is specifically configured to:
sending the call request to the target service; if the target service is determined to not successfully receive the call request, if the data security level of the network device is not the target data security level, sending the call request to a target network device with the target data security level in other network devices, wherein the initial value of the target data security level is as follows: the highest data security level; and if the target network equipment does not successfully receive the call request, setting the target data security level to be one-level lower data security level, and returning to execute the step of sending the call request to the target network equipment with the target data security level in other network equipment if the data security level of the network equipment is not the target data security level so as to enable the other network equipment to forward the call request to the target service.
9. The network equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1-3 or 4-6 when executing a program stored on a memory.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-3 or 4-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111387647.0A CN114095576B (en) | 2021-11-22 | 2021-11-22 | Call request sending method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111387647.0A CN114095576B (en) | 2021-11-22 | 2021-11-22 | Call request sending method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114095576A CN114095576A (en) | 2022-02-25 |
CN114095576B true CN114095576B (en) | 2024-03-08 |
Family
ID=80302844
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111387647.0A Active CN114095576B (en) | 2021-11-22 | 2021-11-22 | Call request sending method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114095576B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107438060A (en) * | 2016-05-28 | 2017-12-05 | 华为技术有限公司 | Remote procedure calling (PRC) method and the network equipment in a kind of network equipment |
CN107645476A (en) * | 2016-07-22 | 2018-01-30 | 百度在线网络技术(北京)有限公司 | Request processing method and device |
WO2019052526A1 (en) * | 2017-09-14 | 2019-03-21 | 北京金山云网络技术有限公司 | Api invoking system, method and apparatus, electronic device and storage medium |
CN110336753A (en) * | 2019-06-19 | 2019-10-15 | 腾讯科技(深圳)有限公司 | A kind of service calling method, device, equipment and the storage medium in across a network region |
-
2021
- 2021-11-22 CN CN202111387647.0A patent/CN114095576B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107438060A (en) * | 2016-05-28 | 2017-12-05 | 华为技术有限公司 | Remote procedure calling (PRC) method and the network equipment in a kind of network equipment |
CN107645476A (en) * | 2016-07-22 | 2018-01-30 | 百度在线网络技术(北京)有限公司 | Request processing method and device |
WO2019052526A1 (en) * | 2017-09-14 | 2019-03-21 | 北京金山云网络技术有限公司 | Api invoking system, method and apparatus, electronic device and storage medium |
CN110336753A (en) * | 2019-06-19 | 2019-10-15 | 腾讯科技(深圳)有限公司 | A kind of service calling method, device, equipment and the storage medium in across a network region |
Also Published As
Publication number | Publication date |
---|---|
CN114095576A (en) | 2022-02-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11240332B2 (en) | Subscription based event notifications | |
US9729488B2 (en) | On-demand mailbox synchronization and migration system | |
US8635368B2 (en) | Methods, apparatus and computer programs for data communication efficiency | |
US7945673B2 (en) | Reduced wireless internet connect time | |
US8516054B2 (en) | Message handling | |
US9338227B2 (en) | Automated management of content servers based on change in demand | |
CN110233881B (en) | Service request processing method, device, equipment and storage medium | |
US20140330980A1 (en) | Managing content delivery network service providers by a content broker | |
US8234406B2 (en) | Method of redirecting client requests to web services | |
CN110413425B (en) | Third-party message callback method, device, server and storage medium | |
US6035418A (en) | System and method for improving resource utilization in a TCP/IP connection management system | |
US20120209977A1 (en) | Program Update Management Server And Program Update Management Method | |
JP2006340354A (en) | Distributed kernel operating system | |
US8275905B2 (en) | System and method for store-and-forward for highly available message production | |
CN112104679B (en) | Method, apparatus, device and medium for processing hypertext transfer protocol request | |
CN114374669A (en) | VPN client proxy DNS analysis method and system | |
US11323368B1 (en) | System and method for web service atomic transaction (WS-AT) affinity routing | |
CN114095576B (en) | Call request sending method and device | |
US7839799B2 (en) | Middleware components for bundling service invocations | |
EP3026860B1 (en) | Method and system for transmission management of full configuration synchronization between eml-nml | |
US8332498B2 (en) | Synchronized relay messaging and coordinated network processing using SNMP | |
US10862811B1 (en) | Message brokering for asynchronous status updates | |
CN101958934A (en) | Electronic program guide incremental content synchronization method, device and system | |
CN113660178A (en) | CDN content management system | |
US10623328B1 (en) | Message brokering for asynchronous status updates |
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 |