7 Mar 2024

Viewer Performance Update (Part 2 of 3): OPFS Caching

Default blog image

UPDATE2: OPFS cache is now activated by default in v7.98 and above.

UPDATE: This is the second post in a three-part series on enhancements to the APS Viewer.

Viewer Performance Update:
Part 1 - Speedier SVF2 Loading
Part 2 - OPFS Caching
Part 3 - Smooth Navigation (beta)

The APS Viewer downloads large amounts of geometry data whenever it opens an SVF2 model for the first time. To not download the same data again and to speed up subsequent model loading times, it stores the geometry data in a local cache via SVF2. This cache has so far used a browser technology called IndexedDB. However, in Chrome particularly, the IndexedDB has severe performance issues on large amounts of data to the point where initial model loading times become significantly slower, and subsequent model loading times do not improve significantly.

To fix this issue, a new caching backend called the OPFS cache has been implemented. It uses a new browser technology called Origin Private File System (OPFS), which provides high-performance access to a file-like storage on the user's hard drive. By leveraging OPFS, the overhead associated with IndexedDB's database-like API is eliminated, and the performance degradation experienced in Chrome is addressed. It's important to note that the OPFS cache does come with its own limitations.

Note: the viewer creates one OPFS cache per "design lineage" (i.e., for all versions of a specific design in ACC or BIM360), or one OPFS cache per URN if there is no lineage.

Result: Faster loading times

Compared to the old caching backend, with the OPFS cache initial model loading times may improve by 1.1-1.7x for small caches, about 2-7x for users with a medium-sized cache, and much more for larger caches. Subsequent model loading times improve between 2x-4x for small caches, 3-6x for medium-sized caches, and more for larger caches.  Large models can contain anywhere between 50k to a million or more unique geometries.

It's worth noting that the terms 'small cache' and 'medium-sized cache' are used to describe the approximate number of geometries contained within the cache. Small caches typically contain several thousand geometries at most, while medium-sized caches contain around 2.5 million geometries.

How to access the Viewer build and enable the feature

Use this Viewer version, v7.96 or higher

Add useOPFS=true query parameter to your web application's URL, for example, https://www.my-own-application.com?useOPFS=true or set the window.USE_OPFS variable to true in your code.

Limitations

In Firefox and Safari, when loading different designs from the same lineage in multiple instances of the viewer at the same time, the cache will only be available for one of the viewers. Chrome has recently implemented a new API that removes this limitation. Firefox and Safari intend to implement the new API in the future.

Tags:

Related Article