Skip to content

fix: in CLIENT mode keep in-use blobs in the wasm cache so updates stop re-downloading the scene - #265

Open
LKasianAnsys wants to merge 3 commits into
mainfrom
fix/stop-refetching-in-use-blobs
Open

LKasianAnsys wants to merge 3 commits into
mainfrom
fix/stop-refetching-in-use-blobs

Conversation

@LKasianAnsys

@LKasianAnsys LKasianAnsys commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Resolves #251

Context

The issue: eager blob eviction in vtk-wasm

In CLIENT mode, every update after the first one downloaded the whole scene again once its blobs totalled more than 100 MB. Geometry picks, camera changes and visibility toggles were all affected. A 2048-resolution sphere (368.7 MB of blobs) was re-sent on every pick.

Verified that the server behaves as expected: a pick changes only the highlight's 6 tiny blobs, and every sphere hash is unchanged. The cause is the browser: @kitware/vtk-wasm 1.7.3's freeMemory, which Visor runs after every update with a 100 MB budget, evicts blobs the scene is still using. The next update finds them missing and fetches them all again.

Upstream fix in vtk-wasm >=3.0.3

This was fixed upstream in vtk-wasm 3.0.3: "blob: prevent eager blob eviction" (Kitware/vtk-wasm#68, release notes). (Note that they listed it as a bug, but rendering stays correct; the cost is time and bandwidth.)

An upgrade to vtk-wasm 3.0.3 is not trivial, so it is tracked as its own user story (#266) that can be scheduled accordingly. In the meantime, as a workaround, we can apply the same eviction rule that was added in 3.0.3,

Changes applied

A new BlobEviction class (visor-client/src/wasm/BlobEviction.ts) applies the 3.0.3 rule in place of the handler's freeMemory. The rule is: evict oldest-first down to the budget, but never a blob that a render window's latest status reported in use. RemoteVtkScene records each status's hash list and calls evict after every update. The budget is unchanged at 100 MB.

Note: BlobEviction reads and writes internal (non-private) members of the 1.7.3 handler: hashesMTime, currentMTime, sceneManager.getTotalBlobMemoryUsage and sceneManager.unRegisterBlob. This is safe because package.json pins exactly 1.7.3. It must be removed when vtk-wasm is upgraded.

What to expect

After the initial load, an update downloads only what changed. A geometry pick on a large scene moves a few bytes instead of the whole dataset. Blobs the scene no longer uses are still evicted above 100 MB. The in-use set itself is never evicted, so browser memory now grows with the scene's size instead of being capped at 100 MB.

@github-actions github-actions Bot added fixed bug Something isn't working labels Nov 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fixed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Geometry pick in CLIENT mode syncs whole dataset to browser.

2 participants