CN111858088B - Communication data processing method, device, computer equipment and storage medium - Google Patents
Communication data processing method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN111858088B CN111858088B CN202010588618.XA CN202010588618A CN111858088B CN 111858088 B CN111858088 B CN 111858088B CN 202010588618 A CN202010588618 A CN 202010588618A CN 111858088 B CN111858088 B CN 111858088B
- Authority
- CN
- China
- Prior art keywords
- channel
- server
- data
- memory
- instruction
- 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
- 230000006854 communication Effects 0.000 title claims abstract description 66
- 238000004891 communication Methods 0.000 title claims abstract description 65
- 238000003672 processing method Methods 0.000 title abstract description 14
- 230000015654 memory Effects 0.000 claims abstract description 143
- 230000004913 activation Effects 0.000 claims abstract description 39
- 238000000034 method Methods 0.000 claims abstract description 34
- 238000012545 processing Methods 0.000 claims abstract description 30
- 230000003213 activating effect Effects 0.000 claims abstract description 28
- 238000004590 computer program Methods 0.000 claims description 24
- 238000004064 recycling Methods 0.000 claims description 21
- 230000005540 biological transmission Effects 0.000 claims description 20
- 238000001514 detection method Methods 0.000 claims description 15
- 230000000903 blocking effect Effects 0.000 claims description 9
- 238000012544 monitoring process Methods 0.000 description 9
- 230000004044 response Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 230000009471 action Effects 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 239000000284 extract Substances 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000005538 encapsulation Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static 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/544—Buffers; Shared memory; Pipes
-
- 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/546—Message passing systems or structures, e.g. queues
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Computer And Data Communications (AREA)
Abstract
The application relates to a communication data processing method, a communication data processing device, computer equipment and a storage medium. The method comprises the following steps: detecting the memory occupancy of a first server to obtain a first memory occupancy, wherein the first server comprises a first channel and a second channel; when the first channel is in a communication state, the second channel is in an unactivated state, and the first memory occupancy is greater than or equal to a preset threshold value, an activation instruction for activating the second channel is generated, and the activation instruction is executed, so that the second channel transmits data which are not put into the first channel in the first server, and the data transmitted by the second channel are cached in the message queue. When the data volume is large, the untransmitted instruction data is cached to the message queue through the activated second channel, so that the problem of data loss caused by insufficient memory due to large instruction data volume is avoided.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for processing communication data, a computer device, and a storage medium.
Background
Along with the increase of communication data, the processing pressure of the server on the data is increased, in the prior art, the communication data received by the first server is often sent to the second server through a TCP (Transmission Control Protocol ), and after the TCP communication is completed below the data, the memory is released after receiving feedback information returned by the second server after the sending is completed. When the data volume is large, the first server cannot receive the instruction in time when the occupancy rate of the memory of the first server is too high, so that the data is lost.
Disclosure of Invention
In order to solve the technical problem of data loss caused by insufficient memory of a server during communication, the application provides a communication data processing method, a device, computer equipment and a storage medium.
In a first aspect, the present application provides a communication data processing method, including:
Detecting the memory occupancy of a first server to obtain a first memory occupancy, wherein the first server comprises the first channel and the second channel;
When the first channel is in a communication state, the second channel is in an unactivated state, and the first memory occupancy is greater than or equal to a preset threshold, an activation instruction for activating the second channel is generated, and the activation instruction is executed, so that the second channel transmits data which is not input into the first channel in the first server, and the data transmitted by the second channel is cached to a message queue.
Optionally, after activating the second channel, the method further comprises:
and transmitting the data which is put into the first channel by adopting the first channel.
Optionally, after the activating the second channel, the method further includes:
Detecting the memory occupancy rate of the first server to obtain a second memory occupancy rate;
And when the second memory occupancy is smaller than the preset threshold, generating a second instruction, and executing the second instruction, wherein the second instruction is used for blocking the second channel so as to enable the second channel to be in an inactive state.
Optionally, the memory occupancy includes a first occupancy and a second occupancy, and the detecting the memory occupancy of the first server includes:
detecting the memory space opened by the first server within a preset time period to obtain the first occupancy rate;
and detecting all memory occupancy rates in the first server to obtain the second occupancy rate.
Optionally, the method further comprises:
A data processing state for receiving data transmitted over the first channel;
and when the data processing state of the current data is that the transmission is completed, generating a recycling instruction, wherein the recycling instruction is used for recycling the memory corresponding to the current data.
Optionally, the data transmission of the first channel is performed by a main thread, and the data transmission of the second channel is performed by a sub-thread of the main thread.
Optionally, after activating the second channel, the method further comprises:
Generating flag information, and placing the flag information into the second channel;
Detecting whether the mark information exists in the sub thread or not through the main thread;
And when the mark information exists, executing the step of generating an activation instruction for activating the second channel.
In a second aspect, the present embodiment provides a communication data processing apparatus, the apparatus comprising:
The first detection module is used for detecting the memory occupancy of a first server to obtain a first memory occupancy, and the first server comprises the first channel and the second channel;
and the activation module is used for generating an activation instruction for activating the second channel when the first channel is in a communication state, the second channel is in an unactivated state and the first memory occupancy is greater than or equal to a preset threshold value, and executing the activation instruction so that the second channel transmits the data which is not input into the first channel in the first server, and the data transmitted by the second channel is cached in a message queue.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of:
Detecting the memory occupancy of a first server to obtain a first memory occupancy, wherein the first server comprises the first channel and the second channel;
When the first channel is in a communication state, the second channel is in an unactivated state, and the first memory occupancy is greater than or equal to a preset threshold, an activation instruction for activating the second channel is generated, and the activation instruction is executed, so that the second channel transmits data which is not input into the first channel in the first server, and the data transmitted by the second channel is cached to a message queue.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
Detecting the memory occupancy of a first server to obtain a first memory occupancy, wherein the first server comprises the first channel and the second channel;
When the first channel is in a communication state, the second channel is in an unactivated state, and the first memory occupancy is greater than or equal to a preset threshold, an activation instruction for activating the second channel is generated, and the activation instruction is executed, so that the second channel transmits data which is not input into the first channel in the first server, and the data transmitted by the second channel is cached to a message queue.
The communication data processing method, the device, the computer equipment and the storage medium, wherein the method comprises the following steps: detecting the memory occupancy of a first server to obtain a first memory occupancy, wherein the first server comprises the first channel and the second channel; when the first channel is in a communication state, the second channel is in an unactivated state, and the first memory occupancy is greater than or equal to a preset threshold, an activation instruction for activating the second channel is generated, and the activation instruction is executed, so that the second channel transmits data which is not input into the first channel in the first server, and the data transmitted by the second channel is cached to a message queue. When the data volume is large, the server cannot continuously receive new data when the memory occupancy of the server is too high, the untransmitted data is cached to the message queue by activating the second channel, the problem of data loss caused by insufficient memory due to large instruction data volume is avoided, and the communication efficiency is improved by adopting double-thread transmission.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flow diagram of a communication data processing method in one embodiment;
FIG. 2 is a block diagram of a communication data processing apparatus in one embodiment;
FIG. 3 is an internal block diagram of a computer device in one embodiment.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The communication data processing method is applied to a communication data processing system. The communication data processing system includes a first server and a second server. The first server and the second server are connected through a network. The first server and the second server may be implemented as separate servers or as a server cluster composed of a plurality of servers. The communication data processing system can be applied to any scene requiring instruction data communication, such as an air conditioner renting system, a household equipment control system and the like.
In one embodiment, fig. 1 is a flow chart of a communication data processing method in one embodiment, and referring to fig. 1, a communication data processing method is provided. The embodiment is mainly exemplified by the method applied to the first server in fig. 1, and the method for processing communication data specifically includes the following steps:
step S210, detecting a memory occupancy of a first server to obtain a first memory occupancy, wherein the first server comprises the first channel and the second channel.
In this embodiment, the monitor module is used to monitor the occupation condition and the memory occupation condition of the CPU (central processing unit ) in the first server, and calculate the memory occupation ratio of the first server according to the monitoring condition, where the monitor module may be any code encapsulation module capable of implementing the function of the monitor thread, for example, an existing memory monitor script, JVisualVM tool, gopprof module, and the like.
Step S220, when the first channel is in a communication state and the second channel is in an inactive state, and the first memory occupancy is greater than or equal to a preset threshold, generating an activation instruction for activating the second channel, and executing the activation instruction, so that the second channel transmits data in the data receiving service, which is not put into the first channel, and the data transmitted by the second channel is buffered to a message queue.
In this embodiment, the preset threshold represents the memory occupancy rate of the first server, when the first memory occupancy rate exceeds the preset threshold, it represents that the memory of the first server is about to be full, instruction data cannot be continuously received, the monitoring module issues an activation signal to the second channel to activate the second channel, data received by the first server after activating the second channel and not put into the first channel is cached to the message queue through the second channel, the data is transmitted to the message queue of the second server through the second channel, the second server extracts the data from the message queue for consumption, the memory of the first server is not occupied, it is theoretically ensured that the first server can continuously receive the instruction data, and the problem that the memory of the first server is insufficient and cannot continuously receive the data when the data amount is large, and the instruction data is lost in the communication process is avoided.
In one embodiment, a data processing state of data transmitted over the first channel is received; and when the data processing state of the current data is that the transmission is completed, generating a recycling instruction, wherein the recycling instruction is used for recycling the memory corresponding to the current data.
Specifically, after the data issuing of the first server is completed, a recycling instruction is generated, the data issued to the second server by the first channel is recycled by utilizing a GC mechanism (garbage recycling mechanism), and the memory occupied by the data is released, so that the subsequent continuous receiving of instruction data is facilitated. After the data is cached to the message queue through the second channel, the first server automatically retrieves the memory corresponding to the data.
In one embodiment, the first channel is used to transmit data that has been dropped into the first channel after the second channel is activated.
Specifically, the data input into the first channel is transmitted to the second server through the first channel, TCP communication is realized between the first server and the second server through the first channel, and meanwhile, the data is processed in parallel with the second channel, namely, double-thread processing is performed, so that command data which cannot be processed originally is issued at the same time, the transmission speed of single queuing waiting command response is improved, and the communication efficiency is improved.
After the data in the first channel is issued, detecting the memory occupancy rate of the first server, if the memory occupancy rate is still greater than a preset threshold value, blocking the first channel, and the first channel does not transmit data any more, wherein the data received by the server are all buffered to the message queue through the second channel. After the first server sends instruction data to the second server, the first server can send the next data after waiting for the response of the second server, when the second server does not respond to the first server in time, the data transmission cannot be continued, the memory occupied by the data cannot be released, and the data transmission efficiency is affected, so that the first channel is blocked, the first channel does not transmit the data any more, the data is cached in the message queue through the second channel, the second server takes the data from the message queue, the first server sends the data to the second server without waiting for the response of the second server, the data transmission efficiency is improved, and the communication pressure between the first server and the second server is lightened. The first channel includes at least one TCP communication channel.
The TCP communication data transmission speed is high, and the method is suitable for being used under the condition of less data volume, but the waiting time for the TCP to release the memory is long, the data can occupy the memory of the first server for a period of time, and the message queue communication is faster in releasing the memory of the data in the first server.
In one embodiment, after the second channel is activated, detecting a memory occupancy of the first server to obtain a second memory occupancy; and when the second memory occupancy is smaller than the preset threshold, generating a second instruction, and executing the second instruction, wherein the second instruction is used for blocking the second channel so as to enable the second channel to be in an inactive state.
Specifically, the memory occupancy rate of the first server is detected within a preset duration, the memory occupancy rate detected within the preset duration is smaller than a preset threshold, or the second memory occupancy rate obtained by each detection in multiple detections is smaller than the preset threshold, so that an instruction for blocking the second channel is generated. And detecting for a plurality of times, wherein when the data quantity received by the first server is smaller than a preset threshold value each time, the data quantity is reduced, the data quantity is relatively stable after the data quantity is reduced, the first server can continuously receive instruction data, and the first channel is adopted to carry out TCP communication with the second server, so that the transmission requirement of the data can be met. The preset duration and the detection times can be customized according to actual conditions.
In one embodiment, the memory occupancy rate includes a first occupancy rate and a second occupancy rate, and the memory space opened by the first server is detected in a preset time period to obtain the first occupancy rate; and detecting all memory occupancy rates in the first server to obtain the second occupancy rate.
Specifically, the first occupancy rate is a ratio of a new memory amount opened by the first server to a maximum memory amount of the first server in a preset time period, the second occupancy rate corresponds to a ratio of a total memory amount opened by the first server to the maximum memory amount of the first server in the preset time period, the preset threshold value comprises a preset opening amount and a preset total amount, and when the first occupancy rate is larger than the preset opening amount and the second occupancy rate is larger than the preset total amount, namely, the memory occupancy rate of the first server is larger than the preset threshold value, the memory shortage of the first server is indicated, the instruction data cannot be continuously received, the second channel needs to be activated to relieve the communication pressure, and the instruction data is prevented from being lost.
In a specific embodiment, the first server receives data, monitors the memory condition of the first server through the gopprof monitoring module, judges whether the sub-thread is activated, and if the sub-thread is not in an activated state, the first server calls a TCP communication interface of the second server, and the first server performs TCP communication with the second server through the main thread, namely, the first server performs TCP communication with the second server through the first channel, so that the sub-thread of the main thread is blocked, namely, no data is put into the second channel. The first server waits for the TCP response of the second server, and after receiving the response of the second server, the first server recovers the data transmitted by the first channel through a GC mechanism, and releases the memory occupied by the data.
When the monitoring result of the gopprof monitoring module finds that the first occupancy rate is larger than the preset opening amount and the second occupancy rate is larger than the preset total amount in a preset time period, namely, the memory occupancy rate of the first server is larger than the preset threshold value, the data amount received by the first server is overlarge, the monitoring module generates mark information and continuously inputs the mark information into the second channel, the main line Cheng Xunhuan detects whether the mark information exists in the second channel, when the main line detects the mark information in the second channel, the sub-thread is activated, data which is not input into the first channel is input into the second channel, the data is cached into the message queue through the second channel, at the moment, the first channel continuously keeps TCP communication until the data transmission in the first channel is completed, if the memory occupancy rate detected by the first server is still larger than the preset threshold value, the data transmission is not carried out any more by the first channel, and the data received by the first server are all cached into the message queue through the second channel until the detection finds that the memory occupancy rate of the first server is continuously smaller than the preset threshold value. The first server automatically releases the data memory after the communication through the message queue. The method completes the dynamic expansion of the first server, enlarges the maximum processing capacity of the first server, and prevents the problems of data loss and server response of the first server caused by communication peaks.
The second server receives the instruction data sent by the first server through the first channel through the TCP communication interface, extracts the instruction data from the message queue through the consumer, blocks the consumer when no data exists in the message queue, and starts the consumer to extract the data from the message queue when the instruction data exists in the message queue.
When the monitoring result of the gopprof monitoring module finds that the first occupancy is continuously smaller than the preset opening amount and the second occupancy is continuously smaller than the preset total amount within the preset time, namely the memory occupancy of the first server is smaller than the preset threshold value, the monitoring module is forbidden to throw the mark information into the second channel, the main thread does not detect the mark information in the second channel, the second channel is blocked, the sub-thread is in an inactive state, the first server recalls the TCP communication interface of the second server, data are thrown into the first channel, and data transmission is carried out with the second server through TCP communication.
FIG. 1 is a flow chart of a communication data processing method in one embodiment. It should be understood that, although the steps in the flowchart of fig. 1 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 1 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the sub-steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of other steps or sub-steps of other steps.
In one embodiment, as shown in fig. 2, there is provided a communication data processing apparatus including:
A first detection module 310, configured to detect a memory occupancy of a first server, to obtain a first memory occupancy, where the first server includes the first channel and the second channel;
And the activation module 320 is configured to generate an activation instruction for activating the second channel when the first channel is in a communication state, the second channel is in an inactive state, and the first memory occupancy is greater than or equal to a preset threshold, and execute the activation instruction, so that the second channel transmits data in the first server, which is not put into the first channel, and the data transmitted by the second channel is buffered to a message queue.
In one embodiment, the apparatus further comprises:
And the first channel transmission module is used for transmitting the data which is put into the first channel by adopting the first channel when the first channel is in a communication state, the second channel is in an inactive state and the first memory occupancy is greater than or equal to a preset threshold value.
In one embodiment, the apparatus further comprises:
the second detection module is used for detecting the memory occupancy rate of the first server after the second channel is activated to obtain a second memory occupancy rate;
And the second blocking module is used for generating a second instruction when the second memory occupancy is smaller than the preset threshold value, and executing the second instruction, wherein the second instruction is used for blocking the second channel so as to enable the second channel to be in an inactive state.
In one embodiment, the memory occupancy includes a first occupancy and a second occupancy, the apparatus further comprising:
the first occupancy rate detection module is used for detecting the memory space opened by the first server in a preset time period to obtain the first occupancy rate;
And the second occupancy rate detection module is used for detecting all memory occupancy rates in the first server to obtain the second occupancy rate.
In one embodiment, the apparatus further comprises:
a state receiving module for receiving a data processing state of the data transmitted through the first server;
And the recycling module is used for generating recycling instructions when the data processing state of the current data is transmission completion, wherein the recycling instructions are used for recycling the memories corresponding to the current data.
In one embodiment, the apparatus further comprises:
The standard information generation module is used for generating mark information and placing the mark information into the second channel;
The mark detection module is used for detecting whether the mark information exists in the sub-thread or not through the main thread;
And the execution module is used for executing the step of generating an activation instruction for activating the second channel when the mark information exists.
FIG. 3 illustrates an internal block diagram of a computer device in one embodiment. The computer device may in particular be the first server (or the second server 120) in fig. 1. As shown in fig. 3, the computer device includes a processor, a memory, a network interface, an input device, and a display screen connected by a system bus. The memory includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system, and may also store a computer program that, when executed by a processor, causes the processor to implement a communication data processing method. The internal memory may also have stored therein a computer program which, when executed by the processor, causes the processor to perform the communication data processing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 3 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, the communication data processing apparatus provided by the present application may be implemented in the form of a computer program that is executable on a computer device as shown in fig. 3. The memory of the computer device may store various program modules that make up the communication data processing apparatus, such as the first detection module 310 and the activation module 320 shown in fig. 2. The computer program constituted by the respective program modules causes the processor to execute the steps in the communication data processing method of the respective embodiments of the present application described in the present specification.
The computer device shown in fig. 3 may obtain the first memory occupancy by performing the detection of the memory occupancy of the first server by the first detection module 310 in the communication data processing apparatus shown in fig. 2, where the first server includes the first channel and the second channel. The computer device may execute, through the activation module 320, when the first channel is in a communication state, the second channel is in an inactive state, and the first memory occupancy is greater than or equal to a preset threshold, generate an activation instruction for activating the second channel, and execute the activation instruction, so that the second channel transmits data in the first server, where the data in the first channel is not put into the data in the second channel, and the data transmitted in the second channel is cached in a message queue.
In one embodiment, a computer device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of when executing the computer program: detecting the memory occupancy of a first server to obtain a first memory occupancy, wherein the first server comprises the first channel and the second channel; when the first channel is in a communication state, the second channel is in an unactivated state, and the first memory occupancy is greater than or equal to a preset threshold, an activation instruction for activating the second channel is generated, and the activation instruction is executed, so that the second channel transmits data which is not input into the first channel in the first server, and the data transmitted by the second channel is cached to a message queue.
In one embodiment, the processor when executing the computer program further performs the steps of: and after the second channel is activated, transmitting the data which is put into the first channel by adopting the first channel.
In one embodiment, the processor when executing the computer program further performs the steps of: after the second channel is activated, detecting the memory occupancy of the first server to obtain a second memory occupancy; and when the second memory occupancy is smaller than the preset threshold, generating a second instruction, and executing the second instruction, wherein the second instruction is used for blocking the second channel so as to enable the second channel to be in an inactive state.
In one embodiment, the processor when executing the computer program further performs the steps of: the memory occupancy rate comprises a first occupancy rate and a second occupancy rate, and the memory space opened by the first server in a preset time period is detected to obtain the first occupancy rate; and detecting all memory occupancy rates in the first server to obtain the second occupancy rate.
In one embodiment, the processor when executing the computer program further performs the steps of: a data processing state for receiving data transmitted by the first server; and when the data processing state of the current data is that the transmission is completed, generating a recycling instruction, wherein the recycling instruction is used for recycling the memory corresponding to the current data.
In one embodiment, the processor when executing the computer program further performs the steps of: after activating the second channel, generating flag information, and placing the flag information into the second channel; detecting whether the mark information exists in the sub thread or not through the main thread; and when the mark information exists, executing the step of generating an activation instruction for activating the second channel.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of: detecting the memory occupancy of a first server to obtain a first memory occupancy, wherein the first server comprises the first channel and the second channel; when the first channel is in a communication state, the second channel is in an unactivated state, and the first memory occupancy is greater than or equal to a preset threshold, an activation instruction for activating the second channel is generated, and the activation instruction is executed, so that the second channel transmits data which is not input into the first channel in the first server, and the data transmitted by the second channel is cached to a message queue.
In one embodiment, the computer program when executed by the processor further performs the steps of: and after the second channel is activated, transmitting the data which is put into the first channel by adopting the first channel.
In one embodiment, the computer program when executed by the processor further performs the steps of: the memory occupancy rate comprises a first occupancy rate and a second occupancy rate, and the memory space opened by the first server in a preset time period is detected to obtain the first occupancy rate; and detecting all memory occupancy rates in the first server to obtain the second occupancy rate.
In one embodiment, the computer program when executed by the processor further performs the steps of: after the second channel is activated, detecting the memory occupancy of the first server to obtain a second memory occupancy; and when the second memory occupancy is smaller than the preset threshold, generating a second instruction, and executing the second instruction, wherein the second instruction is used for blocking the second channel so as to enable the second channel to be in an inactive state.
In one embodiment, the computer program when executed by the processor further performs the steps of: after activating the second channel, generating flag information, and placing the flag information into the second channel; detecting whether the mark information exists in the sub thread or not through the main thread; and when the mark information exists, executing the step of generating an activation instruction for activating the second channel.
In one embodiment, the computer program when executed by the processor further performs the steps of: a data processing state for receiving data transmitted by the first server; and when the data processing state of the current data is that the transmission is completed, generating a recycling instruction, wherein the recycling instruction is used for recycling the memory corresponding to the current data.
Those skilled in the art will appreciate that all or part of the processes in the methods of the above embodiments may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a non-volatile computer readable storage medium, and where the program, when executed, may include processes in the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing is only a specific embodiment of the invention to enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (9)
1. A method of communication data processing, the method comprising:
Detecting the memory occupancy of a first server to obtain a first memory occupancy, wherein the first server comprises a first channel and a second channel;
When the first channel is in a communication state, the second channel is in an unactivated state, and the first memory occupancy is greater than or equal to a preset threshold value, generating an activation instruction for activating the second channel, and executing the activation instruction to enable the second channel to transmit data, which is not input into the first channel, in the first server, and the data transmitted by the second channel are cached to a message queue;
before executing the activation instruction, the method includes:
Generating flag information, and placing the flag information into the second channel;
detecting whether the mark information exists in the second channel through a main thread;
and when the main thread detects that the mark information exists in the second channel, activating a sub-thread and executing the activation instruction.
2. The method of claim 1, wherein after said activating said second channel, said method further comprises:
and transmitting the data which is put into the first channel by adopting the first channel.
3. The method of claim 1, wherein after said activating said second channel, said method further comprises:
Detecting the memory occupancy rate of the first server to obtain a second memory occupancy rate;
And when the second memory occupancy is smaller than the preset threshold, generating a second instruction, and executing the second instruction, wherein the second instruction is used for blocking the second channel so as to enable the second channel to be in an inactive state.
4. The method of claim 1, wherein the memory occupancy comprises a first occupancy and a second occupancy, and wherein detecting the memory occupancy of the first server comprises:
detecting the memory space opened by the first server within a preset time period to obtain the first occupancy rate;
and detecting all memory occupancy rates in the first server to obtain the second occupancy rate.
5. The method according to claim 1, wherein the method further comprises:
A data processing state for receiving data transmitted over the first channel;
and when the data processing state of the current data is that the transmission is completed, generating a recycling instruction, wherein the recycling instruction is used for recycling the memory corresponding to the current data.
6. The method of claim 1, wherein the data transfer of the first channel is performed by a main thread and the data transfer of the second channel is performed by a sub-thread of the main thread.
7. A communication data processing apparatus, the apparatus comprising:
The first detection module is used for detecting the memory occupancy of a first server to obtain a first memory occupancy, and the first server comprises a first channel and a second channel;
The activation module is used for generating an activation instruction for activating the second channel when the first channel is in a communication state, the second channel is in an unactivated state and the first memory occupancy is greater than or equal to a preset threshold value, and executing the activation instruction so that the second channel transmits data which are not input into the first channel in the first server, and the data transmitted by the second channel are cached in a message queue;
The apparatus further comprises:
The standard information generation module is used for generating mark information and placing the mark information into the second channel;
a mark detection module, configured to detect whether the mark information exists in the second channel through a main thread;
And the execution module is used for activating a sub-thread and executing the activation instruction when the main thread detects that the mark information exists in the second channel.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 6 when the computer program is executed by the processor.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010588618.XA CN111858088B (en) | 2020-06-24 | 2020-06-24 | Communication data processing method, device, computer equipment and storage medium |
PCT/CN2020/140014 WO2021258696A1 (en) | 2020-06-24 | 2020-12-28 | Communication data processing method and apparatus, computer device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010588618.XA CN111858088B (en) | 2020-06-24 | 2020-06-24 | Communication data processing method, device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111858088A CN111858088A (en) | 2020-10-30 |
CN111858088B true CN111858088B (en) | 2024-06-14 |
Family
ID=72989263
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010588618.XA Active CN111858088B (en) | 2020-06-24 | 2020-06-24 | Communication data processing method, device, computer equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111858088B (en) |
WO (1) | WO2021258696A1 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111858088B (en) * | 2020-06-24 | 2024-06-14 | 珠海格力电器股份有限公司 | Communication data processing method, device, computer equipment and storage medium |
CN115550080B (en) * | 2022-09-19 | 2024-09-24 | 苏州浪潮智能科技有限公司 | Network card, data transmission system, method, computer equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6625117B1 (en) * | 1999-09-30 | 2003-09-23 | International Business Machines Corporation | Method and apparatus for switching messages from a primary message channel to a secondary message channel in a message queuing system |
CN104579770A (en) * | 2014-12-30 | 2015-04-29 | 华为技术有限公司 | Method and device for managing data transmission channels |
Family Cites Families (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4644175B2 (en) * | 2006-10-10 | 2011-03-02 | 日本放送協会 | ACCESS LOAD CONTROL DEVICE, ITS PROGRAM, AND POST RECEPTION SYSTEM |
CN101373990B (en) * | 2008-09-23 | 2012-09-05 | 北京星网锐捷网络技术有限公司 | Method and apparatus for link backup |
CN103390049A (en) * | 2013-07-23 | 2013-11-13 | 南京联创科技集团股份有限公司 | Method for processing high-speed message queue overflow based on memory database cache |
CN104038439B (en) * | 2014-06-18 | 2017-05-24 | 中国工商银行股份有限公司 | Message flow control method and system |
CN108243047B (en) * | 2016-12-27 | 2023-01-10 | 中兴通讯股份有限公司 | Service switching method, device and system |
CN107105015B (en) * | 2017-03-31 | 2020-11-27 | 北京奇艺世纪科技有限公司 | Data stream shunting method and device |
CN109189577B (en) * | 2018-08-31 | 2020-05-19 | 武汉达梦数据库有限公司 | Method and device for preventing memory overflow during data synchronization |
CN109344137A (en) * | 2018-10-09 | 2019-02-15 | 广东网安科技有限公司 | A log storage method and system |
CN110943998B (en) * | 2019-12-04 | 2022-02-01 | 腾讯科技(深圳)有限公司 | Signal transmission method, device, equipment and medium |
CN111858088B (en) * | 2020-06-24 | 2024-06-14 | 珠海格力电器股份有限公司 | Communication data processing method, device, computer equipment and storage medium |
-
2020
- 2020-06-24 CN CN202010588618.XA patent/CN111858088B/en active Active
- 2020-12-28 WO PCT/CN2020/140014 patent/WO2021258696A1/en active Application Filing
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6625117B1 (en) * | 1999-09-30 | 2003-09-23 | International Business Machines Corporation | Method and apparatus for switching messages from a primary message channel to a secondary message channel in a message queuing system |
CN104579770A (en) * | 2014-12-30 | 2015-04-29 | 华为技术有限公司 | Method and device for managing data transmission channels |
Also Published As
Publication number | Publication date |
---|---|
CN111858088A (en) | 2020-10-30 |
WO2021258696A1 (en) | 2021-12-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108376118B (en) | Service distribution system, method, device and storage medium | |
CN109684105B (en) | Method, apparatus and storage medium for controlling requests under micro-service architecture | |
CN108495195B (en) | Network live broadcast ranking list generation method, device, equipment and storage medium | |
CN111858088B (en) | Communication data processing method, device, computer equipment and storage medium | |
CN110719318A (en) | Message processing method and system | |
US11922059B2 (en) | Method and device for distributed data storage | |
CN109669877B (en) | Memory management method, device, terminal and storage medium | |
CN114629883B (en) | Service request processing method and device, electronic equipment and storage medium | |
CN108446172B (en) | Data calling method and device, computer equipment and storage medium | |
CN112650575B (en) | Resource scheduling method, device and cloud service system | |
CN110532205A (en) | Data transmission method, device, computer equipment and computer readable storage medium | |
CN103218307A (en) | Memory management system and memory management method | |
CN102594860A (en) | Mixing synchronous and asynchronous data streams | |
CA2604448A1 (en) | Method and system for centralized memory management in wireless terminal devices | |
CN109522113B (en) | Memory management method and device | |
CN103024058A (en) | Method and system for invoking web services | |
CN110333916A (en) | Request message processing method, device, computer system and readable storage medium storing program for executing | |
KR101056613B1 (en) | Automatic upload method of terminal contents through wireless network, system and automatic upload interface server of terminal contents | |
CN108241616B (en) | Message pushing method and device | |
CN117453423B (en) | GPU video memory management method and system, storage medium and electronic equipment | |
CN118796442A (en) | Memory recovery method, device, electronic device and computer-readable storage medium | |
CN112667467A (en) | Cluster self-adaptive current limiting method and device, computer equipment and storage medium | |
CN111880945A (en) | Shared device information processing method, system, device, computer and storage medium | |
CN114281525B (en) | Transaction task asynchronous deleting method, device, equipment and readable storage medium | |
CN111274176B (en) | Information processing method, electronic equipment, system and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |