CN111381955A - Method for optimizing decision engine throughput rate and response time - Google Patents

Method for optimizing decision engine throughput rate and response time Download PDF

Info

Publication number
CN111381955A
CN111381955A CN201811617064.0A CN201811617064A CN111381955A CN 111381955 A CN111381955 A CN 111381955A CN 201811617064 A CN201811617064 A CN 201811617064A CN 111381955 A CN111381955 A CN 111381955A
Authority
CN
China
Prior art keywords
task
queue
current
response time
request
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.)
Pending
Application number
CN201811617064.0A
Other languages
Chinese (zh)
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.)
Wuxi Zhidao Anying Technology Co ltd
Original Assignee
Wuxi Zhidao Anying 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 Wuxi Zhidao Anying Technology Co ltd filed Critical Wuxi Zhidao Anying Technology Co ltd
Priority to CN201811617064.0A priority Critical patent/CN111381955A/en
Publication of CN111381955A publication Critical patent/CN111381955A/en
Pending legal-status Critical Current

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/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/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/5022Mechanisms to release resources
    • 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/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation

Abstract

The invention provides a method for optimizing the throughput rate and the response time of a decision engine, which comprises the following processing flows: the first step is as follows: using a task buffer pool of a blocking queue to create a task, initializing the task, putting the task into the queue, taking out and assigning a value of the task at the head position to the current task, and finishing initialization; the second step is that: when the request comes, the request is processed by using the current task, and when the modulo of a request counter and a threshold value is 0, the current task is cancelled; the third step: generating a new task to be put into a queue; the fourth step: and merging the logged-out task and the generated task into a queue. The invention constructs the task buffer pool, avoids the garbage recovery operation of JVM caused by a large amount of garbage generated by requesting to execute task deletion every time, and realizes batch centralized destruction in a mode of fetching the module, thereby avoiding the instability of the rule engine response time caused by garbage recovery under high concurrency of the system.

Description

