Unlock instant, AI-driven research and patent intelligence for your innovation.

An optimization method, computer equipment and storage medium

An optimization method and computer program technology, applied in the computer field, can solve problems such as process crash, and achieve the effect of improving stability and reducing the number of threads

Active Publication Date: 2021-05-28
WUHAN DOUYU NETWORK TECH CO LTD
View PDF6 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The embodiment of the present application can reduce the number of threads created for RPC communication instances by providing an optimization method, computer equipment, and storage media, thereby improving the stability of the program and solving the problem of too many threads in the prior art Issues that crash the entire process

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • An optimization method, computer equipment and storage medium
  • An optimization method, computer equipment and storage medium
  • An optimization method, computer equipment and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0064] see figure 1 , an optimization method provided in this embodiment includes the following steps:

[0065] S101. Create an RPC communication instance.

[0066] Specifically, creating an RPC communication instance includes: calling an RpcCreateInstance method to create an RPC instance. The prototype of the RpcCreateInstance function is as follows:

[0067] HRPC RpcCreateInstance(RpcTransferMethod method, bool isServer, RpcCallbackFunction, void*userData)

[0068] It can be seen that the function receives 4 parameters, the first parameter method indicates what kind of data communication method is used, the optional value includes RPM_NAMED_PIPE, which means that the named pipe is used for data transmission; and includes RPM_TCP_SOCKET, which means that TCP is used for data transmission ; Also includes RPM_UDP_SOCKET, which means UDP is used for data transmission.

[0069] The second parameter isServer indicates whether to create an RPC server instance. When this paramet...

Embodiment 2

[0100] see figure 2 , the optimization device provided in this embodiment includes:

[0101] A first creating unit 201, configured to create an RPC communication instance;

[0102]The first setting unit 202 is configured to set a first variable, the first variable is used to indicate whether to create the RPC main thread of the RPC communication instance, and the RPC main thread is used to handle the execution of the RPC task queue, wherein, by In the RpcBase class of the RPC module, the first variable of a bool type is added, and the initial value of the first variable is false, indicating that the RPC main thread needs to be created; if it is not necessary to create the RPC main thread, by calling The RpcSetProperty method of the RPC module changes the value of the first variable to true, indicating that the RPC main thread does not need to be created;

[0103] The second setting unit 203 is configured to set a second variable, the second variable is used to indicate whet...

Embodiment 3

[0111] This embodiment provides a computer-readable storage medium 300, the computer-readable storage medium 300 stores a computer program 311, and the computer program 311 implements the following steps when executed by a processor:

[0112] Create an RPC communication instance;

[0113] Set the first variable, the first variable is used to indicate whether to create the RPC main thread of the RPC communication instance, the RPC main thread is used to handle the execution of the RPC task queue, wherein, by adding in the RpcBase class of the RPC module The first variable of a bool type, the initial value of the first variable is false, indicating that the RPC main thread needs to be created; if the RPC main thread does not need to be created, the RpcSetProperty method of the RPC module will be called The value of the first variable is changed to true, indicating that the RPC main thread does not need to be created;

[0114] Set the second variable, the second variable is used...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The present invention provides an optimization method, including: by creating an RPC communication instance; setting a first variable, the first variable is used to indicate whether to create an RPC main thread of the RPC communication instance, and the RPC main thread is used for processing Execution of the RPC task queue; a second variable is set, and the second variable is used to indicate whether to create a transmission main thread of the RPC communication instance, and the transmission main thread is used to process data transmission; according to the first variable and The second variable determines whether to create the RPC main thread and the transmission main thread of the RPC communication instance; create an RPC global thread by initializing the RpcGlobal class of the RPC module; if it is determined not to create the RPC communication instance The RPC main thread and the transmission main thread call the RpcPollService function through the RPC global thread to process the execution of the RPC task queue and the data transmission of the RPC communication instance. The number of threads created for RPC communication instances can be reduced, thereby improving program stability.

Description

technical field [0001] The invention belongs to the technical field of computers, and in particular relates to an optimization method, computer equipment and storage media. Background technique [0002] RPC (Remote Procedure Call, remote method call) is a method of communication between two processes. In some applications, each time an RPC communication instance is created, multiple threads will be created in the system to execute the RPC task queue. and data transmission,. [0003] Since each RPC communication instance needs to create multiple threads, and threads are an important resource in the operating system, as more and more RPC communication instances are created in the process, the number of threads also increases. When the number of threads When the carrying capacity of system resources is exceeded, the creation of threads will fail, causing the entire process to crash. Contents of the invention [0004] The embodiment of the present application can reduce the ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F9/54
CPCG06F9/547
Inventor 杨亮张文明陈少杰
Owner WUHAN DOUYU NETWORK TECH CO LTD