CN104765638B - Concurrent module, operation system, prepackage method of completing the square and creation method - Google Patents

Concurrent module, operation system, prepackage method of completing the square and creation method Download PDF

Info

Publication number
CN104765638B
CN104765638B CN201410008811.6A CN201410008811A CN104765638B CN 104765638 B CN104765638 B CN 104765638B CN 201410008811 A CN201410008811 A CN 201410008811A CN 104765638 B CN104765638 B CN 104765638B
Authority
CN
China
Prior art keywords
unit
business result
concurrent
type
business
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
CN201410008811.6A
Other languages
Chinese (zh)
Other versions
CN104765638A (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.)
Ctrip Computer Technology Shanghai Co Ltd
Original Assignee
Ctrip Computer Technology Shanghai 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 Ctrip Computer Technology Shanghai Co Ltd filed Critical Ctrip Computer Technology Shanghai Co Ltd
Priority to CN201410008811.6A priority Critical patent/CN104765638B/en
Publication of CN104765638A publication Critical patent/CN104765638A/en
Application granted granted Critical
Publication of CN104765638B publication Critical patent/CN104765638B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

It includes processing unit, concurrent queue, several pre-assembled units, the first judging unit and second judgment unit that the present invention, which provides a kind of concurrent module, operation system, prepackage method of completing the square and creation method, concurrent module,;Processing unit obtains data mart modeling processing from data source, and the business result of generation is reached concurrent queue;First judging unit is used to judge the type of business result, and business result is transferred to the pre-assembled unit of the business result of pre-stored the type;Second judgment unit is used to judge whether the business result in the pre-assembled unit that business result is transferred to all to have generated, if the corresponding ranking functions of the pre-assembled unit for then calling business result to be transferred to, all business results in the pre-assembled unit for being transferred to business result are ranked up according to corresponding ranking functions.The present invention releases the high coupling between operation system and concurrent code, and in order to the independent tuning of concurrent module, while operation system has better scalability and maintainability.

Description

