Client-Server DomuS3D uses a distributed cache to minimize network traffic between individual clients and the server.
When a client needs a file, “F”, located on the database of the server, this is the procedure that is followed:
Td: Timestamp when file “F” was downloaded
Now: Current timestamp
Δ(F): Cache timeout for the file “F”
Tm: Timestamp of last modification of file “F” in Cache
Tms: Timestamp of last modification of the file on the Server
____: Network Access
When a client needs to modify (or insert) a file “F” located on the database of the server, both the remote copy (located on the server) and the local copy (in the cache) are updated following the write-through method.
The only exception are project files (that the user chooses to save locally), which, due to their large size, follow the write-back method. This means that the file is updated locally in the cache, while the update to the remote copy on the server is delayed until the entire system is synchronized. It is very important that all clients have synchronized and are up to date before undergoing a backup on the server.
This command is available in the menu: Server -> Cache -> Synchronize and is automatically executed when DomuS3D is closed.
Optimizing Network Traffic
Configuring the Cache Timeout
The cache can be optimized through the parameter Δ(F), which represents the cache timeout for the file “F”. This parameter can be set through the registry key CSCacheTimeoutMin, which must be a string in the form of:
<path1>| Δ(<path1>);<path2>| Δ(<path2>);…;*| Δ(*).
For example, by setting CSCacheTimeoutMin=”Bitmap|60;Projects|-1;*|3”, we have:
- all files that contain “Bitmap” in their path have a timeout of 60 minutes;
- all files that contain “Projects” in their path have a timeout of -1 minutes (- > timeout check disabled, constant network access);
- all other files have a timeout of 3 minutes.
In general, as Δ(F) increases, network traffic decreases, and thus the risk of obtaining a file that is not updated is greater (vice-versa: as Δ(F) decreases, network traffic increases).
In the extreme cases:
- if Δ(F)=0, we have maximum network traffic (network is accessed continuously): file will always be updated and correct;
- if Δ(F)=∞, we have minimum network traffic (network is accessed only once): when file is changed on the server, the client will not have the modification.
Knowing the update frequency of a file in advance allows us to set the optimal Δ(F) value, which is equal to its inverse. In particular, if F is never modified after its initial creation, then the optimal Δ(F) value is equal to ∞. If the update frequency of a file is unknown, we tend to use a high value of Δ(F) when dealing with slower networks and low values of Δ(F) with faster networks.
Prefetching and Emptying of Cache
It is possible to prefetch the cache using the dedicated command in the menu Server -> Cache -> Prefetch. This allows you to preload data in the cache when the network is not experiencing heavy traffic or when a delay would not be an issue, making sure you have the highest speeds in the following period.
It is also possible to empty the cache using the command in the menu Server -> Cache -> Empty, so that you can recover disk space, forcing files on the server to be downloaded the next time it is accessed.
During the prefetch of the cache, Δ(F)=0 for all files regardless of the value specified during setup. This allows you to set Δ(F)=∞ and then use the prefetch/empty commands to manually manage the cache, extremely useful when dealing with very slow networks.
With the registry key CSCacheThumbsEnabled, it is possible to turn on/off the management of previews, specifically CSCacheThumbsEnabled=1 turns on the use of previews.
When previews are turned on, during the writing of each image, a corresponding preview is generated and updated and the most common selection windows use previews instead of the actual images. This slows down the process of making changes to the catalogue, however, it speeds up all selection operations, which are much more frequent.
The command in the menu Server -> Cache -> Generate Preview allows you to regenerate previews of all files present on the server.
Fast Networks: When dealing with high-speed networks, you can set Δ(F)=∞ for all files that never undergo modifications and Δ(F)=0 for all other files. For example, if we know that the catalogue for a certain manufacturer, after its initial upload, will never be modified, we can set CSCacheTimeoutMin=”Bitmap\manufacturername|999999;*|0”.
Slow Networks: When dealing with slightly slower networks, it is best to set Δ(F)=∞ for all files that never undergo modifications and Δ(F) roughly equal to the inverse of the frequency with which all other files are modified. If a user realizes that they do not have an updated file, they can prefetch or empty the cache manually.
Very Slow Networks: When dealing with very slow networks, it is advised to set Δ(F)=∞ for all files and to prefetch the cache in moments that the network is not experiencing heavy traffic or when a delay would not be an issue.
This article is valid for DomuS3D® 2018 and later