Detailed Description
The service transmission method and device provided by the embodiment of the application are described in detail below with reference to the accompanying drawings.
The term "and/or" is herein merely an association relationship describing an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone.
The terms "first" and "second" and the like in the description and in the drawings are used for distinguishing between different objects or for distinguishing between different processes of the same object and not for describing a particular sequential order of objects.
Furthermore, references to the terms "comprising" and "having" and any variations thereof in the description of the present application are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed but may optionally include other steps or elements not listed or inherent to such process, method, article, or apparatus.
It should be noted that, in the embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
Fig. 1 is a schematic structural diagram of a service transmission device according to an embodiment of the present application, and as shown in fig. 1, the service transmission device 100 includes at least one processor 101, a communication line 102, at least one communication interface 104, and may further include a memory 103. The processor 101, the memory 103, and the communication interface 104 may be connected through a communication line 102.
The processor 101 may be a central processing unit (central processing unit, CPU), an application specific integrated circuit (application specific integrated circuit, ASIC), or one or more integrated circuits configured to implement embodiments of the present application, such as: one or more digital signal processors (digital signal processor, DSP), or one or more field programmable gate arrays (field programmable gate array, FPGA).
Communication line 102 may include a pathway for communicating information between the aforementioned components.
The communication interface 104, for communicating with other devices or communication networks, may use any transceiver-like device, such as ethernet, radio access network (radio access network, RAN), wireless local area network (wireless local area networks, WLAN), etc.
The memory 103 may be, but is not limited to, a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (random access memory, RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM), a compact disc read-only memory (compact disc read-only memory) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to include or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
In a possible design, the memory 103 may exist independent of the processor 101, i.e. the memory 103 may be a memory external to the processor 101, where the memory 103 may be connected to the processor 101 through a communication line 102 for storing execution instructions or application program codes, and the execution is controlled by the processor 101 to implement a network quality determining method provided in the embodiments described below. In yet another possible design, the memory 103 may be integrated with the processor 101, i.e., the memory 103 may be an internal memory of the processor 101, e.g., the memory 103 may be a cache, and may be used to temporarily store some data and instruction information, etc.
As one implementation, processor 101 may include one or more CPUs, such as CPU0 and CPU1 in fig. 1. As another implementation, the traffic transmission 100 may include multiple processors, such as the processor 101 and the processor 107 in fig. 1. As yet another implementation, the traffic transmission 100 may also include an output device 105 and an input device 106.
From the foregoing description of the embodiments, it will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of functional modules is illustrated, and in practical application, the above-described functional allocation may be implemented by different functional modules according to needs, i.e. the internal structure of the network node is divided into different functional modules to implement all or part of the functions described above. The specific working processes of the above-described system, module and network node may refer to the corresponding processes in the foregoing method embodiments, which are not described herein.
Nginx (engine x) is a high performance hypertext transfer protocol (Hyper Text TransferProtocol, HTTP) and reverse proxy web server, while also providing IMAP/POP3/SMTP services. In the related art, a terminal sends a request to a back-end server through a back-end server (engine x, ng ix), the back-end server processes the request and feeds back the request to the terminal through the back-end server, in the process, input/Output (I/O) devices on the back-end server are always fully loaded, and no method for effectively reducing the load condition of the I/O devices exists at present; meanwhile, in the prior art, the priority of the response cannot be distinguished, so that the user can only receive useless resources such as static files or pictures after waiting for a long time.
In addition, the existing reverse server can cause the blocking of the interface request of the normal I/O equipment under the condition that a large number of static files are received by an external malicious request, so that network attack cannot be effectively resisted, and normal feedback response cannot be realized.
In order to solve the problem that the load of a server cannot be effectively reduced in the prior art, the application provides a service transmission method as shown in fig. 2. The method comprises the steps of determining a service cache queue and determining target service in the service cache queue under the condition that the load of a server is larger than a preset threshold, and finally determining whether the load required for transmitting the target service is smaller than the current available load of the server, and if so, sending the target service to a terminal. Based on the technical scheme, the server caches the service into the service cache queue under the condition of higher load, and only sends the request which has higher priority and meets the current load requirement of the server, so that the load of the server is effectively reduced, and the occurrence of the condition of full load of the server is avoided.
As shown in fig. 2, a flowchart of a service transmission method provided in an embodiment of the present application is shown, where the service transmission method provided in the embodiment of the present application may be applied to the service transmission device shown in fig. 1, and the service transmission method provided in the embodiment of the present application may be implemented by the following steps.
S201, the service transmission device determines a service cache queue under the condition that the load of the server is larger than a preset threshold value.
The service buffer queue is used for buffering the service sent by the server to the terminal.
In one possible implementation, the server may also be understood as a reverse server, with the load of the server including the load of the I/O devices on the reverse server and other loads on the server. In this application, the load of the server will be mainly described as an example of the load of the I/O device of the server.
In a specific implementation manner, a service transmission device monitors the load condition of an I/O device, compares the load of the I/O device with a preset threshold in the service transmission device, and if the load of the I/O device is greater than or equal to the preset threshold, a server starts a service buffer queue to buffer a service currently required to be sent to a terminal into a service buffer queue.
The service transmission device monitors the load of the server, determines that the current load of the server is 50MB, compares the current load of the server with a preset threshold value 40MB, determines that the load 50MB of the server is greater than the preset threshold value 40MB, instructs the server to start a service buffer queue at this time, and buffers a plurality of services fed back by the back-end server into the service buffer queue.
Optionally, the service cached in the service cache queue includes service content, service size, and a timestamp of the service entering the cache queue.
It should be noted that, in the embodiment of the present application, the server refers to a reverse server, and the backend server is a server that processes a service request of a terminal.
S202, the service transmission device determines the target service in the service buffer queue.
The target service is a service with priority meeting preset conditions in a service cache queue.
In one possible implementation manner, the service transmission device determines the priority of each service in the service buffer queue, and determines that the service with the priority meeting the preset condition is the target service.
In one possible implementation manner, after the service transmission device sends the target service to the terminal every preset time or every time, the service transmission device recalculates the priority of each service in the service buffer queue, and redetermines the service with the current priority meeting the preset condition as the target service.
S203, the service transmission device determines whether the current available load of the server is larger than the service size of the target service.
S204, if yes, the service transmission device sends the target service to the terminal.
For example, in the case where the service transmission device determines that the current available load of the server is 30MB and the service size of the target service is 10MB, the service transmission device determines that the current available load of the server is greater than the service size of the target service. That is, the service transmission apparatus determines that the current available load of the server satisfies the requirement of transmitting the target service, and at this time, the service transmission apparatus may transmit the target service to the terminal.
Compared with the prior art, the service transmission method provided by the embodiment of the invention has the advantages that the service transmission device transmits the target service to the terminal only when the current available load of the server is larger than the service size of the target service, and the service transmission device buffers the service to the service buffer queue under the condition that the load of the server is higher, only transmits the service with higher priority and meets the current load requirement of the server, thereby effectively reducing the load of the server and avoiding the occurrence of the full load condition of the server.
In the following, a detailed description will be given of how the service transmission apparatus determines the target service in the service buffer queue in the embodiment of the present application, in connection with a specific embodiment.
Referring to fig. 2, as shown in fig. 3, how the service transmission device determines the target service in the service buffer queue may be specifically implemented by the following S301-S302, which are described in detail below:
s301, the service transmission device determines the priority of each service in the service buffer queue.
Wherein the priority is determined according to at least one of: the load value of the server, the service type of the service, the service size of the service, and the duration of the service in the cache queue.
In one possible implementation manner, the service transmission device calculates and determines the priority of each service in the service buffer queue according to at least one of the load value of the server, the service type of the service, the service size of the service and the duration of the service in the buffer queue.
In a specific implementation manner, the service transmission device determines that the sum of the first weight value, the first parameter value, the second parameter value, the third parameter value and the fourth parameter value of the ith service in the service buffer queue is the priority of the ith service.
The first weight value is the weight value of the service type of the ith service; the first parameter value is the product of the first coefficient and the load value of the server; the second parameter value is the product of the second coefficient and the load value of the server; the third parameter value is the product of the third coefficient and the service size of the ith service; the fourth parameter value is the product of the fourth coefficient and the duration of the ith service in the service buffer queue.
The load value of the server includes, as an example, a read-write margin value and a network margin value of an input-output device of the server.
Priority W of ith service i The following equation 1 is satisfied:
W i =E i +A*F+B*G+C*U i +D*V i equation 1
Wherein E is i A weight value for a service type denoted as i-th service; a is represented as a first coefficient; f is expressed as a read-write margin value of input-output equipment of the server; b is represented as a second coefficient; g represents the network margin of the input/output device of the serverA degree value; c is represented as a third coefficient; u (U) i A service size denoted as i-th service; d is represented as a fourth coefficient; v (V) i Denoted as the length of time that exists in the ith traffic buffer queue. The first coefficient, the second coefficient, the third coefficient and the fourth coefficient are preset values.
For example, the first coefficient, the second coefficient, the third coefficient, and the fourth coefficient may be determined according to an empirical value of an operation and maintenance person.
The service type of the service A is static file acquisition, the service type of the service B is database data acquisition, the service type of the service C is user entity operation, the weight value of the static file acquisition is 2.5, the weight value of the database data acquisition is 3.5, and the weight value of the user entity operation is 4.
At this time, the service transmission apparatus calculates the priority W of the service a according to the above formula 1 A =2.5+5*2mb/s+5*5mb/s+(-6)*0.5mb+0.008*1000ms=42.5。
The service transmission device calculates the priority W of the service B B =3.5+5*2mb/s+5*5mb/s+(-2)*2mb+0.005*2000ms=44.5。
The service transmission device calculates the priority W of the service C C =4+5*2mb/s+5*5mb/s+2*0.8mb+0.007*1500ms=51.1。
S302, the service transmission device takes the service with the highest priority in the service buffer queue as the target service.
In combination with the example in S301, the service transmission device compares the priority 42.5 of the service a, the priority 44.5 of the service B, and the priority 51.1 of the service C to determine that the priority of the service C is the highest, and at this time, the service transmission device determines that the service C is the target service.
Based on the technical characteristics, the service transmission method provided by the application determines the priority of each service in the service buffer queue through the service transmission device, determines the service with the highest priority according to the priority of each service, and firstly feeds back the service with the highest priority when feeding back the service to the terminal, thereby ensuring the user experience of the service with the high priority.
In the above, it is described in detail how the service transmission apparatus determines the target service in the service buffer queue.
The specific implementation manner of whether the service transmission device feeds back the target service step to the terminal will be described in detail below.
As shown in fig. 4, whether the service transmission device feeds back the target service to the terminal may be specifically implemented through S401-S403, which is described in detail below:
s401, the service transmission device determines whether the available read-write margin value of the input/output device and the available network margin value of the input/output device are both larger than the service size of the target service.
In one possible implementation, the service transmission apparatus compares the available read-write margin value and the available network margin value of the input-output device with the service size of the target service, respectively, and determines whether the available read-write margin value and the available network margin value are both greater than the service size of the target service. The service size of the target service may be understood as a data size of the service, where the service size is in mb. The available read-write margin value of the input-output device can be understood as the capacity of the IO device that the server can currently provide for reading and writing, and the available network margin value of the input-output device can be understood as the network bandwidth capacity that the server can currently provide for transmission.
S402, if not, the service transmission device pauses to send the target service to the terminal.
Illustratively, in combination with the examples in S301 and S302 above, service C is a target service, and the service size of service C is 0.8MB. The service transmission device determines that the available read-write margin value of the input and output equipment is 0.5MB at the moment, the available network margin value of the input and output equipment is 15MB, compares the available read-write margin value of the input and output equipment with the service size of the service C of 0.8MB, and then compares the available network margin value of the input and output equipment of 15MB with the service size of the service C of 0.8MB.
The service transmission device determines that the available read-write margin value of the input/output equipment is 0.5MB and is smaller than the service size of the service C and is 0.8MB, and the input/output equipment cannot meet the service C, and the service transmission device delays sending the service C to the terminal.
It should be noted that, in the case where the service transmission device temporarily transmits the target service to the terminal, the service transmission device acquires the service with the second highest priority in the service transmission queue as the target service, and executes the above steps again to determine whether to transmit a new target service to the terminal.
S403, if yes, the service transmission device sends the target service to the terminal.
Illustratively, in combination with the examples in S301 and S302 above, service C is a target service, and the service size of service C is 0.8MB. The service transmission device determines that the available read-write margin value of the input and output equipment is 8MB at the moment, the available network margin value of the input and output equipment is 20MB, compares the available read-write margin value of the input and output equipment with the service size of the service C of 0.8MB, compares the available network margin value of the input and output equipment with the service size of the service C of 0.8MB, determines that the available read-write margin value of the input and output equipment is 8MB and the available network margin value of the input and output equipment is 20MB, and is larger than the service size of the service C of 0.8MB, and feeds back the service C to the terminal.
For example, in combination with the above further example of S401, the available read/write margin value of the input/output device is 8mb and the available network margin value of the input/output device is 20mb, which are both greater than the service size of 0.8mb of the service C, then the service transmission apparatus feeds back the service C to the terminal.
The following is given. The overall process of how the service transmission apparatus reduces the load on the server will be described with reference to fig. 5:
s501, the service transmission device monitors the condition of the server, and if the load of the server reaches a preset threshold, the service transmission device starts a service buffer queue.
The specific implementation of S501 is similar to S201 described above, and the specific implementation process may refer to S201, which is not described herein.
S502, after the service buffer queue is started, the server buffers all the services into the service buffer queue, and the service transmission device determines the service buffer queue.
The specific implementation of S502 is similar to S201 described above, and the specific implementation process may refer to S201, which is not described herein.
S503, the service transmission device calculates the priority of each service in the service buffer queue.
The specific implementation of S503 is similar to S301 described above, and the specific implementation process may refer to S301, which is not described herein.
S504, the service transmission device determines the target service in the service buffer queue according to the priority of each service.
The specific implementation of S504 is similar to S302 described above, and the specific implementation process may refer to S302, which is not described herein.
S505, the service transmission device determines whether the available read-write margin value of the input/output device and the available network margin value of the input/output device are both larger than the service size of the target service.
The specific implementation of S505 is similar to S401 described above, and the specific implementation process may refer to S401, which is not described herein.
S506, if the available read-write margin value of the input/output equipment and the available network margin value of the input/output equipment are both larger than the service size of the target service, feeding back the target service to the terminal.
The specific implementation of S506 is similar to S403, and the specific implementation process may refer to S403, which is not described herein.
S507, if not, the service transmission device pauses to send the target service to the terminal; meanwhile, the service transmission apparatus acquires the target service having the second highest priority to execute the above-described S504-S506 again.
The specific implementation of S507 is similar to S402 described above, and the specific implementation process may refer to S402, which is not described herein.
S508, after each preset time or each time the target service is sent to the terminal, the service transmission device redetermines the priority of each service in the service buffer queue.
The specific implementation of S508 is similar to S202 described above, and the specific implementation process may refer to S202, which is not described herein.
Based on the technical scheme, the service transmission method provided by the application determines whether the available read-write margin value of the input/output equipment and the available network margin value of the input/output equipment are both larger than the service size of the target service or not through the service transmission device, feeds back the target service to the terminal when the available read-write margin value of the input/output equipment and the available network margin value of the input/output equipment are both larger than the service size of the target service, and if any item of service size smaller than the service size of the target service exists, the server cannot meet the target service, and at the moment, the target service is fed back to the terminal in a suspending mode, so that the condition that the server is fully loaded is avoided.
The embodiment of the present application may divide the functional modules or functional units of the service transmission apparatus according to the above method example, for example, each functional module or functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated modules may be implemented in hardware, or in software functional modules or functional units. The division of the modules or units in the embodiments of the present application is merely a logic function division, and other division manners may be implemented in practice.
Fig. 6 is a schematic structural diagram of a service transmission device according to an embodiment of the present application, where the service transmission device includes: a processing unit 601 and a communication unit 602; a processing unit 601, configured to determine a service cache queue when a load of a server is greater than a preset threshold; the service cache queue is used for caching the service sent by the server to the terminal; the processing unit 601 is further configured to determine a target service in the service cache queue; the target service is a service with priority meeting preset conditions in a service cache queue; the processing unit 601 is further configured to determine whether a current available load of the server is greater than a service size of the target service; if yes, the communication unit 602 is configured to send the target service to the terminal.
Optionally, determining a target service in the service buffer queue, and the processing unit 601 is further configured to determine a priority of each service in the service buffer queue; wherein the priority is determined according to at least one of: the method comprises the steps of loading values of a server, service types of services, service sizes of the services and time lengths of the services in a cache queue; and taking the service with the highest priority in the service cache queue as a target service.
Optionally, determining the priority of each service in the service buffer queue, and the processing unit 601 is further configured to determine that the sum of the first weight value, the first parameter value, the second parameter value, the third parameter value, and the fourth parameter value of the i-th service in the service buffer queue is the priority of the i-th service; the first weight value is the weight value of the service type of the ith service; the first parameter value is the product of the first coefficient and the load value of the server; the second parameter value is the product of the second coefficient and the load value of the server; the third parameter value is the product of the third coefficient and the service size of the ith service; the fourth parameter value is the product of the fourth coefficient and the duration of the ith service in the service buffer queue.
Optionally, the load value of the server includes a read-write margin value and a network margin value of an input-output device of the server; determining whether the current available load of the server is greater than the traffic size of the target traffic includes: the processing unit 601 is further configured to determine whether an available read-write margin value of the input/output device and an available network margin value of the input/output device are both greater than a service size of the target service; sending the target service to the terminal, comprising: if not, the processing unit 601 temporarily sends the target service to the terminal; if yes, the communication unit 602 sends the target service to the terminal.
When implemented in hardware, the communication unit 602 in the embodiments of the present application may be integrated on a communication interface, and the processing unit 601 may be integrated on a processor. A specific implementation is shown in fig. 7.
Fig. 7 shows a further possible structural schematic diagram of the traffic transmission device involved in the above embodiment. The service transmission device comprises: a processor 702 and a communication interface 703. The processor 702 is configured to control and manage actions of the traffic transmission device, e.g., perform the steps performed by the processing unit 601 described above, and/or perform other processes of the techniques described herein. The communication interface 703 is used to support communication of the traffic transmission device with other network entities, for example, the traffic transmission device performing the steps performed by the above-mentioned communication unit 602 may further comprise a memory 701 and a bus 704, the memory 701 being used to store program codes and data of the traffic transmission device.
Wherein the memory 701 may be a memory in a traffic transmission device or the like, which may include a volatile memory, such as a random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk or solid state disk; the memory may also comprise a combination of the above types of memories.
The processor 702 may be implemented or executed with the various exemplary logic blocks, modules, and circuits described in connection with this disclosure. The processor may be a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules, and circuits described in connection with this disclosure. The processor may also be a combination that performs the function of a computation, e.g., a combination comprising one or more microprocessors, a combination of a DSP and a microprocessor, etc.
Bus 704 may be an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus or the like. The bus 704 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 7, but not only one bus or one type of bus.
From the foregoing description of the embodiments, it will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of functional modules is illustrated, and in practical application, the above-described functional allocation may be implemented by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to implement all or part of the functions described above. The specific working processes of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which are not described herein.
The present application provides a computer program product comprising instructions which, when executed on a computer, cause the computer to perform the method of traffic transmission in the method embodiments described above.
The embodiment of the application also provides a computer readable storage medium, in which instructions are stored, which when executed on a computer, cause the computer to execute the service transmission method in the method flow shown in the method embodiment.
The computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access Memory (Random Access Memory, RAM), a Read-Only Memory (ROM), an erasable programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), a register, a hard disk, an optical fiber, a portable compact disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing, or any other form of computer readable storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuit, ASIC). In the context of the present application, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
Since the service transmission device, the computer readable storage medium and the computer program product in the embodiments of the present invention can be applied to the above-mentioned method, the technical effects that can be obtained by the method can also refer to the above-mentioned method embodiments, and the embodiments of the present invention are not described herein again.
In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, e.g., the partitioning of elements is merely a logical functional partitioning, and there may be additional partitioning in actual implementation, e.g., multiple elements or components may be combined or integrated into another system, or some features may be omitted, or not implemented. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interface, indirect coupling or communication connection of devices or units, electrical, mechanical, or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The foregoing is merely a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.