ServiceNow Configuration
Create a shared queue
Create a shared queue using the Number of Queues option, choosing an option to match the workload expected. This will create child queues so you can share data in parallel to different queues to avoid data loss. See the Number of Queues option for further information on configuring this feature.
Create a bulk share using the created shared queue
Create a bulk share and select the shared queue you created in the previous step. By selecting the previously created shared queue, it will create child bulk shares to match the number of child queues of the shared queue. This will allow running multiple bulk shares in parallel to different queues to improve performance while keeping updates to a particular record in correct order so we can avoid data loss. See the Sharing to a queue with the Number of Queues option for further information on configuring bulk shares with this shared queue feature.
Create multiple MultiOutput jobs
Once we've created the shared queue and bulk share, we'll want to ensure we have enough MultiOutput jobs pushing data to the Perspectium Mesh (MBS) so as to keep up with the amount of data being generated by the bulk share. This way we can ensure your outbound table (psp_out_message) doesn't get too large so as to impact performance on your instance. You can use the Multiple MultiOutput Jobs feature to configure jobs for MultiOutput processing by outbound queue.
Generally using one of the options available (2, 4, 8 or 16) should be able to line up with the number of queues and bulk shares you have running i.e. if you created a shared queue with the Number of Queues option as 4 you can select 4 for the number of MultiOutput jobs. However you can use the All (One Job Per Queue) if you have more than 16 queues and have the available jobs on your instance to run all the jobs to process all the queues.
NOTE: Running the All (One Job Per Queue) can create many jobs if you have many queues on your instance since its a 1:1 ratio of jobs created to the number of queues. Ensure your instance has enough jobs available to process these jobs along with any other jobs from other applications/processes on your instance so as to not affect your instance's overall performance.
Agent Configuration
Once you've configured the Perspectium application in ServiceNow and started sharing data out to queues in the Perspectium Mesh, you'll want to configure your DataSync Agent to consume from those queues. To ensure your Agent is configured so as to not have race conditions where multiple threads from the Agent are reading from the same queue and causing updates to happen out of order (or be lost), configure the Agent as follows:
Create a message connection
For the shared queue you created in ServiceNow above, you will create a <message_connection> with the num_queues attribute matching what you specified in the shared queue. This will create threads to consume the child queues along with the base queue.
For example, with the configuration:
<message_connection password="password" queue="psp.out.replicator.prodqueue" user="user" num_queues="4">amqp://instance.perspectium.net</message_connection>
The Agent will create 5 threads, one thread to read from the base queue psp.out.replicator.prodqueue as well as a separate thread for each of the four child queues as follows:
psp.out.replicator.prodqueue01
psp.out.replicator.prodqueue02
psp.out.replicator.prodqueue03
psp.out.replicator.prodqueue04
The base queue psp.out.replicator.prodqueue can be used as a "fast lane" for records that need to have priority for sharing into the database. By default with this optimization setup, the bulk share will use the child queues 01, 02, 03 and 04 to evenly distribute the records to be shared out of the table the bulk share is running on in ServiceNow.
Configure the Agent for your other settings
Configure the Agent for your other settings (how to connect to the target database, your ServiceNow instance information, etc.) using the configurations as relevant to your setup.
Upgrading from a Legacy Configuration
If you already have your ServiceNow app and DataSync Agent configured and want to upgrade to optimize your setup as above, you will need to upgrade to the latest Perspectium versions that support the above functionality (Perspectium ServiceNow Core Krypton 8.1.0+ and Perspectium DataSync Agent Krypton 8.0.2+) and do the following:
Update your shared queue in ServiceNow
If you already have a shared queue and want the queue to be changed to this new setup, go into the shared queue and use the Number of Queues option to select a value higher than the default 1 and save the record. This will create child queues for the new value specified (i.e. 4 will create 4 child queues).
Update your ServiceNow bulk shares to use the updated shared queue
With the shared queue updated to have child queues, you will then want to update your completed bulk share using this shared queue to also have child bulk shares. If you go into a bulk share that uses a shared queue with child queues, you will see the Create child bulk shares for queues related list UI action:
Since you can't directly update completed bulk shares, you can use this option to create child bulk shares to match the child queues. This will then allow you to split out the bulk share to run in parallel to different queues the next time the bulk share is executed.
NOTE: If your bulk share is using a target queue with child queues and does not have child bulk shares, a message will display when the bulk share record is opened about using the Create child bulk shares for queues option.
Update your MultiOutput jobs to match your queues and bulk shares
With the shared queue and bulk share using child queues and child bulk shares to share out in parallel, use the Multiple MultiOutput Jobs feature to configure jobs for MultiOutput processing by outbound queue to match your changes to the shared queue and bulk share i.e. choose the option for 4 MultiOutput jobs if you split the shared queue and bulk share to have four children each. This way you can ensure the MultiOutput jobs pushing data to the Perspectium Mesh (MBS) can keep up with the amount of data being generated by the bulk share and your outbound table (psp_out_message) doesn't get too large so as to impact performance on your instance.
Note the warning above in the ServiceNow Configuration section and its Create multiple MultiOutput jobs step when using the All (One Job Per Queue) option if you decide to create a job for every queue and you have more than 16 queues.
Update your message connection in your DataSync Agent configuration file
Update your <message_connection> in your agent.xml configuration file with the num_queues attribute matching what you specified in the shared queue. If you have the instances attribute on <task> set to a value greater than 1, you will need to update this to a lower value.