Tell us about how you're pushing the limits of compute in the browser! #69
Replies: 5 comments 2 replies
-
Hey @zakhenry ! This is a nice question to ask :) I am the owner/developer of www.topdecked.com, a site dedicated to Magic: the Gathering players and fans. Since we use a hybrid app deployment model, it's critical everything we do works in the browser (all major browsers). Due to the deprecation of WebSQL, we've been starting to move to IndexedDB, which is not quite as performant for complex queries. To alleviate some of this slowdown, I've started using Web Workers for all database transactions/operations. This helps offload some of the "in-application" joining and filtering to background threads that don't block the (already complex) ui. As you can see in the screenshot above, there are quite a few search options, so this processing can be fairly intensive with over 60,000 records stored in IndexedDB on mobile devices. So Web Workers are a crucial part of keeping the application performant. I also have started to use them for doing complex calculations like graph operations to make associations for recommending ideas based on previous choices and actions, a bit of Machine Learning in the browser :) One thing I think would be interesting is a utility to queue operations to send/receive uniquely identified/numbered messages to a single worker, so that it could be long-running, and shared between multiple Observable consumers, instead of spawning a new a new worker for each request. This is of course doable already using a messageId parameter, but it would be fantastic if there were some syntactic sugar around this :) |
Beta Was this translation helpful? Give feedback.
-
We are investigating using a Service Worker as a shared data hub (across tabs and windows) that contains a single WebSocket client. The idea is that instead of establishing a WebSocket per window/tab, we just connect to the already running WebSocketSubject created using RxJs that sits in the Service Worker. This way we have a single Service Worker service that handles requests/subscriptions to our backend while adding a caching layer and offloading the intensive data handling/deserialization/compression/caching to the Service Worker allowing each window/tab to consume only the data it requests/subscribes to and supplying cached results immediately. The challenge in this architecture would maintaining backwards compatibility with browsers that do not support Service Workers, allowing the basic 1 WebSocket per window/tab. I realize the interface is similar when using Web Workers, however does this library also support Service Workers? |
Beta Was this translation helpful? Give feedback.
-
I am writing a drawing application that combines user-gesture analysis, digital music/sound design and image processing. I am using observable web-worker to create a pool of workers that handle the heavy lifting of computing the new pixels to generate on the canvas, a "director" thread that assembles their work and sends it to the main thread to draw on the actual canvas, at the desired frame per seconds. I chose this library because the Observable pattern comes in very handy when handling dom-events: the Finally, using the Scheduler API of RxJS, I can easily schedule the workers' operations on the main thread's rendering cycle (or any time-related event that the application needs to listen to). Thanks! |
Beta Was this translation helpful? Give feedback.
-
Great job guys! Thanks! |
Beta Was this translation helpful? Give feedback.
-
Parametric CAD on V8, this lib allows the parallel computation of CSG tree-nodes in order to implement fast 3d geometric kernel within the browser, worker-pool lifecycle can be observed by looking at the hourglass icons appear and disappear. Thank you for your time to develop and maintain the wonderful implementation of this magic lib. |
Beta Was this translation helpful? Give feedback.
-
We're curious about what other applications are using observable-webworker to push browsers to their compute limits! I'll start:
observable-webworker was developed internally @cloudnc to handle a very intensive computation where we were taking gcode files, parsing them into toolpaths and simulating what cutting metal on a cnc milling machine would look like.
We could subdivide the problem into regions which enabled parallelism, but we needed good system for managing the streams of data going to and from the webworker pool, and so began observable-webworker.
We've since replaced the feature that was the genesis of observable-webworker, but in the interim now use it for large file hashing and svg thumbnail generation from a 3D mesh model (using Rust/WASM!).
Beta Was this translation helpful? Give feedback.
All reactions