Concurrent module, operation system, prepackage method of completing the square and creation method
Technical field
The present invention relates to the communication between high concurrent system and operation system, in particular to a kind of concurrent module, operation system, The prepackage method of completing the square realized using the concurrent module and the creation method realized using the operation system.
Background technique
In high concurrent system, concurrent module business result generated is usually disorderly placed on concurrent data structure In, i.e., different types of business result is alternately stored in the same place.And operation system usually requires that and is meeting certain item When part, the business result that high concurrent system generates sequentially is handled.Generally, operation system can directly arrive concurrent module In go extraction business as a result, assembling up again by certain service logic.
This mode has two: the code needs of operation system are come into contacts with concurrency, are readily incorporated mistake;Its Secondary, excessive thread participates in competition concurrent data structure, leads to degradation, is unfavorable for system adjustment and optimization.
Summary of the invention
The technical problem to be solved by the present invention is in order to overcome in the prior art high performance operation system directly handle height Concurrency operation provides a kind of concurrent so as to cause the defect that service logic and high concurrent logic interact, are mutually coupled Module, operation system, prepackage method of completing the square and creation method, release the high coupling between operation system and concurrent code, will High concurrent code is isolated from operation system, so that coupled between operation system and concurrent module with loose form, this Sample not only improves the following extension of operation system, also facilitates the tuning to concurrent module.
The present invention is to solve above-mentioned technical problem by following technical proposals:
The present invention provides a kind of concurrent module comprising a processing unit and a concurrent queue, it is characterized in that, this is concurrent Module further includes several pre-assembled units, one first judging unit and a second judgment unit, and each pre-assembled unit is corresponding There are unique identification information and ranking functions, and the identification information of different pre-assembled units is different, each pre-assembled list The business result that member is used to be pre-stored the business result of a unique type and different pre-assembled units is pre-stored is different;
The processing unit is used to obtain data from a data source and be processed, and the business result of generation is transmitted to The concurrent queue;
First judging unit is used to judge the type of the business result, and the business result is shifted from the concurrent queue To the pre-assembled unit of the business result of pre-stored the type;
Whether the second judgment unit is used to judge the business result in the pre-assembled unit that the business result is transferred to Through whole generations, if the corresponding ranking functions of pre-assembled unit for then calling the business result to be transferred to, so that the business As a result all business results in the pre-assembled unit being transferred to are ranked up according to the corresponding ranking functions.
In the present solution, concurrent module operates concurrency in inside, it does not come into contacts with actual service logic, and is Operation system is returned to after the unordered result obtained after concurrent processing is ranked up by the requirement of operation system, is classified, in Common multithreading and concurrent program design technology are continued to use in the concurrency processing in portion.
The present invention also provides a kind of operation systems, it is characterized in that, which includes a setting unit, a creation list Member and a call unit, if the setting unit is used to for business result being divided into dry type, and each type is equipped with corresponding unique Identification information and ranking functions, and the identification information of different types is different;
The creating unit is used for the collection cooperation of all types and the corresponding identification information of each type and ranking functions For the example that the parameter of constructed fuction creates a concurrent module, so that the concurrent module is corresponding pre- according to the creation of those types Assembly unit;
The call unit is for calling the output interface of the concurrent module with the return of latency services result.
This programme introduces preassembled concept, and dependency rule is injected into this concurrently by the creating unit in the operation system In module, which is encapsulated in concurrent operations in concurrent module according to the relevant pre-assembled unit of regular Dynamic Maintenance Portion.The operation system obtains business result that is orderly, meeting business demand in a manner of traditional function call.Such one Come, the developer of the operation system can obtain the business of concurrent processing as a result, and simultaneously in the way of known function call The developer for sending out module will not be too much by the constraint of service logic.
Moreover, the operation system is injected into this after need to only abstracting the expectation form of the type of business result, sequence etc. In concurrent module, the interface function for then calling the concurrent module to provide, obstruction waiting is returned up to business result, the business system System is not relevant for specific concurrent processing process.
The present invention also provides a kind of prepackage methods of completing the square, it is characterized in that, it is realized using above-mentioned concurrent module, the prepackage Method of completing the square the following steps are included:
S1, obtain data from the data source and be processed, and the business result of generation is transmitted to the concurrent queue;
S2, judge the type of the business result, and the business result is transferred to pre-stored the type from the concurrent queue Business result pre-assembled unit;
S3, judge whether the business result in pre-assembled unit that the business result is transferred to all has generated, if The corresponding ranking functions of pre-assembled unit for then calling the business result to be transferred to, so that the prepackage that the business result is transferred to It is ranked up with all business results in unit according to the corresponding ranking functions, if otherwise repeating step S3
The present invention also provides a kind of creation methods, it is characterized in that, it is realized using above-mentioned operation system, the creation side Method the following steps are included:
S1, if business result is divided into dry type, and each type is equipped with corresponding unique identification information and sequence letter Number, and the identification information of different types is different;
S2, by the set of all types and the corresponding identification information of each type and ranking functions as constructed fuction The example that parameter creates the concurrent module, so that the concurrent module creates corresponding pre-assembled unit according to those types.
On the basis of common knowledge of the art, above-mentioned each optimum condition, can any combination to get each preferable reality of the present invention Example.
The positive effect of the present invention is that:
The present invention provides a kind of concurrent module, operation system, prepackage method of completing the square and creation method, relieves operation system High coupling between concurrent code, high concurrent code is isolated from operation system so that operation system with simultaneously It is coupled between hair module with loose form, not only improving operation system in this way has better scalability and maintainability, also side To the tuning of concurrent module, without excessively considering service logic in terms of demand.
Detailed description of the invention
Fig. 1 is the structural block diagram of the operation system of present pre-ferred embodiments.
Fig. 2 is the structural block diagram of the concurrent module of present pre-ferred embodiments.
Fig. 3 is the flow chart of the prepackage method of completing the square of present pre-ferred embodiments.
Fig. 4 is the flow chart of the creation method of present pre-ferred embodiments.
Specific embodiment
The present invention is further illustrated below by the mode of embodiment, but does not therefore limit the present invention to the reality It applies among a range.
As shown in Figure 1, the present embodiment provides a kind of operation systems comprising a setting unit 11,12 and of a creating unit One call unit 13, if the setting unit 11 is used to for business result being divided into dry type, and each type is equipped with and corresponds to uniquely Identification information and ranking functions, and the identification information of different types is different.
The creating unit 12 is used for the set of all types and each type corresponding identification information and ranking functions The example that parameter as constructed fuction creates a concurrent module, so that the concurrent module creates accordingly according to those types Pre-assembled unit there is several pre-assembled units in the concurrent module in this way.
The call unit 13 is for calling the output interface of the concurrent module with the return of latency services result.
As shown in Fig. 2, the present embodiment also provides a kind of concurrent module comprising a processing unit 21 and a concurrent queue 22, one first judging unit 23, a second judgment unit 24 and several pre-assembled units 25, each pre-assembled unit 25 are corresponding There are unique identification information and ranking functions, and the identification information of different pre-assembled units 25 is different, each pre-assembled Unit 25 be used to be pre-stored the business result of a unique type and the pre-stored business result of different pre-assembled unit 25 mutually not It is identical.
The processing unit 21 is used to obtain data from a data source and be processed, and the business result of generation is transmitted To the concurrent queue 22.
First judging unit 23 is used to judge the type of the business result, and by the business result from the concurrent queue 22 It is transferred to the pre-assembled unit 25 of the business result of pre-stored the type;
Whether the second judgment unit 24 is used to judge the business result in the pre-assembled unit that the business result is transferred to It all generates, if the corresponding ranking functions of pre-assembled unit 25 for then calling the business result to be transferred to, so that should All business results in the pre-assembled unit that business result is transferred to are ranked up according to the corresponding ranking functions.
Moreover, the present embodiment also provides a kind of prepackage method of completing the square and a kind of creation method, wherein the prepackage method of completing the square is utilized Above-mentioned concurrent module realizes that the creation method is realized using above-mentioned operation system.
As shown in figure 3, the prepackage method of completing the square the following steps are included:
Step 101 is processed from data source acquisition data, and the business result of generation is transmitted to this concurrently Queue;
Step 102, the type for judging the business result, and the business result is transferred to pre-stored be somebody's turn to do from the concurrent queue The pre-assembled unit of the business result of type;
Step 103 judges whether the business result in pre-assembled unit that the business result is transferred to all has generated, If then entering step 104, if otherwise repeating step 103;
Step 104, the corresponding ranking functions of pre-assembled unit for calling the business result to be transferred to, so that the business knot All business results in the pre-assembled unit that fruit is transferred to are ranked up according to the corresponding ranking functions.
As shown in figure 4, the creation method the following steps are included:
If business result is divided into dry type by step 201, and each type is equipped with corresponding unique identification information and row Order function, and the identification information of different types is different;
Step 202, using all types and the corresponding identification information of each type and the set of ranking functions as construction The example that the parameter of function creates the concurrent module, so that the concurrent module creates corresponding pre-assembled list according to those types Member.
A specific example is named to illustrate the present embodiment, so that those skilled in the art more fully understand this hair It is bright:
The setting unit 11 classifies to required business result according to type, and business result is divided into four types Type, and one unique identification information is set for each type, and the identification information of different types is different, such as these four The identification information of type is respectively ID1, ID2, ID3 and ID4.And also a sequence is arranged for each type in the setting unit 11 Function, the business result if identification information is respectively the type of ID1 and ID2 sort according to functional relation from small to large, identification Information is respectively that the business result of the type of ID3 and ID4 sorts according to functional relation from big to small.
The creating unit 12 be used for by these four types and the corresponding identification information of each type (ID1, ID2, ID3 and ID4) and ranking functions (functional relation from small to large, functional relation from small to large, functional relation from big to small, from big To small functional relation) the parameter example that creates the concurrent module of the set as constructed fuction so that the concurrent module Corresponding pre-assembled unit is created according to those types.It there is four pre-assembled units 25 in the concurrent module in this way, it is each Pre-assembled unit 25 is corresponding with unique identification information (ID1, ID2, ID3 and ID4) and ranking functions (from small to large respectively Functional relation, functional relation from small to large, functional relation from big to small, functional relation from big to small).Each pre-assembled The mutual not phase of the business result that unit 25 is pre-stored a type of business result respectively and different pre-assembled units 25 is pre-stored Together.
The processing unit 21 obtains data from a data source and is processed, and the business result of generation is transmitted to this Concurrent queue 22.First judging unit 23 judges the type of the business result, such as the type of the business result is the first The business result is then sent in the corresponding pre-assembled unit 25 of first seed type by type, which sentences Whether the business result broken in the pre-assembled unit that the business result is transferred to all has generated, if then calling the business knot The corresponding ranking functions of pre-assembled unit 25 (functional relation from small to large) that fruit is transferred to, so that the business result shifts All business results in pre-assembled unit extremely are ranked up according to the corresponding ranking functions.If first judging unit 23 The type for the business result judged is other types, then the business result is sent to the corresponding pre-assembled list of other types In member.
Later, if the operation system need the first seed type business as a result, if the call unit 13 pass through interface function Get(ID1 the output interface of the concurrent module is called) to wait the return of the business result of the first seed type, if the operation system Other kinds of business is needed as a result, then the call unit 13 passes through interface function get() call the output of the concurrent module to connect Mouthful to wait the return of other kinds of business result.
The present invention utilizes pre-assembled unit, and Lai Shixian concurrent operations are isolated with operation system, has reached good decoupling effect Fruit, convenient for safeguarding and extension;Concurrent inside modules can according to need dynamic adjustment Thread Count, easily reach system load, property The balance of energy.To simplify the exploitation of operation system, and operation system scalability and maintainable premise can not influenced Under, concurrent processing and independent tuning purposefully are made to concurrent module.
In addition, according to actual needs, designer can be in the interface function Get(of concurrent module) in increase overtime, fault-tolerant etc. Bells and whistles, so as to provide on the behavioural characteristic that the obstruction of typical function call waits (i.e. synchronization call) The function of asynchronous waiting.For the high concurrent system for being related to communicating, or even some fault tolerance features can be specified, so that certain meeting It when condition, is considered as data and is ready, without waiting all data all here, be thus avoided that due to communication The mistake of link and caused by infinite waiting.
Although specific embodiments of the present invention have been described above, it will be appreciated by those of skill in the art that these It is merely illustrative of, protection scope of the present invention is defined by the appended claims.Those skilled in the art is not carrying on the back Under the premise of from the principle and substance of the present invention, many changes and modifications may be made, but these are changed Protection scope of the present invention is each fallen with modification.

