Split replication threads
- Last Updated: April 22, 2020
- 4 minute read
You can split each replication thread into multiple split threads
regardless of whether it serves replication of a single table or group of tables. You
can split a single thread into a maximum of ten split threads. When you split a thread
into n number of parts, it provides n-1 split
threads. For example, if you split the thread 5 (replBatch5.bat) into four parts, it provides three split threads 51, 52,
and 53 along with the original thread 5. This means, the four parts are threads 5, 51,
52, and 53.
Pro2 determines the number of a split thread dynamically based on the
RECID of the source record, and groups together all
the split threads that belong to the same record or RECID. This allows you to run multiple processes without adding queue
compression and prevents out-of-sequence processing of more changes to the same ROWID or RECID.
- Generate new trigger code for splitting threads.
- Run split threads.
- Enable and disable queue compression.
- Generate trigger code in lower case.
Generate new trigger code for splitting threads
You can generate and install a new replication trigger code to implement thread splitting, or replace the old triggers for tables or threads that you want to split. It is recommended to replace all the existing trigger code with the newly generated trigger code using a split trigger template.
- tplt_repltrig_split_without_compression.p—Splits threads but does not apply queue compression.
- tplt_repltrig_split_with_compression.p—Splits threads and supports queue compression.
To generate new trigger code:
- In the Pro2 web interface, navigate to the Properties tab.
- Search for
DEL_TRIG_TEMPLATEand click Edit.The Edit Property window appears.
- Specify the Value as
tplt_repltrig_split_with_compression.portplt_repltrig_split_without_compression.p.and click Save. - Search for
WRI_TRIG_TEMPLATEand click Edit.The Edit Property window appears.
- Specify the Value as
tplt_repltrig_split_with_compression.portplt_repltrig_split_without_compression.p.and click Save. - In the Pro2 web interface, click the Properties tab and modify the property values of the templates
DEL_TRIG_TEMPLATEandWRI_TRIG_TEMPLATEto point to one of the split trigger templates. - Click Manage Replication , and select the
database instance.
The Edit Replication window appears.
- Click Next.
- Navigate to the Generate Code tab, and
select the Replication Triggers checkbox to regenerate
the trigger code.Note: Check if the
jobrunner.batfile is running. If not, navigate to \bprepl\Scripts from Windows Explorer , and double click thejobrunner.batfile. The Proenv window appears. - Check if new code is generated by navigating to the \bprepl\repl_d folder. The date and time of the files in that folder are recent if they were updated successfully.
- Copy the repl_d and repl_w folders from \bprepl, and paste them in \db\bprepl folder.
Run the split replication threads function
- Create three new
.batfiles:- Create three copies of the
replBatch5.batfile located in the Pro2\bprepl\Scripts folder and rename them asreplBatch51.bat,replBatch52.bat, andreplBatch53.batrespectively. - Edit the
replBatch51.batfile, locate and modify Thread=5 to Thread=51, and save your changes. Repeat this step forreplBatch52.batandreplBatch53.batfiles.
- Create three copies of the
- Create new thread positions:
- Go to the Pro2 web interface and click the Advanced Configuration tab.
- For thread 51, type
51in the field next to the Create New Thread button, and then click Create New Thread. Repeat this step for threads 52 and 53.
- Create a new property:
- In the Pro2 interface, click the Properties tab, and then click Add.
- In the Property Name field,
specify the name of the property as
SPLIT_THREAD5. - In the Value field, specify the number of threads as 4.
You can add up to n-1 value where n is the number of thread. The maximum value allowed per thread is 10. However, if you specify a value (characters or negative numbers) other than the numbers 1 to 10, then the trigger uses the thread number.
After generating the trigger code and creating new property for split threads, if you
do not create the .bat files and do not schedule
the task entries, then the data remains in the queue until the new thread jobs are
started.
Progress recommends that you do not change the split number if there are existing records in the queue. Changing the split number might push the changes of the same record and row to a differently calculated queue.
Assign a table to the split thread
After the replication thread is split, you assign a table to the thread.
- In the Pro2 web interface, click Manage
Replication, and select the database instance (
sports).The Edit Replication window appears.
- Select Advanced Configuration and
assign a table (for example,
Customertable) to Thread 5 from the Thread# column. - Run a replication job to assign the replication queue to
the split thread. For example, you could run the following query in the
Procedure
Editor:
DEFINE VARIABLE i AS INTEGER NO-UNDO REPEAT i = 1 TO 1000: CREATE customer ASSIGN cust-num = NEXT-VALUE(next-cust-num) NAME = "test_" + STRING(i) country = "USA". END. - Check that the threads have split in the Pro2 web interface by clicking the Total Threads watch-box. The threads are distributed among the split threads.
- To execute the replication records, run the
replbatch5.bat, replbatch51.bat, replbatch52.batandreplbatch53.batfiles.After the replication is complete, the status of replication threads appear as running in the Replication section of the Pro2 web Dashboard.
Enable or disable queue compression for splitting threads
You can enable or disable queue compression by means of the APPSRV_QUEUE_COMPRESSION property. You can add this
property by manual intervention from the web UI.
- Click Properties tab and select Add.
- Enter the Property Name as
APPSRV_QUEUE_COMPRESSION. - Set the Value to either YES or NO.
- Click Save.
Generate trigger code in lower case
You can generate the trigger names in lower case by setting the
property TRIGGER_FORCE_LOWERCASE to
YES in the Pro2 web interface.
- From the Pro2 web interface, click Properties tab and select Add.
- Enter the Property Name as
TRIGGER_FORCE_LOWERCASE. - Set the Value to either YES or NO.
- Click Save.