Trickle Loading gebruiken met Exact Online Webhooks

Deze notitie legt de voordelen uit van trickle loading van replica’s van Exact Online-administraties, zoals kortere replicatietijden, inclusief de stappen om trickle loading te activeren. Een ander onderwerp gaat dieper in op Trickle Loading bij gebruik van een OEM-licentie van Invantive Data Replicator om veel klanten te bedienen.

Trickle Loading

Data Replicator biedt verschillende manieren om de belasting van uw infrastructuur, met name cloudplatforms, te verminderen door data te repliceren naar een centrale database. Een van de meest populaire optimalisaties is de overstap van de volledige kopieerbenadering naar incrementeel laden met behulp van “trickle loading”.

Trickle loading is een techniek waarbij aanvankelijk een volledige replica wordt gemaakt vanuit uw bronnen en daarna alleen wijzigingen worden toegepast.

Versiebeheer blijft van toepassing bij trickle loading: als atomaire actie schakelen uw gebruikers tussen de huidige en nieuwe versies van de volledige inhoud van een tabel.

Wijzigingen vanuit cloudtoepassingen worden doorgaans verzameld via Invantive Cloud en beschikbaar gesteld in een wachtrij voor download door de geautoriseerde eigenaar. Momenteel wordt alleen Exact Online ondersteund via webhooks. Hieronder vindt u een snelle installatie.

Wijzigingen vanuit on-premise platforms zoals databases kunnen worden verzameld met behulp van database-triggers of redo log mining, en vereisen handmatig werk en consultancy van Invantive.

Voordelen

Trickle loading biedt een aantal voordelen:

  • Trickle loading verkort de duur van de dagelijkse laadfase, bijvoorbeeld van 30 minuten voor 100.000 accounts op Exact Online naar 30 seconden.
  • Als er geen wijzigingen zijn geregistreerd, wordt de vervaldatum van de versie vooruitgeschoven zonder dat de versienummers veranderen.
  • De afname in benodigde CPU- en schijf-I/O vermindert het resourceverbruik aanzienlijk, met name wanneer meer dan 1.000 partities zijn gerepliceerd naar een database.
  • Bij 24x7-laadcycli verkorten de verkorte laadfases ook het tijdvenster waarin gerelateerde tabellen inconsistente inhoud hebben doordat foreign key-constraints worden geschonden.

Risico’s

Trickle loading brengt ook een aantal risico’s met zich mee, vooral omdat de meeste webhooks die worden gebruikt voor trickle-updates over het algemeen concepten zoals heartbeat en indicatoren voor de gezondheid van de dienst missen:

  • Geen updates worden toegepast, wanneer in de repository een tabelpartitie is geconfigureerd voor trickle loading, maar het platform de updates niet aflevert. Aanbevolen actie: activeer trickle loading zorgvuldig en wereldwijd op het platform.
  • Verlies van abonnement, wanneer in de repository een tabelpartitie is geconfigureerd voor trickle loading, maar het platform de updates niet aflevert. Exact Online heeft bij een aantal gelegenheden abonnementen verloren. Aanbevolen actie: activeer trickle loading zorgvuldig en wereldwijd op het platform. Pas applicatiecontroles toe om het verlies van abonnementen te detecteren.
  • Vertraging van updates, waarbij de te laden updates met aanzienlijke vertraging binnenkomen. Aanbevolen actie: pas applicatiecontroles toe.

Trickle Loading activeren

Om trickle loading te activeren op Exact Online, configureert u een Data Replicator-connectiestring en voert u de volgende instructies uit:

--
-- Selecteer de partities (Exact Online-administraties) die gerepliceerd moeten worden.
--
use 123456,345678
 
--
-- Initiële installatiestappen.
--
begin
  --
  -- Maak een eerste volledige kopie met behulp van een eenvoudig te gebruiken 'select count(*)'.
  --
  select count(*) from exactonlinerest..salesinvoices;
  select count(*) from exactonlinerest..salesinvoicelines;
  --
  -- Wijzig de strategie voor de tabellen om trickle loading te gebruiken.
  --
  -- Tabellen waarvoor trickle loading niet beschikbaar is, geven een foutmelding.
  -- U kunt alsnog een volledige kopie uitvoeren.
  --
  alter persistent cache set table exactonlinerest..salesinvoices approach trickle;
  alter persistent cache set table exactonlinerest..salesinvoicelines approach trickle;
  --
  -- Configureer uw lokale Data Replicator-repository met inloggegevens om
  -- de ontvangen webhook-events te downloaden.
  --
  -- Ontvang uw token van Invantive.
  --
  alter persistent cache set token 'secret'
  --
  -- Activeer nu op https://data-replicator.cloud de webhooks voor Exact Online.
  -- Neem voor volumes boven 30 administraties contact op voor een consultancygesprek
  -- om hulp te krijgen bij het uitvoeren van de SQL-instructies, zodat u de juiste webhooks
  -- registreert voor al uw administraties.
  --
  -- Vanaf nu worden wijzigingen in Exact Online geregistreerd en verzameld.
  --
  -- Om er zeker van te zijn dat er geen wijzigingen verloren zijn gegaan tussen het begin van dit PSQL-blok en nu,
  -- voert u een volledige herlading uit.
  --
  alter persistent cache
  table exactonlinerest.salesinvoice.salesinvoices
  force refresh approach copy
  ;
  alter persistent cache
  table exactonlinerest.salesinvoice.salesinvoicelines
  force refresh approach copy
  ;