Method for optimizing decision engine throughput rate and response time
Technical Field
The invention mainly relates to the field of decision engines, in particular to a method for optimizing decision engine throughput rate and response time.
Background
The decision engine is derived from a rule-based expert system, developed by an inference engine, is an independent module or component widely used in the Internet industry, realizes the separation of business decisions from application program codes, uses a predefined semantic module to compile business decisions, receives data input, interprets business rules, and makes business decisions according to the business rules. The decision engine mainly comprises three parts, a rule base, a fact base (working memory) and an inference engine. The functional positioning of the middleware of the decision engine determines that the decision engine carries important tasks, most of the working decision engine frameworks are already realized, but when a specific business scene is implemented, the inherent problem of the frameworks is more and more obvious, namely the problem of the processing efficiency of the frameworks in a high-throughput scene.
In an actual service scene, a real object is frequently placed into a task at high concurrency, and the fact object is destroyed through an API (application programming interface), so that frequent JVM (Java virtual machine) GC garbage collection is brought to reduce the response efficiency of a system, and system TPS (TPS) and response time frequently fluctuate.
The published Chinese invention patent, application number CN201480065605.7, patent name: quality of experience optimization using a policy-based decision engine, application date: 20141124, the present invention describes a system and method for managing the configuration of a network application (e.g., a network multiplayer game). The optimization server determines the configuration of the web application, e.g. information about the mapping between the user and the application server. The optimization server receives a plurality of state parameters, such as a load parameter and a delay parameter. The optimization server applies the quality of experience policy to decide whether to change the configuration of the network. The optimization server operates to send instructions to implement the change to the configuration of the web application.
Disclosure of Invention
The invention provides a method for optimizing the throughput rate and the response time of a decision engine, aiming at the defects in the prior art, the method for optimizing the throughput rate and the response time of the decision engine comprises the following processing flows:
the first step is as follows: using a task buffer pool of a blocking queue to create a task, initializing the task, putting the task into the queue, taking out and assigning a value of the task at the head position to the current task, and finishing initialization;
the second step is that: when the request comes, the request is processed by using the current task, and when the modulo of a request counter and a threshold value is 0, the current task is cancelled;
the third step: generating a new task to be put into a queue, acquiring a task positioned at the head from the task buffer pool, taking out and assigning a value to the task and the current task, and continuously processing the rule execution request;
the fourth step: and merging the logged-out task and the generated task into a queue.
Preferably, the number of task buffer pools in the first step is 3.
Preferably, in the second step, all the fact objects associated with the current task are logged out at the same time when the current task is logged out.
Preferably, the threshold value in the second step is selected according to the machine performance, the service scene and the task.
Preferably, the logout and the generation of the task in the fourth step are realized by adopting an asynchronous thread mode.
Preferably, the processing flow in the task processor buffer pool includes the following steps:
the first step is as follows: creating a task processor buffer pool, and endowing a current task by a task processor positioned at the head in the buffer pool;
the second step is that: the current task processor processes the task request, and the counter is increased by 1;
the third step: when the counter of the current request takes the modulus of the threshold value as 0, the current task processor is cancelled, and the task processor is asynchronously generated through the thread and is put into the tail part of the queue for queuing;
the fourth step: specifying the next current task processor: a new task processor is fetched from the queue.
Preferably, in the third step, the current task is annotated: means that the current task has accumulated enough memory to be recycled.
The invention has the beneficial effects that: the task buffer pool is constructed, the phenomenon that a large amount of garbage is generated when a request is sent to execute task deletion every time, so that garbage recycling operation of JVM is caused is avoided, and batch centralized destruction is carried out in a mode of fetching a module, so that the instability of rule engine response time caused by garbage recycling under high concurrency of a system is avoided.
Drawings
FIG. 1 is a diagram illustrating the effect of the present invention;
Detailed Description
As shown in FIG. 1, the present invention comprises the following process flow:
the first step is as follows: using a task buffer pool of a blocking queue to create a task, initializing the task, putting the task into the queue, taking out and assigning a value of the task at the head position to the current task, and finishing initialization;
the second step is that: when the request comes, the request is processed by using the current task, and when the modulo of a request counter and a threshold value is 0, the current task is cancelled;
the third step: generating a new task to be put into a queue, acquiring a task positioned at the head from the task buffer pool, taking out and assigning a value to the task and the current task, and continuously processing the rule execution request;
the fourth step: and merging the logged-out task and the generated task into a queue.
In use, according to the method shown in fig. 1, the TPS stabilized around 8000, the system stabilized and the response time stabilized in the jmeter test curve of the rule engine pressure test.
In this embodiment, the number of task buffer pools in the first step is preferably 3.
The above-mentioned quantity is set, in the buffer pool,
the number is 1, and the new generation can process the next task after the logout, and the intermittence that the service can not be provided to the outside exists;
the number is 2, theoretically feasible, but has certain risk, that is to say, the task is more, and the occasion that pressure is great has certain probability, takes place 1 and 2 and handles after certain task and the mould is 0 the back destroyed, leads to the unable externally provided intermittence of server, because 1 and 2 are asynchronous formation, can't guarantee the chronogenesis.
The risk of the intermittent time window which cannot provide service for the outside is greatly reduced when the number is 3;
the number >3, the probability has decreased to an acceptable range, without having to open a larger buffer pool and wasting memory space to store more processor objects.
In this embodiment, it is preferable that all the facts associated with the current task are logged out at the same time as the current task is logged out in the second step.
The steps are set, all information related to the task is directly cleared, and frequent generation of garbage is avoided.
Preferably, in the present embodiment, the threshold value in the second step is selected according to the machine performance, the service scenario, and the task.
The threshold value is related to the following information:
1. the performance of the machine, generally, the more the number of cores of the CPU is, the higher the main frequency is, the threshold value can be properly increased, so that the processor in one buffer pool can process more tasks and then destroy the tasks (because the CPU has strong capability, the number of tasks can be increased in consideration of the time dimension);
2. if a task is light (e.g., only comparing a value constant to an input variable is equal), that is, there is no time overhead for memory application/garbage collection, or even there may be no overhead for reading memory data (directly hitting the cache of the CPU), the threshold may be increased (because the processing task is simple, there may be many more tasks to do in consideration of the processing efficiency dimension).
In this embodiment, preferably, the cancellation and generation of the task in the fourth step are implemented in an asynchronous thread manner.
Adopting a synchronous processing mode to finish destroying → generating a new processor → reprocessing the subsequent request.
If the asynchronous processing mode is adopted, the subsequent request is immediately processed by directly utilizing the new processor in the buffer pool, and meanwhile, the action of destroying/generating the new object is carried out asynchronously by utilizing other CPUs and threads, so that the new processor is destroyed/generated, and the action does not influence the subsequent rule execution request.
In this embodiment, the processing flow in the task processor buffer pool preferably includes the following steps:
the first step is as follows: creating a task processor buffer pool, and endowing a current task by a task processor positioned at the head in the buffer pool;
the second step is that: the current task processor processes the task request, and the counter is increased by 1;
the third step: when the counter of the current request takes the modulus of the threshold value as 0, the current task processor is cancelled, and the task processor is asynchronously generated through the thread and is put into the tail part of the queue for queuing;
the fourth step: specifying the next current task processor: a new task processor is fetched from the queue.
By setting the processing flow, the invention utilizes a mechanism of a knowledge set-based session buffer pool (knowledgy-basedsession pool) instead of destroying the fact object in a mode of a task api every time, so that a use mode that the fact object is frequently placed into the task at high concurrency and destroyed through the api is avoided from the source, but if the fact object is not destroyed all the time, a serious OOM problem (the problem of crash of a JAVA virtual machine caused by insufficient memory) is introduced.
Preferably in this implementation, the third step is to register the current task: means that the current task has accumulated enough memory to be recycled.
By the aid of the structure, the cancelled tasks are recovered, occupied memory is reduced, CPU occupation ratio is avoided being wasted, interruption is avoided, and response time is shortened.
The above-described embodiments are merely illustrative of the principles and utilities of the present patent application and are not intended to limit the present patent application. Modifications and variations can be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of this patent application. Accordingly, it is intended that all equivalent modifications or changes which can be made by those skilled in the art without departing from the spirit and technical concepts disclosed in the present application shall be covered by the claims of this patent application.

