Split replication threads
- Last Updated: March 30, 2020
- 5 minute read
- OpenEdge
- Version 12.2
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. The following topics are covered in split replication
threads: - Generate new trigger code for splitting threads.
- Run split threads.
- Enable and disable queue compression.
- Generate trigger code in lower case.
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 10 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
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 user interface, navigate to the Properties tab.
- Search for
DEL_TRIG_TEMPLATEand click Edit. The Edit Property window appears. Specify the Value astplt_repltrig_split_with_compression.portplt_repltrig_split_without_compression.p.Click Save. - Search for
WRI_TRIG_TEMPLATEand click Edit. The Edit Property window appears. Specify the Value astplt_repltrig_split_with_compression.portplt_repltrig_split_without_compression.p.Click Save. - In the Pro2 web user 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 , select the database instance, The Edit Replication window appears. Click Next.
- Navigate to 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 if the file is running successfully. - You can check if new codes are generated by navigating to the \bprepl\repl_d folder. The date and time of the files in that folder will be recent if updated successfully.
- Copy the repl_d and repl_w folders from \bprepl and paste them in \db\bprepl folder.
Run split threads
- Create new
.batfiles:- Create three copies of the
replBatch5.batfile located in the Pro2\bprepl\Scripts folder and rename them asreplBatch51.bat, replBatch52.bat, and replBatch53.batrespectively. - Edit the
replBatch51.batfile, locate and modify Thread-5 to Thread-51 and Thread=5 to Thread=51, and save your modifications. Repeat this stepreplBatch52.batandreplBatch53.batfiles.
- Create three copies of the
- Create new thread positions:
- To create new thread positions within Pro2, click the Advanced Configuration tab in the Pro2 web user interface.
- For thread 51, type 51 in 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 web user 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. Note: You can add upto n-1 value where 'n' is the number of thread.
Note: 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, the trigger uses only the actual thread number.
- Even after generating the trigger code and creating new
property for split threads, if you do not create the
.batfiles and do not schedule the task entries, the data remains in the queue until the new thread jobs are started. - It is recommended 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
- Click Manage Replication , select the
database instance (
sports), The Edit Replication window appears. Click Next. - Select Advanced Configuration and assign a table (for example, Customer table) to Thread 5 from the Thread# column.
- You can now run a replication job to assign replication
queue to the split thread. For example, run the following query in 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 = "India". END. - In the Pro2 web user interface, Click the Total Threads watch-box. The threads will be distributed among the split threads #5, #51, #52 and #53.
- Run the
replbatch5.bat, replbatch51.bat, replbatch52.batandreplbatch53.batto execute the replication records. Once the replication is complete, the status of replication threads will appear as running the the Replication Process area of the 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 and Value. Click Save. If this property exists, and the value is 'YES', queue compression is enabled. Else, queue compression is disabled by default.
Generate trigger code in lower case
You can generate the trigger names in lower case by setting TRIGGER_FORCE_LOWERCASE = YES. You can add this property
by manual intervention from the web UI. Click Properties tab
and Select Add, Enter the Property Name
and Value. Click Save.