CN109451076B - Network request merging processing method and device and electronic equipment - Google Patents

Network request merging processing method and device and electronic equipment Download PDF

Info

Publication number
CN109451076B
CN109451076B CN201811653934.XA CN201811653934A CN109451076B CN 109451076 B CN109451076 B CN 109451076B CN 201811653934 A CN201811653934 A CN 201811653934A CN 109451076 B CN109451076 B CN 109451076B
Authority
CN
China
Prior art keywords
batch processing
network requests
queue
network
merging
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
Application number
CN201811653934.XA
Other languages
Chinese (zh)
Other versions
CN109451076A (en
Inventor
张艳能
唐伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuomi Private Ltd
Original Assignee
Zhuomi Private Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Zhuomi Private Ltd filed Critical Zhuomi Private Ltd
Priority to CN201811653934.XA priority Critical patent/CN109451076B/en
Publication of CN109451076A publication Critical patent/CN109451076A/en
Application granted granted Critical
Publication of CN109451076B publication Critical patent/CN109451076B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/56Queue scheduling implementing delay-aware scheduling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/625Queue scheduling characterised by scheduling criteria for service slots or service orders
    • H04L47/6255Queue scheduling characterised by scheduling criteria for service slots or service orders queue load conditions, e.g. longest queue first
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/62Establishing a time schedule for servicing the requests

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention discloses a method and a device for merging and processing network requests and electronic equipment, relates to the technical field of network communication, and can improve the network request speed. The method comprises the following steps: judging whether a batch processing mode is started or not; if the batch processing mode is started, the network request is put into a first queue; judging whether preset batch processing conditions are met or not; and if the preset batch processing conditions are met, merging the network requests in the first queue. The invention is suitable for the terminal equipment.

Description

Network request merging processing method and device and electronic equipment
Technical Field
The present invention relates to the field of network communication technologies, and in particular, to a method and an apparatus for merging network requests, and an electronic device.
Background
Most of the existing application programs need to send more than 30 network requests to a server through Web Service when loading pages, the network requests are queued in a request management queue, one network request occupies one request channel and is sent to the server in sequence, wherein, Web Service is also called XML Web Service, Web Service is a light-weight independent communication technology which can receive requests transmitted from an Intemet or other systems on the Intanet; the Web Service technology can ensure that different applications running on different machines can exchange data or be integrated with each other without additional and special third-party software or hardware. Applications implemented according to the Web Service specification may exchange data with each other regardless of the language, platform, or internal protocol used by them.
The existing method for requesting the network service has the problems of low loading speed and poor user experience when an application program loads a page due to the limited number of request channels.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for merging network requests, and an electronic device, which can improve a network request speed and improve user experience.
In a first aspect, an embodiment of the present invention provides a method for merging network requests, where the method is applied to a terminal device, and the method includes: judging whether a batch processing mode is started or not; if the batch processing mode is started, the network request is put into a first queue; judging whether preset batch processing conditions are met or not; and if the preset batch processing conditions are met, merging the network requests in the first queue.
According to a specific implementation manner of the embodiment of the present invention, the determining whether the preset batch processing condition is satisfied includes: judging whether the number of the network requests put into the first queue reaches a first threshold value or whether the duration of starting the batch processing mode reaches a second threshold value; and if the number of the network requests put into the first queue reaches a first threshold value or the starting time of the batch processing mode reaches a second threshold value, determining that the preset batch processing condition is met.
According to a specific implementation manner of the embodiment of the present invention, before determining whether the batch processing mode is started, the method further includes: judging whether the number of the current network requests exceeds a third threshold value; and if the current network request quantity exceeds a third threshold value, judging whether a batch processing mode is started or not.
According to a specific implementation manner of the embodiment of the present invention, the method further includes: if the batch processing mode is not started, the network request is put into a second queue; judging whether an idle sending channel exists or not; and if the idle sending channel exists, merging the network requests in the second queue.
According to a specific implementation manner of the embodiment of the present invention, the determining whether the batch processing mode is started includes: judging whether the network request carries batch processing mark information or not; and if the network request carries batch processing mark information, determining that a batch processing mode is started for the network request.
According to a specific implementation manner of the embodiment of the present invention, before determining whether the batch processing mode is started, the method further includes: batch flag information is injected for a predetermined network request.
In a second aspect, an embodiment of the present invention provides a device for merging network requests, where the device is applied to a terminal device, and the device includes: the batch processing judging module is used for judging whether a batch processing mode is started or not; the first operation module is used for placing the network request into a first queue if the batch processing mode is started; the first condition judgment module is used for judging whether a preset batch processing condition is met or not; and the first merging module is used for merging the network requests in the first queue if the preset batch processing condition is met.
According to a specific implementation manner of the embodiment of the present invention, the first condition determining module is configured to: judging whether the number of the network requests put into the first queue reaches a first threshold value or whether the duration of starting the batch processing mode reaches a second threshold value; and if the number of the network requests put into the first queue reaches a first threshold value or the starting time of the batch processing mode reaches a second threshold value, determining that the preset batch processing condition is met.
According to a specific implementation manner of the embodiment of the present invention, the apparatus further includes: a third threshold judgment module, configured to judge whether the number of current network requests exceeds a third threshold; and the batch processing judging module is used for judging whether a batch processing mode is started or not if the number of the current network requests exceeds a third threshold value.
According to a specific implementation manner of the embodiment of the present invention, the apparatus further includes: the second operation module is used for placing the network request into a second queue if the batch processing mode is not started; the idle channel judging module is used for judging whether an idle sending channel exists or not; and the second merging module is used for merging the network requests in the second queue if an idle sending channel exists.
According to a specific implementation manner of the embodiment of the present invention, the determining whether the batch processing mode is started by the batch processing determining module includes: judging whether the network request carries batch processing mark information or not; and if the network request carries batch processing mark information, determining that a batch processing mode is started for the network request.
According to a specific implementation manner of the embodiment of the present invention, the merging processing apparatus includes an injection module, and the injection module is configured to inject batch processing flag information into a predetermined network request.
In a third aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space enclosed by the shell, and the processor and the memory are arranged on the circuit board; a power supply circuit for supplying power to each circuit or device of the electronic apparatus; the memory is used for storing executable program codes; the processor executes the program corresponding to the executable program code by reading the executable program code stored in the memory, and is used for executing the method of any one of the foregoing implementation modes.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium storing one or more programs, which are executable by one or more processors to implement the method according to any one of the embodiments of the present invention.
The embodiment of the invention provides a method, a device and electronic equipment for merging network requests, which are applied to terminal equipment and used for judging whether a batch processing mode is started or not; if the batch processing mode is started, the network request is put into a first queue; judging whether preset batch processing conditions are met or not; if the preset batching conditions are met, merging the network requests in the first queue, and directly sending the merged network requests to a server without queuing for sending a channel; the network request speed can be improved, and the user experience is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart illustrating a method for merging network requests according to a first embodiment of the present invention;
fig. 2 is a flowchart illustrating an alternative implementation of a method for merging network requests according to a first embodiment of the present invention;
fig. 3 is a flowchart illustrating a merging processing method for network requests according to an alternative embodiment of the present invention;
fig. 4 is a flowchart illustrating a merging processing method for network requests according to a first alternative embodiment of the present invention;
fig. 5 is a schematic structural diagram of a merging processing device for network requests according to a second embodiment of the present invention;
fig. 6 is a schematic structural diagram of another alternative implementation of a network request merge processing apparatus according to a second embodiment of the present invention;
fig. 7 is a schematic structural diagram of a merging processing device for network requests according to a second embodiment of the present invention;
fig. 8 is a schematic structural diagram of an embodiment of an electronic device according to the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In a first aspect, the present embodiment provides a method for merging network requests, so as to improve a network request speed and improve user experience.
Fig. 1 is a flowchart illustrating a method for merging network requests according to a first embodiment of the present invention, and as shown in fig. 1, the present embodiment is applied to a terminal device. The method of the embodiment comprises the following steps:
step 101, judging whether a batch processing mode is started or not;
in this embodiment, most of the existing applications need to send more than 30 network requests to the server through a Web Service (the Web Service is also called XML Web Service, which is a lightweight independent communication technology capable of receiving requests transmitted from other systems on the Internet or Intranet), and the Web Service technology can enable different applications running on different machines to exchange data or integrate with each other without additional and special third-party software or hardware. The existing method for requesting the network service has the problems of low loading speed and poor user experience when an application program loads a page due to the limited number of request channels. The invention can carry out batch processing on the network requests sent by the application program, namely, a batch processing mode is started on the network requests, the batch processing in the invention means that the network requests are accumulated to a certain number and are submitted to the server once again, the interaction times with the server are reduced, and the network request speed is greatly improved. Alternatively, the batch mode may utilize a scheme of a transaction mechanism (beginBatch/commit Batch) to merge network requests in the middle of beginBatch to commit Batch. A transaction refers to a group of operations logically, and each unit forming the group of operations is not successful or not successful; the network request is processed in a mode of combining batch processing and a transaction mechanism, and the speed of the network request is further improved.
As an optional implementation manner of the embodiment of the present invention, before determining whether the batch processing mode is turned on, the method further includes: batch flag information is injected for a predetermined network request.
In this embodiment, according to the service requirements of each module in the application program, for example: the browser comprises modules such as latest movies, mini games and novel major and the like, and batch processing mark information can be injected into the mini game modules in advance for the mini game modules with more network requests, so that when the small game modules are loaded by the browser, the network requests sent by the mini game modules are subjected to batch processing and then sent to the server, a request channel is not occupied, and therefore flow is saved and network request response time is reduced; for the small and large modules with small quantity of network requests, batch processing identification information is not injected, and the network requests are directly queued for sending. The scheme provided by the embodiment can be flexibly set according to the service requirement, so that one part of network requests are sent to the server after being subjected to batch processing, and the other part of network requests are sent to the server through the request channel, and the resources of the client can be fully utilized.
Or dividing network requests with similar or related functions into the same module, and injecting batch processing mark information into the network requests so as to synchronize the time of the application program responding to the network requests of the module, so that the display interface is neat and ordered, and the user experience is improved.
As an optional implementation manner of the embodiment of the present invention, the step 101 includes: judging whether the network request carries batch processing mark information or not; and if the network request carries batch processing mark information, determining that a batch processing mode is started for the network request.
In the embodiment, batch processing mark information is injected into the network requests in advance, so that which network requests need to be subjected to batch processing and which network requests do not need to be subjected to batch processing can be conveniently and quickly distinguished; compared with the scheme of randomly starting the batch processing mode, the method has higher pertinence, ensures that the network request processing mode is more reasonable and efficient, and is beneficial to reasonably utilizing the resources of the client.
In this embodiment, the batch mode may be started by calling a beginBatch function, and if the batch mode is started, step 102 is executed.
Step 102, if the batch processing mode is started, putting the network request into a first queue;
in this embodiment, if it is determined in step 101 that the batch processing mode is started, the network request after the batch processing mode is started is placed in the first queue. And if the batch processing adopts a transaction mechanism, the first queue is a transaction queue.
Step 103, judging whether preset batch processing conditions are met;
in this embodiment, the network requests are batched, and when the network requests in the first queue meet a preset batching condition, the current network requests in the first queue are merged.
As shown in fig. 2, as an optional implementation manner of the embodiment of the present invention, the determining whether the preset batch processing condition is met includes:
step 1031, judging whether the number of the network requests put into the first queue reaches a first threshold value or judging whether the duration of starting the batch processing mode reaches a second threshold value;
step 1032, if the number of the network requests put into the first queue reaches a first threshold, or the duration of the batch processing mode starting reaches a second threshold, it is determined that the preset batch processing condition is met.
In this embodiment, whether the network requests placed in the first queue satisfy the preset batching condition or not can be judged by presetting the number of the network requests or presetting the time length from the earliest network request entering the first queue to the current time, or judging whether the network requests placed in the first queue satisfy the preset batching condition or not by combining the two network requests; the number of the merged network requests can be reasonably set by presetting the first threshold, and the time for waiting for the network requests in each batch can be reasonably set by presetting the second threshold; therefore, the network request speed can be effectively improved. The preset batch processing conditions are not limited in this embodiment, and can be set correspondingly according to actual needs.
For example: the application program A sends 30 network requests through the Web service, and under the condition that the batch processing mode is started, the preset batch processing conditions are set as follows: the number of the current network requests in the first queue is 8 or the time length from the first network request entering the current transaction queue to the current time is greater than B. If the number of the current network requests in the first queue reaches 8, or the time length from the current time to the first network request entering the current transaction queue is greater than B, the preset batch processing condition is met, and step 104 is executed. Therefore, 8 network requests are combined into a group and then sent to the server, the collision rate of the network requests is improved, the network requests only need to be sent to the server for 4 times, the response speed of the network requests is high, and the user experience is improved.
And step 104, if the preset batch processing conditions are met, merging the network requests in the first queue.
In this embodiment, if the network requests in the first queue meet the preset batch processing condition, merging the network requests in the first queue; according to the embodiment, a plurality of network requests can be merged and submitted to the server once again, and an idle sending channel does not need to be waited, so that the number of interaction times with the server is reduced, and the network request speed can be improved. In addition, the network requests in the designated batches are merged together by using a transaction mechanism, so that the collision rate of the merging of the network requests is improved, the efficiency is higher than that of random merging, and the designated task data can be returned at one time.
Optionally, the method of this embodiment further includes, after step 104:
and 105, submitting a batch of combined network requests to a server.
In this embodiment, the merged network request may be submitted by using an executeBatch function, so that the server returns the request data once, the number of times of interaction between the network request and the server is reduced, and the network request speed can be increased.
As another alternative implementation of the embodiment of the present invention, as shown in fig. 3, the method includes:
step 201, judging whether a batch processing mode is started;
in this embodiment, the method and the implementation principle for determining whether to start the batch processing mode are similar to those described in step 101, and are not described herein again.
Step 202, if the batch processing mode is not started, the network request is put into a second queue;
in this embodiment, the second queue is a request management queue, and if the batch processing mode is not started, the network request is placed in the request management queue for queuing.
Step 203, judging whether an idle sending channel exists;
and step 204, if an idle sending channel exists, merging the network requests in the second queue.
In this embodiment, when an idle sending channel exists, merging the network requests in the second queue, and sending the merged network requests to the server through the idle sending channel; for example: the number of the sending channels is 4, the first 4 network requests sent by the application program respectively occupy one sending channel, after one network request returns data, the sending channel occupied by the network request is idle, at this time, the network requests in the current second queue are merged and sent to the server through the idle sending channel, and so on, until all the network requests sent by the application program are sent to the server. Compared with the method for sending the network requests one by one through the sending channels, the method for merging the network requests in the embodiment reduces the number of times of interaction with the server and improves the speed of the network requests.
As shown in fig. 4, as a further alternative implementation of the embodiment of the present invention, the method includes:
step 301, judging whether the number of the current network requests exceeds a third threshold value;
in this embodiment, the third threshold may be set in advance, for example, the third threshold is set to 6, and if the number of the current network requests is less than 6, the number of the current network requests is small; and if the number of the current network requests is more than 6, the number of the current network requests is more. Judging whether the number of the current network requests exceeds a third threshold value, and if the number of the current network requests exceeds the third threshold value, executing the step 302; if the number of the current network requests does not exceed the third threshold, the network requests can be directly put into the request management queue and sent to the server through the sending channel, and at this time, because the number of the network requests is small, the waiting time of the network requests in the request management queue is short, the network requests do not need to be executed with combination processing, and the running resources of the terminal equipment can be effectively saved.
Step 302, if the number of the current network requests exceeds a third threshold, judging whether a batch processing mode is started;
in this embodiment, if the number of the current network requests exceeds the third threshold, the number of the current network requests is large, and the network request speed can be increased by adopting a merging processing mode for the current network requests. At this time, whether a batch processing mode is started is judged, if the batch processing mode is not started, the current network request is put into a request management queue, and the network request merging method shown in fig. 3 is executed; if the batch mode is enabled, step 303 is performed.
Step 303, if the batch processing mode is started, putting the network request into a first queue;
in this embodiment, if the batch processing mode is started, the method and the implementation principle for placing the network request into the first queue are similar to those described in step 102, and are not described herein again.
Step 304, judging whether preset batch processing conditions are met;
in this embodiment, the method and the implementation principle for determining whether the preset batch processing condition is satisfied are similar to those described in step 103, and are not described herein again.
And 305, if the preset batch processing condition is met, merging the network requests in the first queue.
In this embodiment, if the preset batch processing condition is satisfied, the method and the implementation principle for merging the network requests in the first queue are similar to those described in step 103, and are not described herein again.
As an optional implementation manner of the embodiment of the present invention, the determining, by the batch processing determining module, whether the batch processing mode is started includes: judging whether the network request carries batch processing mark information or not; and if the network request carries batch processing mark information, determining that a batch processing mode is started for the network request.
In this embodiment, according to the service requirements of each module in the application program, for example: the browser comprises modules such as latest movies, mini games and novel major and the like, and batch processing mark information can be injected into the mini game modules in advance for the mini game modules with more network requests, so that when the small game modules are loaded by the browser, the network requests sent by the mini game modules are subjected to batch processing and then sent to the server, a request channel is not occupied, and therefore flow is saved and network request response time is reduced; for the small and large modules with small quantity of network requests, batch processing identification information is not injected, and the network requests are directly queued for sending. The scheme provided by the embodiment can be flexibly set according to the service requirement, so that one part of network requests are sent to the server after being subjected to batch processing, and the other part of network requests are sent to the server through the request channel, and the resources of the client can be fully utilized.
Or dividing network requests with similar or related functions into the same module, and injecting batch processing mark information into the network requests so as to synchronize the time of the application program responding to the network requests of the module, so that the display interface is neat and ordered, and the user experience is improved.
As an optional implementation manner of the embodiment of the present invention, the merging processing apparatus includes an injection module, and the injection module is configured to inject batch processing flag information into a predetermined network request.
In the embodiment, batch processing mark information is injected into the network requests in advance, so that which network requests need to be subjected to batch processing and which network requests do not need to be subjected to batch processing can be conveniently and quickly distinguished; compared with the scheme of randomly starting the batch processing mode, the method has higher pertinence, ensures that the network request processing mode is more reasonable and efficient, and is beneficial to reasonably utilizing the resources of the client.
In a second aspect, the present embodiment provides a merging processing device for network requests, so as to improve the network request speed and improve the user experience.
Fig. 5 is a schematic structural diagram of a merging processing device for network requests according to a second embodiment of the present invention, and as shown in fig. 5, the present embodiment is applied to a terminal device. The device of the embodiment comprises: a batch processing judging module 41, configured to judge whether a batch processing mode is turned on; a first operation module 42, configured to place the network request into a first queue if the batch processing mode is started; a first condition judgment module 43, configured to judge whether a preset batch processing condition is met; the first merging module 44 is configured to merge the network requests in the first queue if a preset batching condition is met.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 1, and the implementation principle and the technical effect are similar, which are not described herein again.
As shown in fig. 6, as an optional implementation manner of the embodiment of the present invention, the first condition determining module 53 is specifically configured to: judging whether the number of the network requests put into the first queue reaches a first threshold value or whether the duration of starting the batch processing mode reaches a second threshold value; and if the number of the network requests put into the first queue reaches a first threshold value or the starting time of the batch processing mode reaches a second threshold value, determining that the preset batch processing condition is met.
The apparatus of this embodiment may be used to implement the technical solutions of the method embodiments shown in fig. 1 or fig. 2, and the implementation principles and technical effects are similar, which are not described herein again.
As shown in fig. 7, as another alternative implementation of the embodiment of the present invention, the apparatus further includes: a second operation module 65, configured to, if the batch processing mode is not started, place the network request into a second queue; an idle channel determining module 66, configured to determine whether an idle sending channel exists; and a second merging module 67, configured to merge the network requests in the second queue if there is an idle sending channel.
The apparatus of this embodiment may be used to implement the technical solutions of the method embodiments shown in fig. 1 or fig. 3, and the implementation principles and technical effects are similar, which are not described herein again.
As shown in fig. 8, as a further alternative implementation of the embodiment of the present invention, the apparatus further includes: a third threshold determining module 71, configured to determine whether the number of current network requests exceeds a third threshold; the batch processing determining module 72 is configured to determine whether a batch processing mode is started if the number of the current network requests exceeds a third threshold.
The apparatus of this embodiment may be used to implement the technical solutions of the method embodiments shown in fig. 1 or fig. 4, and the implementation principles and technical effects are similar, which are not described herein again.
In a third aspect, fig. 8 is a schematic structural diagram of an embodiment of an electronic device of the present invention, which may implement the flows shown in fig. 1 to 4 of the present invention, and as shown in fig. 8, the electronic device may include: the device comprises a shell 71, a processor 72, a memory 73, a circuit board 74 and a power circuit 75, wherein the circuit board 74 is arranged inside a space enclosed by the shell 71, and the processor 72 and the memory 73 are arranged on the circuit board 74; a power supply circuit 75 for supplying power to each circuit or device of the electronic apparatus; the memory 73 is used to store executable program code; the processor 72 executes a program corresponding to the executable program code by reading the executable program code stored in the memory 73, for performing any of the embodiments described above.
For the specific execution process of the above steps by the processor 72 and the steps further executed by the processor 72 by running the executable program code, reference may be made to the description of the embodiment shown in fig. 1 to 4 of the present invention, which is not described herein again.
The electronic device exists in a variety of forms, including but not limited to:
(1) a mobile communication device: such devices are characterized by mobile communications capabilities and are primarily targeted at providing voice, data communications. Such terminals include: smart phones (e.g., iphones), multimedia phones, functional phones, and low-end phones, among others.
(2) Ultra mobile personal computer device: the equipment belongs to the category of personal computers, has calculation and processing functions and generally has the characteristic of mobile internet access. Such terminals include: PDA, MID, and UMPC devices, etc., such as ipads.
(3) A portable entertainment device: such devices can display and play multimedia content. This type of device comprises: audio, video players (e.g., ipods), handheld game consoles, electronic books, and smart toys and portable car navigation devices.
(4) A server: the device for providing the computing service comprises a processor, a hard disk, a memory, a system bus and the like, and the server is similar to a general computer architecture, but has higher requirements on processing capacity, stability, reliability, safety, expandability, manageability and the like because of the need of providing high-reliability service.
(5) And other electronic equipment with data interaction function.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium storing one or more programs, which are executable by one or more processors to implement the method according to any one of the embodiments of the present invention.
It should be noted that, in this document, relational terms such as first and second, and the like are used only for description
One entity or operation is distinguished from another entity or operation by no means required or implied
There may be any such actual relationship or order between the entities or operations. Also, the terms "include", "bag" and the like
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. The term "comprising", without further limitation, means that the element so defined is not excluded from the group consisting of additional identical elements in the process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments.
In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
For convenience of description, the above devices are described separately in terms of functional division into various units/modules. Of course, the functionality of the units/modules may be implemented in one or more software and/or hardware implementations of the invention.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A merging processing method for network requests is applied to terminal equipment, and the method comprises the following steps:
judging whether a batch processing mode is started or not;
if the batch processing mode is started, the network request is put into a first queue;
judging whether preset batch processing conditions are met or not;
if the preset batch processing conditions are met, merging the network requests in the first queue;
if the batch processing mode is not started, the network request is put into a second queue;
judging whether an idle sending channel exists or not;
if an idle sending channel exists, merging the network requests in the second queue;
before determining whether the batch mode is turned on, the method further comprises:
judging whether the number of the current network requests exceeds a third threshold value;
if the number of the current network requests exceeds a third threshold value, judging whether a batch processing mode is started or not;
and if the number of the current network requests does not exceed the third threshold value, the network requests are placed into the second queue and are sent to a server through the sending channel.
2. The merging processing method according to claim 1, wherein the determining whether a preset batch processing condition is satisfied comprises:
judging whether the number of the network requests put into the first queue reaches a first threshold value or whether the duration of starting the batch processing mode reaches a second threshold value;
and if the number of the network requests put into the first queue reaches a first threshold value or the starting time of the batch processing mode reaches a second threshold value, determining that the preset batch processing condition is met.
3. The merging processing method according to claim 1, wherein the determining whether the batch mode is turned on comprises:
judging whether the network request carries batch processing mark information or not;
and if the network request carries batch processing mark information, determining that a batch processing mode is started for the network request.
4. The merging processing method according to claim 1, wherein before determining whether the batch mode is turned on, the method further comprises:
batch flag information is injected for a predetermined network request.
5. A merging processing apparatus for network requests, applied to a terminal device, the apparatus comprising:
the batch processing judging module is used for judging whether a batch processing mode is started or not;
the first operation module is used for placing the network request into a first queue if the batch processing mode is started;
the first condition judgment module is used for judging whether a preset batch processing condition is met or not;
the first merging module is used for merging the network requests in the first queue if the preset batch processing condition is met;
the second operation module is used for placing the network request into a second queue if the batch processing mode is not started;
the idle channel judging module is used for judging whether an idle sending channel exists or not;
the second merging module is used for merging the network requests in the second queue if an idle sending channel exists;
the device further comprises:
a third threshold judgment module, configured to judge whether the number of current network requests exceeds a third threshold;
the batch processing judging module is used for judging whether a batch processing mode is started or not if the number of the current network requests exceeds a third threshold value; and if the number of the current network requests does not exceed the third threshold value, the network requests are placed into the second queue and are sent to a server through the sending channel.
6. The merge processing apparatus according to claim 5, wherein the first conditional decision module is configured to:
judging whether the number of the network requests put into the first queue reaches a first threshold value or whether the duration of starting the batch processing mode reaches a second threshold value;
and if the number of the network requests put into the first queue reaches a first threshold value or the starting time of the batch processing mode reaches a second threshold value, determining that the preset batch processing condition is met.
7. The merging processing device according to claim 5, wherein the batch processing determining module determines whether a batch processing mode is turned on, comprising:
judging whether the network request carries batch processing mark information or not;
and if the network request carries batch processing mark information, determining that a batch processing mode is started for the network request.
8. The merge processing apparatus according to claim 5, wherein the merge processing apparatus includes an injection module configured to inject batch flag information for a predetermined network request.
9. An electronic device, characterized in that the electronic device comprises: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space enclosed by the shell, and the processor and the memory are arranged on the circuit board; a power supply circuit for supplying power to each circuit or device of the electronic apparatus; the memory is used for storing executable program codes; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, for performing the method of any one of the above claims 1-4.
10. A computer readable storage medium, characterized in that the computer readable storage medium stores one or more programs which are executable by one or more processors to implement the method of any of the preceding claims 1-4.
CN201811653934.XA 2018-12-29 2018-12-29 Network request merging processing method and device and electronic equipment Active CN109451076B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811653934.XA CN109451076B (en) 2018-12-29 2018-12-29 Network request merging processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811653934.XA CN109451076B (en) 2018-12-29 2018-12-29 Network request merging processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN109451076A CN109451076A (en) 2019-03-08
CN109451076B true CN109451076B (en) 2022-03-25

Family

ID=65542479

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811653934.XA Active CN109451076B (en) 2018-12-29 2018-12-29 Network request merging processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN109451076B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110347482B (en) * 2019-07-18 2021-07-23 哈尔滨汇拓投资中心(有限合伙) OLTP transaction combination rule and queue model improvement method based on OLTPShare
CN113590284A (en) * 2021-07-22 2021-11-02 济南浪潮数据技术有限公司 Cloud platform distributed component interaction task batch processing method, system and equipment
CN113364637A (en) * 2021-08-09 2021-09-07 中建电子商务有限责任公司 Network communication optimization method and system based on batch packing scheduling
CN113885902B (en) * 2021-08-23 2022-10-11 贝壳找房(北京)科技有限公司 Application program interface updating method
CN116483544B (en) * 2023-06-15 2023-09-19 阿里健康科技(杭州)有限公司 Task processing method, device, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105069163A (en) * 2015-08-26 2015-11-18 广州神马移动信息科技有限公司 Network request processing method and apparatus
CN106357503A (en) * 2016-08-19 2017-01-25 百度在线网络技术(北京)有限公司 Message processing method and instant communication server
CN106657193A (en) * 2015-11-02 2017-05-10 腾讯科技(深圳)有限公司 Request processing method, request processing device, terminal device and server

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102291324A (en) * 2011-06-28 2011-12-21 北京神州泰岳软件股份有限公司 Highly concurrent service request processing method
US20150067024A1 (en) * 2013-08-27 2015-03-05 Apple Inc. Autobatching

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105069163A (en) * 2015-08-26 2015-11-18 广州神马移动信息科技有限公司 Network request processing method and apparatus
CN106657193A (en) * 2015-11-02 2017-05-10 腾讯科技(深圳)有限公司 Request processing method, request processing device, terminal device and server
CN106357503A (en) * 2016-08-19 2017-01-25 百度在线网络技术(北京)有限公司 Message processing method and instant communication server

Also Published As

Publication number Publication date
CN109451076A (en) 2019-03-08

Similar Documents

Publication Publication Date Title
CN109451076B (en) Network request merging processing method and device and electronic equipment
WO2017185616A1 (en) File storage method and electronic equipment
WO2017185605A1 (en) File management method and electronic equipment
US20170171329A1 (en) Video recommendaton method and system, and server
US20170177255A1 (en) Method and electronic device for allocating dynamic memory resources
CN111240564B (en) Material display method and device, electronic equipment and storage medium
CN106803188A (en) The display methods of business operation, device and electronic equipment
WO2014146441A1 (en) Method, server and system for processing task data
CN112087487A (en) Model training task scheduling method and device, electronic equipment and storage medium
CN110889062A (en) Page loading method and device, terminal and computer readable storage medium
US20170155739A1 (en) Advertisement data processing method and router
CN107562432B (en) Information processing method and related product
US20170171339A1 (en) Advertisement data transmission method, electrnoic device and system
CN110675133A (en) Red packet robbing method and device, electronic equipment and readable storage medium
US20170168871A1 (en) Method and electronic device for triggering background task
CN111782294A (en) Application program running method and device, electronic equipment and storage medium
CN108833961A (en) Obtain method, server and the system of flight record data
CN109067864B (en) Notification message pushing method and device and electronic equipment
CN112153719B (en) Communication method, device, system and computer readable storage medium
CN112740178B (en) Small game access method and related equipment
CN110825994A (en) Page buffer processing method and device, computer equipment and storage medium
CN110688223A (en) Data processing method and related product
CN107347055B (en) User information processing method and device, storage medium and server
CN113824675B (en) Method and device for managing login state
CN112532661B (en) Method, device, equipment and medium for pairing connection between same video applications

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20190619

Address after: Room 1101, Santai Commercial Building, 139 Connaught Road, Hong Kong, China

Applicant after: Hong Kong Lemi Co., Ltd.

Address before: Cayman Islands, Greater Cayman Island, Camana Bay, Western Asia, Seitus Chamber of Commerce, 2547 Mailbox

Applicant before: Happy honey Company Limited

TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20210601

Address after: 25, 5th floor, shuangjingfang office building, 3 frisha street, Singapore

Applicant after: Zhuomi Private Ltd.

Address before: Room 1101, Santai Commercial Building, 139 Connaught Road, Hong Kong, China

Applicant before: HONG KONG LIVE.ME Corp.,Ltd.

GR01 Patent grant
GR01 Patent grant