Claims (4)

1. a kind of concurrent processing device comprising a processing unit and a concurrent queue, which is characterized in that the concurrent processing device It further include that several pre-assembled units, one first judging unit and a second judgment unit, each pre-assembled unit are corresponding with only One identification information and ranking functions, and the identification information of different pre-assembled units is different, each pre-assembled unit is used In a pre-stored unique type business result and different pre-assembled unit it is pre-stored business result it is different;
The processing unit is used to obtain data from a data source and be processed, and the business result of generation is transmitted to this simultaneously Send out queue;
First judging unit is used to judge the type of the business result, and the business result is transferred to from the concurrent queue pre- Store the pre-assembled unit of the business result of the type;
Entirely whether the second judgment unit be used to judge the business result in pre-assembled unit that the business result is transferred to Portion generates, if the corresponding ranking functions of pre-assembled unit for then calling the business result to be transferred to, so that the business result All business results in the pre-assembled unit being transferred to are ranked up according to the corresponding ranking functions.
2. a kind of operation system, which is characterized in that the operation system includes that a setting unit, a creating unit and a calling are single Member, if the setting unit is used to business result being divided into dry type, and each type be equipped with corresponding unique identification information and Ranking functions, and the identification information of different types is different;
The creating unit is used for using all types and the corresponding identification information of each type and the set of ranking functions as structure The example that the parameter of function creates a concurrent processing unit is made, so that the concurrent processing device creates accordingly according to different type Pre-assembled unit;
The call unit is for calling the output interface of the concurrent processing device with the return of latency services result.
3. a kind of prepackage method of completing the square, which is characterized in that it realizes that this is pre- using concurrent processing device as described in claim 1 Assembly method the following steps are included:
S1, it is processed from data source acquisition data, and the business result of generation is transmitted to the concurrent queue;
S2, the type for judging the business result, and the business result is transferred to the industry of pre-stored the type from the concurrent queue The pre-assembled unit for result of being engaged in;
S3, judge whether the business result in pre-assembled unit that the business result is transferred to all has generated, if then adjusting The corresponding ranking functions of pre-assembled unit being transferred to the business result, so that the pre-assembled list that the business result is transferred to All business results in member are ranked up according to the corresponding ranking functions, if otherwise repeating step S3.
4. a kind of creation method, which is characterized in that it utilizes operation system as claimed in claim 2 realization, the creation method The following steps are included:
If business result S1, is divided into dry type, and each type is equipped with corresponding unique identification information and ranking functions, and The identification information of different types is different;
S2, the parameter by all types and the corresponding identification information of each type and the set of ranking functions as constructed fuction The example for creating the concurrent processing device, so that the concurrent processing device creates corresponding pre-assembled list according to different type Member.
CN201410008811.6A 2014-01-08 2014-01-08 Concurrent module, operation system, prepackage method of completing the square and creation method Active CN104765638B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410008811.6A CN104765638B (en) 2014-01-08 2014-01-08 Concurrent module, operation system, prepackage method of completing the square and creation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410008811.6A CN104765638B (en) 2014-01-08 2014-01-08 Concurrent module, operation system, prepackage method of completing the square and creation method

