Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Network request scheduling method, terminal device and storage medium

A network request and scheduling method technology, applied in the direction of multi-program device, resource allocation, program control design, etc., can solve problems affecting the normal use of application programs, heavy CPU load, network request timeout, etc., to achieve reduced occupancy, reduced Effects of consumption, safeguard activation and use

Pending Publication Date: 2020-05-08
WUHAN DOUYU NETWORK TECH CO LTD
View PDF6 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

When the application starts, if there are too many concurrent network requests, it will occupy a large amount of CPU, causing the network requests to time out
[0003] The current network request scheduler can only execute network requests concurrently. Each network request creates a new thread to perform the request work. Once there are too many network request operations, the number of generated threads is also large, so the CPU is overloaded, resulting in some network requests. Timeout, affecting the normal use of the application

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
  • Network request scheduling method, terminal device and storage medium
  • Network request scheduling method, terminal device and storage medium
  • Network request scheduling method, terminal device and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0031] figure 1 The schematic diagram of the principle of thread scheduling provided by the embodiment of the present invention is described in detail as follows:

[0032] A thread is a single sequential control flow in a program, in which there is a relatively independent and schedulable execution unit, which is the basic unit of the system to independently schedule and dispatch the CPU, and the scheduling unit of the program when the instruction is running. A thread can perform a specific operation, such as making a network request.

[0033] After a thread is created, the thread will switch between different states. The states of the thread generally include: idle 110 , waiting 120 and running 130 . The states of threads can be switched between each other. For example, when the thread is executed, it will enter the idle state (or blocked state), and when the idle thread is called, it can enter the running state.

[0034] Usually a thread can be blocked after executing some...

Embodiment 2

[0038] see figure 2 , an embodiment of the network request scheduling method in the embodiment of the present invention includes:

[0039] S20. When the application starts, schedule the network request generated by the application through a custom task scheduler;

[0040] The application program refers to software written for a certain application, that is, a common client APP or the like, and specifically refers to application software that initiates a network request when the application program is started. The network request refers to an instruction to request specific data from a server through a network connection. The network request usually requires the CPU to execute the request instruction, and each network request is equivalent to a network request task to be executed by the CPU.

[0041] The task scheduler specifically refers to a set of methods for scheduling network requests. Preferably, the task scheduler is a custom Rxjava scheduler.

[0042] Optionally, the...

Embodiment 5

[0084] Figure 5 It is a schematic diagram of the structure of an application self-starting terminal device provided by an embodiment of the present invention. The terminal device is a mobile computer device with a touch screen, including but not limited to smart phones, smart watches, notebooks, tablet computers, POS machines and even vehicle-mounted computers. Such as Figure 5 As shown, the terminal device 5 of this embodiment includes: a memory 510, a processor 520, and a system bus 530. The memory 510 includes an executable program 5101 stored thereon. Those skilled in the art can understand that, Figure 5 The structure of the terminal device shown in the above does not constitute a limitation to the terminal device, and may include more or less components than shown in the figure, or combine some components, or arrange different components.

[0085] Combine below Figure 5 A detailed introduction to each component of the terminal device:

[0086] The memory 510 can ...

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 invention discloses a network request scheduling method, a terminal device and a storage medium, which are used for scheduling user network requests. The method provided by the invention comprisesthe following steps: when an application program is started, scheduling a generated network request through a self-defined task scheduler; specifically, judging whether the current idle thread queueis empty or not, and if not, enabling the working thread to execute the network request; if yes, judging whether the number of threads in the work thread queue exceeds the size of the thread pool or not, if not, newly establishing a work thread to join the work thread queue, executing the network request, and if yes, adding the network request to the task queue; and when task execution of the working thread is completed, setting expiration time of the working thread. According to the method and the device, the CPU consumption and the network bandwidth occupation caused by thread execution canbe greatly reduced, so that all network requests can be quickly and effectively executed, and quick and normal starting and use of an application program are guaranteed.

Description

technical field [0001] The invention relates to the field of application development, in particular to a network request scheduling method, a terminal device and a storage medium. Background technique [0002] When the application starts, it is often necessary to add various network requests. These network requests generally request the latest data from the server and load it on the client. When the application starts, if there are too many concurrent network requests, it will occupy a large amount of CPU, causing the network requests to time out. [0003] The current network request scheduler can only execute network requests concurrently. Each network request creates a new thread to perform the request work. Once there are too many network request operations, the number of generated threads is also large, so the CPU is overloaded, resulting in some network requests. Timeout affects the normal use of the application. Contents of the invention [0004] The embodiment of ...

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
IPC IPC(8): G06F9/50
CPCG06F9/5038G06F2209/5018
Inventor 张兴国
Owner WUHAN DOUYU NETWORK TECH CO LTD
Features
  • Generate Ideas
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More