end;
 
--
-- Stappen voor dagelijkse of vaker uitgevoerde replicatie.
--
begin
  --
  -- Download alle verzamelde events.
  --
  alter persistent cache download feed;
  --
  -- Vernieuw de inhoud van twee tabellen met behulp van de standaardstrategie
  -- die op de tabel is geconfigureerd.
  --
  -- Zelfs bij grote volumes en voldoende schijf-I/O-capaciteit
  -- duurt deze stap over het algemeen minder dan 1 minuut.
  --
  alter persistent cache table exactonlinerest.salesinvoice.salesinvoicelines refresh;
  alter persistent cache table exactonlinerest.salesinvoice.salesinvoices refresh;
  --
  -- Of gebruik de volgende instructie, die een volledige download uitvoert van alle tabellen waarvoor
  -- trickle loading niet is geconfigureerd. En gebruikt trickle loading voor de tabellen waarvoor
  -- trickle loading wel is geconfigureerd.
  --
  alter persistent cache refresh;
end;

When I use:

alter persistent cache download feed

and then, for instance

alter persistent cache table ExactOnlineREST.SalesOrder.SalesOrdersBulk refresh approach trickle

it ends up saying:

No messages received ever for table ‘ExactOnlineREST.SalesOrder.SalesOrdersBulk’ for partition ‘999’ according to database. Switch from trickle loading to complete replication till the trickle loading loop is closed.

Is there a way to force trickle loading, and if no changes are present, do NOT do a complete replication?

Invantive Data Replicator can use trickle loading, which means that only deltas (changes consisting of insert, update and delete) are applied on the previous table partition version (on Exact Online; a completed load of a table and an Exact Online company) leading to a new table partition version. For instance:

  • old table partition version Exact Online company 123, table TransactionLinesIncremental, ready version 8
  • take deltas and apply on old version
  • make new version 9 and assign it state ‘Ready’.

The trickle loading process is also elaborated on in the topic Enable webhook trickle loading on OEM licenses. More precise, for Exact Online the delivery of webhooks is a sensitive process since Exact Online currently lacks any form of heart beat to report that the loop has been established:

Therefore Data Replicator on Exact Online uses the first delta as a heart beat signal to indicate the loop has been closed.

A request has been registered with Exact for some years to improve the reliability of webhook event delivery, but as of 2021 there is no final plan to add such functionality. As an alternative to reduce loading times, there is an option to resort to the new *Incremental tables such as ItemsIncremental. They combine a reduced API consumption with always consistent data contents. For more background refer to:

Small number of companies

For small numbers of Exact Online companies, the easiest way is to wait a few days and then check in dc_table_partition_versions that the actual approach used is trickle loading (value T).

Note that dc_table_partition_versions contains a column for the request seeding approach and the actual approach used.

For those tables still not using tricke loading, you can ask a key user to create and delete a transaction such as updating the description of a General Ledger Account.

Large number of Exact Online companies

The manual approach to get the first signal over the wire can be labor intensive, especially when replicating hundreds or thousands of Exact Online companies. This holds especially for accounting firms where many Exact Online companies are only updated once per year, such as during the yearly accounting and/or regulatory reporting on holdings. Till the first message is processed, trickle loading on these companies will resort to full copy approach.

There is no supported way to manually force the loading approach for large number of Exact Online companies from Copy to Trickle Loading. However, an Invantive consultant can make the necessary internal changes to the Data Replicator repository on basis of Time & Material to simulate that a message was received. This typically takes 30 minutes per Data Replicator repository.

When I use:

use all;

alter persistent cache table ExactOnlineREST.Financial.GLAccountsBulk force refresh approach copy;

Then I see in the screen that the copy approach is used, and I see that all rows are downloaded. But when I view the dc_table_partition_versions, it still says:

seeding_approach_used = T

Where do I view the actual approach used?

What Invantive SQL release is it?

20.0.143

sau
copy

I am uncertain what release is in use, but probably the queue for trickle loading messages is large. If so, then Data Replicator reverts to full copy.

Please make sure to be running 20.0.142 or newer and read the explanation on Purge obsoleted change events.

The problem is the opposite:

when I explicitly ask for a force refresh approach copy, then verify in the ‘Uitvoeren’ window that there is a Forced copy performed, the seeding_approach_used in the table partition versions is still shown as T.

Version is 20.0.143 as stated.