Publications (2)

Publication Number Publication Date
CN104765638A CN104765638A (en) 2015-07-08
CN104765638B true CN104765638B (en) 2019-04-09

Family

ID=53647486

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410008811.6A Active CN104765638B (en) 2014-01-08 2014-01-08 Concurrent module, operation system, prepackage method of completing the square and creation method

Country Status (1)

Country Link
CN (1) CN104765638B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1524217A (en) * 2000-06-22 2004-08-25 Distributed computing services platform
CN101446897A (en) * 2008-11-26 2009-06-03 重庆邮电大学 Resource management system based on net system business structure platform
CN101741665A (en) * 2009-12-24 2010-06-16 中兴通讯股份有限公司 Method, device and system for notifying service processing result information

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7689560B2 (en) * 2000-10-13 2010-03-30 Miosoft Corporation Persistent data storage techniques

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1524217A (en) * 2000-06-22 2004-08-25 Distributed computing services platform
CN101446897A (en) * 2008-11-26 2009-06-03 重庆邮电大学 Resource management system based on net system business structure platform
CN101741665A (en) * 2009-12-24 2010-06-16 中兴通讯股份有限公司 Method, device and system for notifying service processing result information

Also Published As

Publication number Publication date
CN104765638A (en) 2015-07-08

Similar Documents