Claims (7)

1. A method for optimizing decision engine throughput and response time, comprising the following process flows:
the first step is as follows: using a task buffer pool of a blocking queue to create a task, initializing the task, putting the task into the queue, taking out and assigning a value of the task at the head position to the current task, and finishing initialization;
the second step is that: when the request comes, the request is processed by using the current task, and when the modulo of a request counter and a threshold value is 0, the current task is cancelled;
the third step: generating a new task to be put into a queue, acquiring a task positioned at the head from the task buffer pool, taking out and assigning a value to the task and the current task, and continuously processing the rule execution request;
the fourth step: and merging the logged-out task and the generated task into a queue.
2. The method of optimizing decision engine throughput and response time of claim 1, wherein: and the number of the task buffer pools in the first step is 3.
3. The method of optimizing decision engine throughput and response time of claim 1, wherein: and in the second step, all the fact objects related to the current task are logged out at the same time of logging out the current task.
4. The method of optimizing decision engine throughput and response time of claim 1, wherein: and selecting the threshold value in the second step according to the machine performance, the service scene and the task.
5. The method of optimizing decision engine throughput and response time of claim 1, wherein: and the fourth step is that the cancellation and the generation of the task are realized by adopting an asynchronous thread mode.
6. The method of optimizing decision engine throughput and response time of claim 1, wherein: the processing flow in the task processor buffer pool comprises the following steps:
the first step is as follows: creating a task processor buffer pool, and endowing a current task by a task processor positioned at the head in the buffer pool;
the second step is that: the current task processor processes the task request, and the counter is increased by 1;
the third step: when the counter of the current request takes the modulus of the threshold value as 0, the current task processor is cancelled, and the task processor is asynchronously generated through the thread and is put into the tail part of the queue for queuing;
the fourth step: specifying the next current task processor: a new task processor is fetched from the queue.
7. The method of optimizing decision engine throughput and response time of claim 6, wherein: in the third step, the current task is annotated: means that the current task has accumulated enough memory to be recycled.
CN201811617064.0A 2018-12-28 2018-12-28 Method for optimizing decision engine throughput rate and response time Pending CN111381955A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811617064.0A CN111381955A (en) 2018-12-28 2018-12-28 Method for optimizing decision engine throughput rate and response time

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811617064.0A CN111381955A (en) 2018-12-28 2018-12-28 Method for optimizing decision engine throughput rate and response time

