|
4 | 4 | <title>dbParallel WikiPage Home</title> |
5 | 5 | </head> |
6 | 6 | <body> |
7 | | -<p><strong>Project Description</strong><br />The dbParallel is a Database Task Parallel Foundation that provides database developers an application level support for parallel programming. Being distinct from Oracle 11g R2's DBMS_PARALLEL_EXECUTE parallelism within a query by chunks, dbParallel works more like a .NET Task Parallel Library implemented on database side, it handles the partitioning of the asynchronous job, the scheduling of tasks, state management, and other low-level details in a lightweight implement which using about eight hundred lines of SQL code and one thousand lines of C# code in total (except test code).</p> |
| 7 | +<p><strong>Project Description</strong><br />The dbParallel is a Database Task Parallel Foundation that provides database developers an application level support for parallel programming. Being distinct from Oracle 11g R2's DBMS_PARALLEL_EXECUTE parallelism within a query by chunks, dbParallel works more like a .NET Task Parallel Library implemented on database side, it handles the partitioning of the asynchronous job, the scheduling of tasks, state management, and other low-level details in a lightweight implementation.</p> |
8 | 8 | <div><strong>Get started</strong><br />A quick example (for Oracle Version)</div> |
9 | 9 | <div style="color: black; background-color: white;"> |
10 | 10 | <pre><span style="color: blue;">PROCEDURE</span> TEST_1 |
11 | 11 | <span style="color: blue;">AS</span> |
12 | 12 | tPJob_ID PLS_INTEGER; |
13 | 13 | tSQL VARCHAR2(256); |
14 | 14 | <span style="color: blue;">BEGIN</span> |
15 | | - tPJob_ID := XYZ.TPW_CALL.CREATE_PJOB(<span style="color: #a31515;">'App1'</span>, <span style="color: #a31515;">'User1'</span>, <span style="color: #a31515;">'This is test1.'</span>); |
| 15 | + tPJob_ID := <span style="color: #808080;">XYZ.TPW_CALL.</span>CREATE_PJOB(<span style="color: #a31515;">'App1'</span>, <span style="color: #a31515;">'User1'</span>, <span style="color: #a31515;">'This is test1.'</span>); |
16 | 16 |
|
17 | 17 | tSQL := UTL_LMS.FORMAT_MESSAGE(<span style="color: #a31515;">'DBMS_LOCK.SLEEP(%d)'</span>, 10); |
18 | | - XYZ.TPW_CALL.ADD_TASK(tPJob_ID, tSQL, 60, <span style="color: #a31515;">'Task1 sleep for 10 seconds.'</span>); |
| 18 | + <span style="color: #808080;">XYZ.TPW_CALL.</span>ADD_TASK(tPJob_ID, tSQL, 60, <span style="color: #a31515;">'Task1 sleep for 10 seconds.'</span>); |
19 | 19 |
|
20 | 20 | tSQL := UTL_LMS.FORMAT_MESSAGE(<span style="color: #a31515;">'DBMS_LOCK.SLEEP(%d)'</span>, 70); |
21 | | - XYZ.TPW_CALL.ADD_TASK(tPJob_ID, tSQL, 60, <span style="color: #a31515;">'Task2 sleep for 70 seconds.'</span>); |
| 21 | + <span style="color: #808080;">XYZ.TPW_CALL.</span>ADD_TASK(tPJob_ID, tSQL, 60, <span style="color: #a31515;">'Task2 sleep for 70 seconds.'</span>); |
22 | 22 |
|
23 | 23 | tSQL := UTL_LMS.FORMAT_MESSAGE(<span style="color: #a31515;">'DBMS_LOCK.SLEEP(%d)'</span>, 30); |
24 | | - XYZ.TPW_CALL.ADD_TASK(tPJob_ID, tSQL, 60, <span style="color: #a31515;">'Task3 sleep for 30 seconds.'</span>); |
| 24 | + <span style="color: #808080;">XYZ.TPW_CALL.</span>ADD_TASK(tPJob_ID, tSQL, 60, <span style="color: #a31515;">'Task3 sleep for 30 seconds.'</span>); |
25 | 25 |
|
26 | 26 | tSQL := UTL_LMS.FORMAT_MESSAGE(<span style="color: #a31515;">'DBMS_LOCK.SLEEP(%d)'</span>, 70); |
27 | | - XYZ.TPW_CALL.ADD_TASK(tPJob_ID, tSQL, 120, <span style="color: #a31515;">'Task4 sleep for 70 seconds.'</span>); |
| 27 | + <span style="color: #808080;">XYZ.TPW_CALL.</span>ADD_TASK(tPJob_ID, tSQL, 120, <span style="color: #a31515;">'Task4 sleep for 70 seconds.'</span>); |
28 | 28 |
|
29 | 29 | tSQL := UTL_LMS.FORMAT_MESSAGE(<span style="color: #a31515;">'DBMS_LOCK.SLEEP(%d)'</span>, 15); |
30 | | - XYZ.TPW_CALL.ADD_CALLBACK_FOR_SUCCESS(tPJob_ID, tSQL, 180, <span style="color: #a31515;">'Sleep for 15s if all success.'</span>); |
| 30 | + <span style="color: #808080;">XYZ.TPW_CALL.</span>ADD_CALLBACK_FOR_SUCCESS(tPJob_ID, tSQL, 180, <span style="color: #a31515;">'Sleep for 15s if all success.'</span>); |
31 | 31 |
|
32 | 32 | tSQL := UTL_LMS.FORMAT_MESSAGE(<span style="color: #a31515;">'DBMS_LOCK.SLEEP(%d)'</span>, 25); |
33 | | - XYZ.TPW_CALL.ADD_CALLBACK_FOR_FAIL(tPJob_ID, tSQL, 180, <span style="color: #a31515;">'Sleep for 25s if fail.'</span>); |
| 33 | + <span style="color: #808080;">XYZ.TPW_CALL.</span>ADD_CALLBACK_FOR_FAIL(tPJob_ID, tSQL, 180, <span style="color: #a31515;">'Sleep for 25s if fail.'</span>); |
34 | 34 |
|
35 | | - XYZ.TPW_CALL.START_PJOB(tPJob_ID); |
| 35 | + <span style="color: #808080;">XYZ.TPW_CALL.</span>START_PJOB(tPJob_ID); |
36 | 36 |
|
37 | 37 | DBMS_OUTPUT.PUT_LINE(<span style="color: #a31515;">'New PJob_ID#'</span> || tPJob_ID); |
38 | 38 | <span style="color: blue;">END</span> TEST_1;</pre> |
39 | 39 | </div> |
40 | 40 | <div>The example executes Task1-4 in parallel and when everything is finished, the callback task is executed <em>(in this case callback will be a fail since task 2 failed - timeout)</em>.<br /><img style="vertical-align: middle;" src="http://www.codeplex.com/Download?ProjectName=dbparallel&DownloadId=370939" alt="" width="635" height="230" /></div> |
41 | 41 | <p><strong>Features</strong><br />Following API list of current version reflects the features:</p> |
42 | 42 | <ol> |
43 | | -<li>XYZ.TPW_CALL.CREATE_PJOB<br />Each of the above sample processing units are called a PJob. PJob represents an asynchronous operation. This method returns a pJob Id for below methods (2, 3, 4, 5, 6). </li> |
44 | | -<li>XYZ.TPW_CALL.ADD_TASK<br />Each pJob contains one or more parallel tasks. Each task is a dynamic SQL. Call the ADD_TASK multiple times to add every parallel tasks into the pJob. </li> |
45 | | -<li>XYZ.TPW_CALL.ADD_CALLBACK_FOR_SUCCESS<br />This is a optional method. Since a pJob is asynchronous, the callback Task is called to execute a continuation when all the parallel Tasks successfully completed. </li> |
46 | | -<li>XYZ.TPW_CALL.ADD_CALLBACK_FOR_FAIL<br />This is a optional method. Similar but opposite to previous callback for success, the callback Task for fail is called to execute a continuation when all the parallel Tasks completed but any of them throw out database exception(s). </li> |
47 | | -<li>XYZ.TPW_CALL.START_PJOB<br />Starts the pJob, scheduling it for execution. </li> |
48 | | -<li>XYZ.TPW_CALL.TRY_CANCEL_PJOB<br />Try to cancel a scheduled pJob if it hasn't begin to execute. </li> |
49 | | -<li>XYZ.TPW_CALL.START_NEW_SINGLE_TASK<br />This method encapsulates a series of steps for conveniently creating and starting single task and callback task. </li> |
| 43 | +<li><span style="color: #808080;">XYZ.TPW_CALL.</span>CREATE_PJOB<br />Each of the above sample processing units are called a PJob. PJob represents an asynchronous operation. This method returns a pJob Id for below methods (2, 3, 4, 5, 6). </li> |
| 44 | +<li><span style="color: #808080;">XYZ.TPW_CALL.</span>ADD_TASK<br />Each pJob contains one or more parallel tasks. Each task is a dynamic SQL. Call the ADD_TASK multiple times to add every parallel tasks into the pJob. </li> |
| 45 | +<li><span style="color: #808080;">XYZ.TPW_CALL.</span>ADD_CALLBACK_FOR_SUCCESS<br />This is a optional method. Since a pJob is asynchronous, the callback Task is called to execute a continuation when all the parallel Tasks successfully completed. </li> |
| 46 | +<li><span style="color: #808080;">XYZ.TPW_CALL.</span>ADD_CALLBACK_FOR_FAIL<br />This is a optional method. Similar but opposite to previous callback for success, the callback Task for fail is called to execute a continuation when all the parallel Tasks completed but any of them throw out database exception(s). </li> |
| 47 | +<li><span style="color: #808080;">XYZ.TPW_CALL.</span>START_PJOB<br />Starts the pJob, scheduling it for execution. </li> |
| 48 | +<li><span style="color: #808080;">XYZ.TPW_CALL.</span>TRY_CANCEL_PJOB<br />Try to cancel a scheduled pJob if it hasn't begin to execute. </li> |
| 49 | +<li><span style="color: #808080;">XYZ.TPW_CALL.</span>START_NEW_SINGLE_TASK<br />This method encapsulates a series of steps for conveniently creating and starting single task and callback task. </li> |
| 50 | +<li><span style="color: #808080;">XYZ.TPW_CALL.</span>WAIT_PJOB<br />Waits for all provided Tasks (parallel subtasks and callback task) of a pJob to complete execution.<br />To support this method, Oracle version utilizes the signaling mechanism come from SYS.DBMS_ALERT package; SQL Serverv version imitates it by a polling loop at present.</li> |
50 | 51 | </ol> |
51 | 52 | <p>(XYZ is the schema name, it should be replaced by your schema name)</p> |
52 | 53 | <p>Open the source code of Oracle package TPW_CALL <em>(or SQL Server stored procedures with prefix TPW_CALL_)</em> for detail parameters.</p> |
|
71 | 72 | <ul> |
72 | 73 | <li>Supported Databases:<br />- Oracle (dev and test on version 11g R1 and R2, hasn't try on earlier version);<br />- SQL Server 2005 or later version; </li> |
73 | 74 | <li>Windows Service:<br />.NET Framework 4.0 Client Profile </li> |
74 | | -<li>ADO.NET Provider:<br />- Oracle - <em>DataDirect Connect for ADO.NET v3.5 (the provider can be easily replaced by other provider for Oracle with the source code)</em><br />- SQL Server - .NET Framework build-in SqlClient provider. </li> |
| 75 | +<li>ADO.NET Provider:<br />+ Oracle - <em>DataDirect Connect for ADO.NET v3.5<br /> |
| 76 | + Or - ODP.NET<br /> |
| 77 | + (the provider can be easily replaced by other provider for Oracle with the source code)</em><br /> |
| 78 | ++ SQL Server - .NET Framework build-in SqlClient provider. </li> |
75 | 79 | </ul> |
76 | 80 | <p style="padding-left: 30px;">At present the dbParallel only support Oracle and SQL Server.</p> |
77 | 81 | <p><strong>Contribute</strong></p> |
78 | 82 | <ul> |
79 | 83 | <li>Welcome all feedback through the CodePlex project (through comments, patches, or items in the Issue Tracker); </li> |
80 | 84 | <li>Earnestly request adding support for other databases; </li> |
81 | 85 | </ul> |
| 86 | +<p>Documentation</p> |
| 87 | +<p style="padding-left: 30px;">To be prepared ...</p> |
82 | 88 | <p><strong>Support</strong></p> |
83 | 89 | <p style=" padding-left: 30px;" >Feel free to use the source in your apps, and products. <br />For production support, please mark [PROD] in email subject to <a href=" mailto:[email protected]" >[email protected]</a>. <br />This project is developed in personal time, the source code support can be available only at night - Easten Time (US & Canada). </p> |
84 | 90 | </body> |
|
0 commit comments