Working with PrizmDoc > Administering PrizmDoc > Multi-Server Environments > PrizmDoc Multi-Server Mode > Optimizing Cache Performance for Multi-Server Mode |
Viewing Session resources require a number of conversions to create content that is suitable for viewing. Caching the converted content plays a large role in the performance of the PrizmDoc Services when handling requests for a Viewing Session. In single-server mode, caching is the most optimized because all converted content is available to the PrizmDoc Services on that server. As requests for new viewing sessions are received, the new documents are examined to locate existing content that may already be created if the same document was used in a previous viewing session.
In multi-server mode, the PrizmDoc Services on each server maintain their own cache data, separate from other PrizmDoc servers. Cache data is not shared across servers. Because of this, the effort to convert the same document will likely be duplicated on multiple PrizmDoc servers if you have a situation where users are frequently viewing the same document more than once.
To counteract this side-effect of multi-server mode, the PrizmDoc Services provide a way to increase the chances that a request for a new viewing session will be sent to the same PrizmDoc server that may have already converted the same document. This is done by providing a "hint" value in a HTTP header of the request to create new viewing sessions. Below is an example request that sets this header:
Example |
Copy Code
|
---|---|
POST http://192.168.0.1:18682/PCCIS/V1/ViewingSession Accusoft-Affinity-Hint: my-unique-document-name.docx { "tenantId": "my application name", "externalId": "my-unique-document-name.docx", "render": { "html5": { "alwaysUseRaster": false } } } |
The Accusoft-Affinity-Hint header should only be specified in the HTTP request that creates a new viewing session.
It is important to note that the value used in this header should uniquely identify the document. A document name or a unique ID from a database are good options. Using the same value for documents that are not identical will unbalance the requests across the PrizmDoc servers as it will cause a single server to be favored for all requests that contain the same hint value.
Note that the Accusoft-Affinity-Hint header is unnecessary when creating a viewing session through the PrizmDoc Application Services API. Refer to the PrizmDoc Application Services Multi-Server Environments topic for more information on cache optimization for PrizmDoc Application Services.