Publications (1)

Publication Number Publication Date
CN111381955A true CN111381955A (en) 2020-07-07

Family

ID=71216669

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811617064.0A Pending CN111381955A (en) 2018-12-28 2018-12-28 Method for optimizing decision engine throughput rate and response time

Country Status (1)

Country Link
CN (1) CN111381955A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588316A (en) * 2004-06-29 2005-03-02 北京大学 Property optimizing method for applying server
US20080104319A1 (en) * 2006-10-30 2008-05-01 Microsoft Corporation Dynamic database memory management policies
CN108256647A (en) * 2017-12-20 2018-07-06 东软集团股份有限公司 Rule performs request processing method, device, storage medium and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588316A (en) * 2004-06-29 2005-03-02 北京大学 Property optimizing method for applying server
US20080104319A1 (en) * 2006-10-30 2008-05-01 Microsoft Corporation Dynamic database memory management policies
CN108256647A (en) * 2017-12-20 2018-07-06 东软集团股份有限公司 Rule performs request processing method, device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
US11379272B2 (en) Autoscaling using file access or cache usage for cluster machines
JP5245722B2 (en) Scheduler, processor system, program generation device, and program generation program
CN109445944B (en) DPDK-based network data acquisition and processing system and method thereof
US9558034B2 (en) Entitlement vector for managing resource allocation
CN110806923A (en) Parallel processing method and device for block chain tasks, electronic equipment and medium
US20130111491A1 (en) Entitlement vector with resource and/or capabilities fields
US20130111489A1 (en) Entitlement vector for managing resource allocation
US20180189350A1 (en) Streaming data processing method, streaming data processing device and memory medium
US20120324454A1 (en) Control Flow Graph Driven Operating System
US20130047162A1 (en) Efficient cache reuse through application determined scheduling
US20130024867A1 (en) Resource allocation using a library with entitlement
US8255911B2 (en) System and method for selecting and assigning a basic module with a minimum transfer cost to thread
US9875141B2 (en) Managing pools of dynamic resources
US20130081043A1 (en) Resource allocation using entitlement hints
CN109542642A (en) A kind of method and device of front-end task processing
US20080320291A1 (en) Concurrent exception handling
US7337443B2 (en) Method and apparatus for processing program threads
Muller et al. Responsive parallel computation: Bridging competitive and cooperative threading
Huh et al. Cross‐layer resource control and scheduling for improving interactivity in Android
Agrawal et al. Scheduling parallelizable jobs online to minimize the maximum flow time
US20080320275A1 (en) Concurrent exception handling
US9229716B2 (en) Time-based task priority boost management using boost register values
CN110413210B (en) Method, apparatus and computer program product for processing data
Audibert et al. A case for disaggregation of ml data processing
Xue et al. V10: Hardware-Assisted NPU Multi-tenancy for Improved Resource Utilization and Fairness

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