Repository navigation
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
Open
fix: in CLIENT mode keep in-use blobs in the wasm cache so updates stop re-downloading the scene#265LKasianAnsys wants to merge 3 commits into
LKasianAnsys wants to merge 3 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-wasm1.7.3'sfreeMemory, 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
BlobEvictionclass (visor-client/src/wasm/BlobEviction.ts) applies the 3.0.3 rule in place of the handler'sfreeMemory. The rule is: evict oldest-first down to the budget, but never a blob that a render window's latest status reported in use.RemoteVtkScenerecords each status's hash list and callsevictafter every update. The budget is unchanged at 100 MB.Note:
BlobEvictionreads and writes internal (non-private) members of the 1.7.3 handler:hashesMTime,currentMTime,sceneManager.getTotalBlobMemoryUsageandsceneManager.unRegisterBlob. This is safe becausepackage.jsonpins exactly1.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.