Publication Publication Date Title
CN106802826B (en) Service processing method and device based on thread pool
US20180253335A1 (en) Maintaining throughput of a stream processing framework while increasing processing load
CN102236581B (en) Mapping reduction method and system thereof for data center
CN106095673A (en) Automated testing method based on WEB interface and system
CN103605764A (en) Web crawler system and web crawler multitask executing and scheduling method
CN104463482A (en) Task allocation method and task allocation device
CN103870260A (en) Method and system for service interface development
CN110532074A (en) A kind of method for scheduling task and system of multi-tenant Mode S aaS service cluster environment
CN111125444A (en) Big data task scheduling management method, device, equipment and storage medium
CN102279888A (en) Method and system for scheduling tasks
CN103488674B (en) Calculating system and the execution control method of the system of calculating
CN106682036A (en) Data exchange system and exchange method thereof
CN106844190A (en) test script automatic generation method and device
CN110503408B (en) Business process management system based on custom configuration
CN103136364A (en) Cluster database system and data query processing method thereof
CN103177035A (en) Data query device and data query method in data base
CN110209646A (en) A kind of data platform system calculated based on real-time streaming
CN111460019A (en) Data conversion method and middleware of heterogeneous data source
CN112379884A (en) Spark and parallel memory computing-based process engine implementation method and system
CN109753596A (en) Information source management and configuration method and system for the acquisition of large scale network data
CN110740079A (en) full link benchmark test system for distributed scheduling system
CN104731800B (en) Data analysis set-up
US11016736B2 (en) Constraint programming using block-based workflows
CN109992432A (en) A kind of data processing system and method based on message queue
CN106130929B (en) The service message automatic processing method and system of internet insurance field based on graph-theoretical algorithm

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant