CN110928580A - Asynchronous flow control method and device - Google Patents

Asynchronous flow control method and device Download PDF

Info

Publication number
CN110928580A
CN110928580A CN201911012488.9A CN201911012488A CN110928580A CN 110928580 A CN110928580 A CN 110928580A CN 201911012488 A CN201911012488 A CN 201911012488A CN 110928580 A CN110928580 A CN 110928580A
Authority
CN
China
Prior art keywords
amount
asynchronous
heap memory
asynchronous flow
flow control
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.)
Granted
Application number
CN201911012488.9A
Other languages
Chinese (zh)
Other versions
CN110928580B (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.)
Hangzhou Tangzhi Cosmic Technology Co ltd
Original Assignee
Reach Best Technology Co 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 Reach Best Technology Co Ltd filed Critical Reach Best Technology Co Ltd
Priority to CN201911012488.9A priority Critical patent/CN110928580B/en
Publication of CN110928580A publication Critical patent/CN110928580A/en
Application granted granted Critical
Publication of CN110928580B publication Critical patent/CN110928580B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3867Concurrent instruction execution, e.g. pipeline or look ahead using instruction pipelines
    • G06F9/3871Asynchronous instruction pipeline, e.g. using handshake signals between stages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure relates to an asynchronous flow control method, an asynchronous flow control device, an electronic device and a storage medium. The method comprises the following steps: determining the total amount of heap memory usable by an asynchronous process execution platform and the amount of used heap memory; determining the amount of the remaining heap memory which can be used according to the total amount of the heap memory and the used heap memory amount; determining the maximum concurrent number of the asynchronous flows which can be executed concurrently according to the residual heap memory amount and the memory amount consumed by executing the asynchronous flows once; and transmitting the maximum concurrent data into an asynchronous flow control module so that the asynchronous flow control module controls the quantity of the asynchronous flows concurrently executed in the execution platform.

Description

