Synchronization



The primedocs pro client is connected to the primedocs service via the Service-URL. The service URL can be specified during installation or configured in the installation directory in the file "primedocs.exe.config" in the value attribute as follows:

<configuration> [...] <appSettings> [...] <add key="ServiceAddress" value="https://your-url.local/Service/primedocs.svc" /> [...] </appSettings> [...] </configuration>

Initialization

When primedocs is started for the first time, the data is synchronized first. Once this synchronization is complete, primedocs can be used. For all following synchronizations only the changes will be retrieved.


Sync interval

Concept

The primedocs Client automatically retrieves the latest changes from the service on a cyclical basis. Here it is important that not all primedocs clients of a company contact the service for a synchronization at the same time, in order to prevent large server loads and thus downtime risks.

A small synchronization interval can cause (especially if there are changes to "pick up") a high server load. A high server load could also occur if many devices try to synchronize at the same time, e.g. if all clients start up at about the same time on Monday morning.

To avoid the problem of high server load, two values are configurable:

Configuration

The client synchronization can be configured in the dashboard in "Settings”:

The values of ClientSyncInterval and ClientSyncMaxDelayAfterStart are transferred during each synchronization and stored locally by the client.

ClientSyncInterval: time interval between synchronizations

The ClientSyncInterval specifies the maximum time that elapses before the client synchronizes again. The value is specified in milliseconds. The default value is 900'000 milliseconds (15 minutes).

The actual time that elapses between synchronizations is calculated as follows: Up to 10% of the waiting time is randomly subtracted from the time configured in ClientSyncInterval.

Example: With a ClientSyncInterval of 15 minutes, the actual waiting time until the next synchronization is randomly between 13.5 and 15 minutes.

When the program is started, it is evaluated whether the interval time has already passed since the last successful synchronization. If this is not the case, the remaining time is calculated. From this again randomly up to 10% of the waiting time is subtracted.

So, if at the start of the program the last successful synchronization was 42 hours ago and the ClientSyncInterval is 48 hours, then the time left until the next synchronization is a maximum of six hours. After counting off a maximum of 10%, the result is a value between 5.4 and 6 hours.

If the interval time has already passed since the last successful synchronization, the next item "ClientSyncMaxDelayAfterStart" applies.

ClientSyncMaxDelayAfterStart: Maximum delay after program start

If a client starts and the last successful synchronization was longer ago than the configured interval time, then the ClientSyncMaxDelayAfterStart comes into play.

The synchronization happens in this case not immediately, but delayed. The reason is that if we assumed a ClientSyncInterval of two hours and in the morning at 8.00 a.m. many employees started primedocs at the same time, all these clients would synchronize in the same minute, which would lead to an excessively high server load.

The ClientSyncMaxDelayAfterStart specifies the maximum amount of time that passes before the client synchronizes when it should have already synchronized at program startup due to the elapsed interval. The value is specified in milliseconds. The default value is 3'600'000 milliseconds (1 hour). If ClientSyncMaxDelayAfterStart (e.g. 1 hour) is higher than ClientSyncInterval (e.g. 15 minutes), then the value of ClientSyncInterval (thus 15 minutes in the example) also applies to ClientSyncMaxDelayAfterStart.

The actual delay is determined randomly. It is between 0 and the number of milliseconds specified in ClientSyncMaxDelayAfterStart. Thus, the server load can be distributed if, for example, with a ClientSyncInterval of 1 day, all clients have to synchronize on Monday morning.


Manual synchronization

Additionally, there is the possibility to trigger a synchronization manually. On the one hand, this can be triggered by clicking on "Last update" in the status bar in the client at the bottom right and then on "Synchronize”.

n the other hand, you can right-click on the primedocs icon in the notification area and then select "Synchronize”.

 


Cache version

The client checks at startup if the cache is still valid.

When the "Service URL" is changed, the cache is always reset.

If you now update the Windows client, it checks whether the structure of the cache still matches the new version.

If the cache is valid, no new cache is built.

CAUTION
During uninstallation the cache is cleared. I.e., primedocs.exe /clean will still be called. If the update is executed as uninstallation and installation, a backup of the cache must be created beforehand in another way and restored before the first primedocs start. This can be a simple renaming of the cache folder, for example, – primedocs does not need an available cache during the /clean command.


Lazy Loading

The installation option UseLazyLoadingCache and the value true can be used to set the client to an alternative mode so that the initial binary data of templates and snippets is not synchronised. The data is only loaded in the background when a template or snippet is used.

Advantages

  • Initial synchronisation is significantly faster.

  • The initial cache size is greatly reduced, but increases with active use.

Disadvantages

  • The client can no longer be switched to offline mode.

  • If the server cannot be reached during document generation, an error is displayed.

  • Increased loading times may occur when using a template or snippets for the first time.

Recommendation

  • This option is suitable for clients that always have an active connection to the server, e.g. terminal server environments or similar, and for clients that cannot save the cache permanently.

PrimeSoft AG, Bahnhofstrasse 4, 8360 Eschlikon, Switzerland