Publication Technical Review
There are several tricks described in this topic that help you optimize and understand your publication process.
One Important Technique for Tracking Items to Publish
During normal operation, Data Hub inspects the pool to find items valid for publication. Data Hub queries the database by page for canonical items, ordered by the canonical item id. An in-memory id tracker retains information about the first item available for publication. Don't retrieve earlier items from the database again. An item qualifies for publication and prevents the advancement of the id tracker in the following circumstances. It has not been published to the target system before. It has failed less than the configured number of attempts. In the best case scenario of no errors, Data Hub still needs to load all items included in the previous publication from the database. The load confirms that the id tracker can be safely moved forwards. After moving it forward, subsequent publications no longer load these items.
After a restart, the in-memory id tracker is reset to zero. So, check all items in the database as potential candidates for publication. All current (nonarchived) items that have not yet been removed by the cleanup extension and all systemic errors load from the database, page by page. For this reason, a publication after a restart can take a long time to complete. The cause may be a large volume of systemic errors and/or a large volume of items that have not passed the cleanup time threshold.
Trapping Performance Issues
The following description depends upon the publications.xml (shown in the following codeblock). It was created using the Data Hub publications REST API GET request /pools/{poolName}/publications.
<publicationActionData>
<actionId>4043</actionId>
<type>PUBLICATION</type>
<startTime>2017-02-21T15:52:19Z</startTime>
<status>IN_PROGRESS</status>
<poolName>SAPCUSTOMER_INBOUND_POOL</poolName>
<targetSystemPublications>
<publicationId>11229</publicationId>
<status>IN_PROGRESS</status>
<targetSystemName>HybrisCore</targetSystemName>
<actionId>4043</actionId>
<poolName>SAPCUSTOMER_INBOUND_POOL</poolName>
<numberOfErrors>0</numberOfErrors>
<canonicalItemCount>34163</canonicalItemCount>
</targetSystemPublications>
</publicationActionData>
| INFO | jvm 1 | main | 2017/02/21 15:52:19.351 | [m[0;32mINFO [TaskExecutor-master-32871-Task [8883518210998]] [ImpexDataImportClient] |
| Returning ERROR(Error writing media file (mediaId: 8815818932254, file:/NFS_DATA/hybris-media/sys_master/impex/hfe/h29/8815818932254.bin, dir:/NFS_DATA/hybris-media/sys_master/impex/hfe/h29)) to http://192.168.0.10:29991/datahub-webapp/v1/core-publications/11635 |
<publicationActionData>
<actionId>4041</actionId>
<type>PUBLICATION</type>
<startTime>2017-02-21T11:08:13Z</startTime>
<endTime>2017-02-21T15:52:19Z</endTime>
<status>FAILURE</status>
<poolName>SAPCUSTOMER_INBOUND_POOL</poolName>
<targetSystemPublications>
<publicationId>11227</publicationId>
<startTime>2017-02-21T11:08:15Z</startTime>
<endTime>2017-02-21T15:52:19Z</endTime>
<status>FAILURE</status>
<targetSystemName>HybrisCore</targetSystemName>
<actionId>4041</actionId>
<poolName>SAPCUSTOMER_INBOUND_POOL</poolName>
<numberOfErrors>1</numberOfErrors>
<canonicalItemCount>1039</canonicalItemCount>
</targetSystemPublications>
</publicationActionData>
<publicationActionData>
<actionId>4037</actionId>
<type>PUBLICATION</type>
<startTime>2017-02-21T06:27:57Z</startTime>
<endTime>2017-02-21T11:08:09Z</endTime>
<status>SUCCESS</status>
<poolName>SAPCUSTOMER_INBOUND_POOL</poolName>
<targetSystemPublications>
<publicationId>11207</publicationId>
<startTime>2017-02-21T06:27:59Z</startTime>
<endTime>2017-02-21T11:08:09Z</endTime>
<status>SUCCESS</status>
<targetSystemName>HybrisCore</targetSystemName>
<actionId>4037</actionId>
<poolName>SAPCUSTOMER_INBOUND_POOL</poolName>
<numberOfErrors>0</numberOfErrors>
<canonicalItemCount>57</canonicalItemCount>
</targetSystemPublications>
</publicationActionData>
Note that MISSING_REFERENCE errors are considered internal errors and do not count in the numberOfErrors field for a given publication. Later versions (6.x) of the Data Hub display this count as well, and also provide a PENDING status for disambiguation.
Looking back further in the publications.xml file, you can see IN_PROGRESS publications (both with and without startTime). These publications are never going to be processed and are the result of Data Hub restarts. If there are more recent publications that completed successfully (just search for a higher actionId), you can safely ignore these publications. This behavior has been changed in the later Data Hub versions (6.x). Later versions contain a process to clean up the old, unused data on server startup. The pending actions would actually be available for processing again. See the following examples for IN_PROGRESS actions, which are never processed:
Example #1
<publicationActionData>
<actionId>3778</actionId>
<type>PUBLICATION</type>
<status>IN_PROGRESS</status>
<poolName>SAPCUSTOMER_INBOUND_POOL</poolName>
<targetSystemPublications>
<publicationId>10756</publicationId>
<status>IN_PROGRESS</status>
<targetSystemName>HybrisCore</targetSystemName>
<actionId>3778</actionId>
<poolName>SAPCUSTOMER_INBOUND_POOL</poolName>
<numberOfErrors>0</numberOfErrors>
</targetSystemPublications>
</publicationActionData>
Example #2
<publicationActionData>
<actionId>2580</actionId>
<type>PUBLICATION</type>
<startTime>2017-02-20T18:22:25Z</startTime>
<status>IN_PROGRESS</status>
<poolName>SAPCUSTOMER_INBOUND_POOL</poolName>
<targetSystemPublications>
<publicationId>7538</publicationId>
<status>IN_PROGRESS</status>
<targetSystemName>HybrisCore</targetSystemName>
<actionId>2580</actionId>
<poolName>SAPCUSTOMER_INBOUND_POOL</poolName>
<numberOfErrors>0</numberOfErrors>
</targetSystemPublications>
</publicationActionData>