Asynchronous flow control method and device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an asynchronous flow control method and apparatus, an electronic device, and a storage medium.
Background
In the related art, when a computer executes a task, task processing efficiency is often improved by executing the task in parallel, for example, in node.
However, in the related art, the number of concurrent asynchronous flows cannot be accurately controlled, and if the number of concurrently executed asynchronous flows is too small, the remaining memory is wasted, and the concurrent efficiency is reduced; if the number of concurrently executing asynchronous processes is too large, memory overflow may result, possibly resulting in program crash.
Disclosure of Invention
The present disclosure provides an asynchronous flow control method, apparatus, electronic device, and storage medium to at least solve a problem in the related art that the number of concurrent asynchronous flows cannot be accurately controlled. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided an asynchronous flow control method, including:
determining the total amount of heap memory usable by an asynchronous process execution platform and the amount of used heap memory;
determining the amount of the remaining heap memory which can be used according to the total amount of the heap memory and the used heap memory amount;
determining the maximum concurrent number of the asynchronous flows which can be executed concurrently according to the residual heap memory amount and the memory amount consumed by executing the asynchronous flows once;
and transmitting the maximum concurrent data into an asynchronous flow control module so that the asynchronous flow control module controls the quantity of the asynchronous flows concurrently executed in the execution platform.
In an optional embodiment, the method further comprises:
when the asynchronous flow control module is executed for the first time after the asynchronous flow execution platform is established, determining the first used heap memory amount of the asynchronous flow execution platform;
when the asynchronous flow control module is executed for the second time, determining the second used heap memory amount of the asynchronous flow execution platform;
and determining the memory amount consumed by executing the asynchronous flow once according to the difference between the first used heap memory amount and the second used heap memory amount.
In an optional implementation manner, determining the remaining heap memory amount according to the total heap memory amount and the used heap memory amount specifically includes:
and determining the usable residual heap memory amount without safety risk according to the total heap memory amount, the used heap memory amount and the preset reserved memory amount.
In an optional embodiment, the maximum concurrency number is a ratio of the remaining heap memory amount to a memory amount consumed for executing the asynchronous flow once.
In an optional embodiment, the used heap memory amount is determined after the execution of the asynchronous flow is finished.
According to a second aspect of the embodiments of the present disclosure, there is provided an asynchronous flow control device, including:
the first determining unit is used for determining the total amount of heap memory usable by the asynchronous process execution platform and the used heap memory amount;
a second determining unit, configured to determine a remaining amount of the heap memory according to the total amount of the heap memory and the used heap memory amount;
a third determining unit, configured to determine, according to the remaining heap memory amount and the memory amount consumed by executing the asynchronous flow once, a maximum concurrent number of asynchronous flows that can also be executed concurrently;
and the transmitting unit transmits the maximum concurrent number to the asynchronous flow control module so that the asynchronous flow control module controls the number of the asynchronous flows which are executed concurrently in the execution platform.
In an alternative embodiment, the apparatus further comprises:
the first used heap memory amount determining unit is used for determining the first used heap memory amount of the asynchronous flow execution platform when the asynchronous flow control module is executed for the first time after the asynchronous flow execution platform is established;
a second used heap memory amount determining unit, configured to determine a second used heap memory amount of the asynchronous flow execution platform when the asynchronous flow control module is executed for a second time;
the asynchronous flow used memory amount determining unit determines the memory amount consumed by executing the asynchronous flow once according to the difference between the first used heap memory amount and the second used heap memory amount.
In an optional embodiment, the used heap memory amount is determined after the execution of the asynchronous flow is finished.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor; a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement any one of the asynchronous flow control methods of the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a storage medium, where instructions, when executed by a processor of an electronic device, enable the electronic device to perform any one of the asynchronous flow control methods of the first aspect.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product which, when run on an electronic device, causes the asynchronous flow control electronic device to perform: method steps of the asynchronous process control method of any of the first aspects above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
determining the total amount of heap memory usable by an asynchronous flow execution platform and the amount of used heap memory; determining the available residual heap memory amount according to the total heap memory amount and the used heap memory amount; determining the maximum concurrent number of the asynchronous flows which can be executed concurrently according to the residual heap memory amount and the memory amount consumed by executing the asynchronous flows once; and transmitting the maximum concurrent number into an asynchronous flow control module, wherein the asynchronous flow control module can control the number of the asynchronous flows which are executed concurrently in the execution platform. Therefore, the maximum number of the asynchronous flows which can be executed concurrently by the asynchronous flows can be accurately obtained, memory waste caused by too small number of the asynchronous flows which are executed concurrently can be avoided, and program crash caused by too large number of the asynchronous flows which are executed concurrently can also be avoided.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a flow chart illustrating an asynchronous flow control method in accordance with an exemplary embodiment.
FIG. 2 is a block diagram illustrating an asynchronous flow control device according to an exemplary embodiment.
FIG. 3 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Fig. 1 is a flow chart illustrating an asynchronous flow control method according to an exemplary embodiment, as shown in fig. 1, including the following steps.
In step S11, the total amount of heap memory usable by the asynchronous flow execution platform and the used amount of heap memory are determined.
The asynchronous flow execution platform can be used for executing asynchronous flows, a plurality of asynchronous flows can be independently executed in parallel without waiting for execution results of other flows, such as downloading tasks, sending http request tasks, uploading tasks and the like, and all the asynchronous flows have no precedence relationship.
When the asynchronous flow execution platform executes the asynchronous flow, heap memory is used, and generally, the total amount of the heap memory that can be used by the asynchronous flow execution platform is fixed, and certainly, the total amount of the heap memory can also be applied to be increased in some cases.
The used heap memory amount of the asynchronous flow execution platform is the used heap memory amount.
In step S12, the remaining heap memory amount is determined according to the total heap memory amount and the used heap memory amount.
The usable remaining heap memory amount may be a remaining heap memory amount that is not currently used, and may be obtained by a difference between the total heap memory amount and the used heap memory amount.
In step S13, the maximum concurrency number of the asynchronous processes that can be executed concurrently is determined according to the remaining heap memory amount and the memory amount consumed for executing the asynchronous processes once.
The maximum concurrency number may be the maximum number of asynchronous flows that can also be concurrently executed, and may be obtained by dividing the remaining heap memory amount by the memory amount consumed by executing the asynchronous flow once.
In step S14, the maximum concurrent number is transmitted to the asynchronous flow control module, so that the asynchronous flow control module controls the number of the asynchronous flows concurrently executed in the execution platform.
After the maximum concurrency number is obtained, the maximum concurrency number can be transmitted to the asynchronous flow control module, and the asynchronous flow control module can control the number of the asynchronous flows which are executed in the asynchronous flow execution platform in a concurrent mode according to the maximum concurrency number.
In the process, the total amount of heap memory usable by the asynchronous flow execution platform and the used heap memory amount are determined; determining the available residual heap memory amount according to the total heap memory amount and the used heap memory amount; determining the maximum concurrent number of the asynchronous flows which can be executed concurrently according to the residual heap memory amount and the memory amount consumed by executing the asynchronous flows once; and transmitting the maximum concurrent number into an asynchronous flow control module, wherein the asynchronous flow control module can control the number of the asynchronous flows which are executed concurrently in the execution platform. Therefore, the maximum number of the asynchronous flows which can be executed concurrently by the asynchronous flows can be accurately obtained, memory waste caused by too small number of the asynchronous flows which are executed concurrently can be avoided, and program crash caused by too large number of the asynchronous flows which are executed concurrently can also be avoided.
Along with the development of computer technology, more and more work is required to be undertaken by JavaScript, which is beyond the scope of form verification, and thus higher requirements are provided for quickly parsing and executing the JavaScript. The high-performance JavaScript engine 'Chrome V8' sourced by Google is used for solving the problem, and Chrome V8 is called V8 engine for short. Js a platform node running JavaScript may parse JavaScript based on the V8 engine. Js is a platform established based on Chrome JavaScript runtime.
In one or more embodiments of the present disclosure, the asynchronous process execution platform may be node.
Then, determining the total amount of heap memory usable by the asynchronous process execution platform and the amount of used heap memory may specifically include: acquiring the total heap memory occupation amount through a heapsotal parameter of a process. When the asynchronous flow is executed, the used heap memory amount is obtained through a heartbeat parameter of a process.
In one or more embodiments of the present disclosure, when the asynchronous flow execution platform executes the asynchronous flow control module for the first time after the asynchronous flow execution platform is established, it is determined that the first used heap memory amount of the asynchronous flow execution platform is used, at this time, the asynchronous flow control module controls execution of the asynchronous flow, but the asynchronous flow is not started to be executed at this time, that is, there is no asynchronous flow being executed in the asynchronous flow execution platform. And when the asynchronous flow control module is executed for the second time, determining the second used heap memory amount of the asynchronous flow execution platform. And determining the memory amount consumed by executing the asynchronous flow once according to the difference between the first used heap memory amount and the second used heap memory amount.
By respectively acquiring the used memory heap amount when the asynchronous flow control module is executed for the first time after the asynchronous flow execution platform is established and the used memory heap amount is executed for the second time, the memory amount required by executing the asynchronous flow for a single time can be accurately obtained, the accurate calculation of the concurrent number of the asynchronous distance is convenient to realize, the utilization of the memory can be realized more accurately, the memory waste caused by too few asynchronous flows executed concurrently can be avoided, and the program crash caused by too many asynchronous flows executed concurrently can also be avoided.
In one or more embodiments of the present description, the asynchronous flow execution platform may be a node.js, the asynchronous flow control module may be an async module, and in the application scenario, when determining the amount of memory that needs to be consumed for executing the asynchronous flow at a single time, the asynchronous flow execution platform may obtain a first used amount of memory through a heartbeat parameter of a process.memoryuage () method when executing the async module for the first time after establishing the asynchronous flow execution platform, and then obtain a second used amount of memory through the heartbeat parameter of the process.memoryuage () method when executing the async module for the second time, where a difference between the first used amount of memory and the second used amount of memory is the amount of memory that needs to be consumed for executing the asynchronous flow at a single time.
In one or more embodiments of the present disclosure, the remaining amount of heap memory that can be used without security risk may be determined according to the total amount of heap memory, the used heap memory amount, and a preset reserved memory amount. The preset reserved memory amount is used for executing other tasks except the concurrent asynchronous flow. Therefore, the problem that the concurrent asynchronous flow occupies the memory of other tasks, so that the memory overflow and other safety problems exist during the execution of other tasks is solved.
In one or more embodiments of the present disclosure, the amount of heap memory used is determined after the execution of the asynchronous flow is finished. That is, after the execution of the asynchronous flow is finished, the used heap memory amount may be determined again, then the usable remaining heap memory amount is determined according to the re-determined used heap memory amount and the total heap memory amount, and the maximum concurrency number of the asynchronous flow that can be executed concurrently is calculated. Thereby controlling the asynchronous flow control module through the asynchronous flow control module. The maximum concurrent number of the asynchronous flow can be determined in real time after the execution of the asynchronous flow is finished every time, so that the residual memory is automatically monitored, and the number of the asynchronous flows concurrently executed in the asynchronous flow execution platform is controlled.
In one or more embodiments of the present disclosure, the maximum concurrency number is a ratio of the remaining heap memory amount to a memory amount consumed for executing the asynchronous flow once.
FIG. 2 is a block diagram illustrating an asynchronous flow control device according to an exemplary embodiment. Referring to fig. 2, the apparatus includes a first determining unit 121, a second determining unit 122, a third determining unit 123, and an incoming unit 124.
The first determining unit 121 is configured to determine a total amount of heap memory usable by the asynchronous process execution platform and an amount of used heap memory;
the second determining unit 122 is configured to determine the remaining heap memory amount according to the total heap memory amount and the used heap memory amount;
the third determining unit 123 is configured to determine, according to the remaining heap memory amount and the memory amount consumed by executing the asynchronous flow once, a maximum concurrent number of the asynchronous flows that can also be executed concurrently;
the incoming unit 124 is configured to transmit the maximum concurrency number into the asynchronous flow control module so that the asynchronous flow control module controls the number of asynchronous flows concurrently executed in the execution platform.
The specific work flow of the above apparatus embodiment is that the first determining unit 121 is configured to determine a total amount of heap memory usable by the asynchronous flow execution platform and an amount of used heap memory, the second determining unit 122 is configured to determine a remaining amount of heap memory usable according to the total amount of heap memory and the amount of used heap memory, the third determining unit 123 is configured to determine a maximum concurrent number of asynchronous flows that can be concurrently executed according to the remaining amount of heap memory and an amount of memory consumed for executing an asynchronous flow at a time, and the transmitting unit 124 is configured to transmit the maximum concurrent number to the asynchronous flow control module, so that the asynchronous flow control module controls the number of asynchronous flows concurrently executed in the execution platform.
In one embodiment, the apparatus further comprises:
the first used heap memory amount determining unit is used for determining the first used heap memory amount of the asynchronous flow execution platform when the asynchronous flow control module is executed for the first time after the asynchronous flow execution platform is established;
a second used heap memory amount determining unit, configured to determine a second used heap memory amount of the asynchronous flow execution platform when the asynchronous flow control module is executed for a second time;
the asynchronous flow used memory amount determining unit determines the memory amount consumed by executing the asynchronous flow once according to the difference between the first used heap memory amount and the second used heap memory amount.
In an embodiment, the second determining unit specifically includes:
and determining the usable residual heap memory amount without safety risk according to the total heap memory amount, the used heap memory amount and the preset reserved memory amount.
In an embodiment, the maximum concurrency number is a ratio of the remaining heap memory amount to a memory amount consumed for executing the asynchronous flow once.
In one embodiment, the used heap memory amount is determined after the execution of the asynchronous flow is finished.
With regard to the apparatus in the above-described embodiment, the specific manner in which each unit performs the operation has been described in detail in the embodiment related to the method, and will not be described in detail here.
In the embodiment of the disclosure, the total amount of heap memory usable by an asynchronous process execution platform and the amount of used heap memory are determined by a first determining unit; the second determining unit may determine the remaining amount of the heap memory according to the total amount of the heap memory and the used amount of the heap memory; a third determining unit, configured to determine, according to the remaining heap memory amount and the memory amount consumed by executing the asynchronous flow once, a maximum concurrent number of the asynchronous flows that can also be executed concurrently; and the transmitting unit transmits the maximum concurrent number to the asynchronous flow control module, and the asynchronous flow control module can control the number of the asynchronous flows which are executed concurrently in the execution platform. Therefore, the maximum number of the asynchronous flows which can be executed concurrently by the asynchronous flows can be accurately obtained, memory waste caused by too small number of the asynchronous flows which are executed concurrently can be avoided, and program crash caused by too large number of the asynchronous flows which are executed concurrently can also be avoided.
An embodiment of the present disclosure further provides an electronic device, and the schematic diagram refers to fig. 3, where in a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (peripheral component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 3, but this does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the asynchronous flow control device on the logic level. A processor executing the program stored in the memory and configured to perform at least the following:
determining the total amount of heap memory usable by an asynchronous process execution platform and the amount of used heap memory;
determining the amount of the remaining heap memory which can be used according to the total amount of the heap memory and the used heap memory amount;
determining the maximum concurrent number of the asynchronous flows which can be executed concurrently according to the residual heap memory amount and the memory amount consumed by executing the asynchronous flows once;
and transmitting the maximum concurrent data into an asynchronous flow control module so that the asynchronous flow control module controls the quantity of the asynchronous flows concurrently executed in the execution platform.
The method executed by the asynchronous flow control device according to the embodiment shown in fig. 1 of the present application may be applied to a processor, or may be implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a network Processor (FP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present disclosure may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present disclosure may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The electronic device may further execute the method executed by the asynchronous flow control device in fig. 1, and implement the functions of the asynchronous flow control device in the embodiment shown in fig. 1, which are not described herein again in this disclosure.
The disclosed embodiments also provide a storage medium storing one or more programs, where the one or more programs include instructions, which when executed by an electronic device including a plurality of application programs, enable the electronic device to perform the method performed by the asynchronous flow control apparatus in the embodiment shown in fig. 1, and at least to perform:
determining the total amount of heap memory usable by an asynchronous process execution platform and the amount of used heap memory;
determining the amount of the remaining heap memory which can be used according to the total amount of the heap memory and the used heap memory amount;
determining the maximum concurrent number of the asynchronous flows which can be executed concurrently according to the residual heap memory amount and the memory amount consumed by executing the asynchronous flows once;
and transmitting the maximum concurrent data into an asynchronous flow control module so that the asynchronous flow control module controls the quantity of the asynchronous flows concurrently executed in the execution platform.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. An asynchronous flow control method, comprising:
determining the total amount of heap memory usable by an asynchronous process execution platform and the amount of used heap memory;
determining the amount of the remaining heap memory which can be used according to the total amount of the heap memory and the used heap memory amount;
determining the maximum concurrent number of the asynchronous flows which can be executed concurrently according to the residual heap memory amount and the memory amount consumed by executing the asynchronous flows once;
and transmitting the maximum concurrent data into an asynchronous flow control module so that the asynchronous flow control module controls the quantity of the asynchronous flows concurrently executed in the execution platform.
2. The method of claim 1, wherein the method further comprises:
when the asynchronous flow control module is executed for the first time after the asynchronous flow execution platform is established, determining the first used heap memory amount of the asynchronous flow execution platform;
when the asynchronous flow control module is executed for the second time, determining the second used heap memory amount of the asynchronous flow execution platform;
and determining the memory amount consumed by executing the asynchronous flow once according to the difference between the first used heap memory amount and the second used heap memory amount.
3. The method according to claim 1, wherein determining the remaining amount of heap memory that can be used according to the total amount of heap memory and the used amount of heap memory comprises:
and determining the usable residual heap memory amount without safety risk according to the total heap memory amount, the used heap memory amount and the preset reserved memory amount.
4. The method of claim 1,
the maximum concurrency number is a ratio of the remaining heap memory amount to the memory amount consumed by executing the asynchronous flow once.
5. The method of claim 1, wherein the amount of used heap memory is determined after the end of the execution of the asynchronous flow.
6. An asynchronous process control device, comprising:
the first determining unit is used for determining the total amount of heap memory usable by the asynchronous process execution platform and the used heap memory amount;
a second determining unit, configured to determine a remaining amount of the heap memory according to the total amount of the heap memory and the used heap memory amount;
a third determining unit, configured to determine, according to the remaining heap memory amount and the memory amount consumed by executing the asynchronous flow once, a maximum concurrent number of asynchronous flows that can also be executed concurrently;
and the transmitting unit transmits the maximum concurrent number to the asynchronous flow control module so that the asynchronous flow control module controls the number of the asynchronous flows which are executed concurrently in the execution platform.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the first used heap memory amount determining unit is used for determining the first used heap memory amount of the asynchronous flow execution platform when the asynchronous flow control module is executed for the first time after the asynchronous flow execution platform is established;
a second used heap memory amount determining unit, configured to determine a second used heap memory amount of the asynchronous flow execution platform when the asynchronous flow control module is executed for a second time;
the asynchronous flow used memory amount determining unit determines the memory amount consumed by executing the asynchronous flow once according to the difference between the first used heap memory amount and the second used heap memory amount.
8. The apparatus of claim 6, wherein the amount of used heap memory is determined after the end of the execution of the asynchronous flow.
9. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the asynchronous flow control method of any of claims 1 to 5.
10. A storage medium in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform the asynchronous flow control method of any of claims 1 to 5.
CN201911012488.9A 2019-10-23 2019-10-23 Asynchronous flow control method and device Active CN110928580B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911012488.9A CN110928580B (en) 2019-10-23 2019-10-23 Asynchronous flow control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911012488.9A CN110928580B (en) 2019-10-23 2019-10-23 Asynchronous flow control method and device

Publications (2)

Publication Number Publication Date
CN110928580A true CN110928580A (en) 2020-03-27
CN110928580B CN110928580B (en) 2022-06-24

Family

ID=69849261

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911012488.9A Active CN110928580B (en) 2019-10-23 2019-10-23 Asynchronous flow control method and device

Country Status (1)

Country Link
CN (1) CN110928580B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111880922A (en) * 2020-08-07 2020-11-03 北京达佳互联信息技术有限公司 Processing method, device and equipment for concurrent tasks

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1744725A (en) * 2004-08-31 2006-03-08 华为技术有限公司 Method for memorying data flow in single-board
US20060095425A1 (en) * 2003-04-28 2006-05-04 Collard Jean-Francois C Analyzing stored data
CN102508820A (en) * 2011-11-25 2012-06-20 中国人民解放军国防科学技术大学 Method for data correlation in parallel solving process based on cloud elimination equation of GPU (Graph Processing Unit)
CN103116618A (en) * 2013-01-28 2013-05-22 南开大学 Telefile system mirror image method and system based on lasting caching of client-side
CN107291556A (en) * 2017-08-01 2017-10-24 上海联影医疗科技有限公司 Medical supply and its memory allocation method, device and storage medium
CN107357656A (en) * 2017-06-27 2017-11-17 努比亚技术有限公司 A kind of memory allocation method, mobile terminal and computer-readable recording medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060095425A1 (en) * 2003-04-28 2006-05-04 Collard Jean-Francois C Analyzing stored data
CN1744725A (en) * 2004-08-31 2006-03-08 华为技术有限公司 Method for memorying data flow in single-board
CN102508820A (en) * 2011-11-25 2012-06-20 中国人民解放军国防科学技术大学 Method for data correlation in parallel solving process based on cloud elimination equation of GPU (Graph Processing Unit)
CN103116618A (en) * 2013-01-28 2013-05-22 南开大学 Telefile system mirror image method and system based on lasting caching of client-side
CN107357656A (en) * 2017-06-27 2017-11-17 努比亚技术有限公司 A kind of memory allocation method, mobile terminal and computer-readable recording medium
CN107291556A (en) * 2017-08-01 2017-10-24 上海联影医疗科技有限公司 Medical supply and its memory allocation method, device and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
关于夏天的一切: "现在 epoll 单机(4G内存)并发量最大能达到多少", 《HTTPS://WWW.ZHIHU.COM/QUESTION/30772664/ANSWER/49388303》 *
谢路辉: "并行连接算法优化研究及实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111880922A (en) * 2020-08-07 2020-11-03 北京达佳互联信息技术有限公司 Processing method, device and equipment for concurrent tasks

Also Published As

Publication number Publication date
CN110928580B (en) 2022-06-24

Similar Documents

Publication Publication Date Title
CN113672396B (en) Streaming computing job processing method and device
CN109951534B (en) Consensus method, device and system
WO2020168933A1 (en) Network request processing method, device, terminal and storage medium
CN103440172A (en) Resource management method and terminal device
CN110308880B (en) Log printing method, system, computer device and computer readable storage medium
CN110928580B (en) Asynchronous flow control method and device
CN112804682B (en) Data transmission method and device, readable medium and electronic equipment
CN113688602A (en) Task processing method and device
CN114217878A (en) Object loading method and system
US20220263869A1 (en) Data validation for zero copy protocols
CN112559155A (en) Batch job processing method, system, computer device and readable storage medium
CN103077081B (en) Method and device of adjusting resources
CN113746932B (en) Network request merging method, device, electronic device and computer program product
CN110928753A (en) Method and device for controlling log output of browser console, computer equipment and computer readable storage medium
CN110989978A (en) Page packaging method and device, electronic equipment and storage medium
CN113238855B (en) Path detection method and device
CN110661887B (en) Method and device for establishing communication link, communication system and server
CN108804311B (en) Method and device for executing test file
CN115270107B (en) Information verification method and device, readable medium and electronic equipment
CN110149356A (en) Method and device is uniformly processed in a kind of network request abnormality
CN116047958A (en) SENT sensor using method and SENT sensor device
CN118519731A (en) Chip verification method, device, equipment and storage medium
CN112783922B (en) Query method and device based on relational database
CN111142940B (en) Method, device, processor, chip and equipment for adapting processor and software
CN111399839B (en) VNF registration method, device, medium and equipment

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

Effective date of registration: 20221223

Address after: Room 2101, Xingguang City, No. 1766, Binsheng Road, Changhe Street, Binjiang District, Hangzhou, Zhejiang 310056

Patentee after: Hangzhou Tangzhi Cosmic Technology Co.,Ltd.

Address before: 101d1-7, 1st floor, building 1, No. 6, Shangdi West Road, Haidian District, Beijing 100085

Patentee before: Beijing Dajia Internet Information Technology Co.,Ltd.

TR01 Transfer of patent right