ServiceWorker bottle-neck design flaw - MS Edge to the rescue?

# Richard Maher (4 days ago)

As you may be aware, I have been lobbying strongly here stackoverflow.com/questions/44233409/background-geolocation-serviceworker-onmessage-event-order-when-web-app-regain,

and here stackoverflow.com/questions/45206149/expected-ratio-of-serviceworker-instances-to-geolocation-updates,

and especially over there w3c/ServiceWorker#745 for

the introduction of a background geolocation capability with Web Apps.

So frustrated had I become that I spent the time to develop and document a POC example with everything UA developers and Web App developers need to do to implement background geolocation - documented sscce here drive.google.com/open?id=0B7Rmd3Rn8_hDNW1zSWRoXzBTclU and, to

date, no one can tell me there’s anything wrong with it.

In this technical feed-back vacuum my mind began to ponder why, and then drifted to “Cui Bono?”, and ultimately to conspiracy theories. For example:

  • Phonegap/Cordova developers bribing W3C to sandbag BackgroundGeolocation efforts.

But only today did it dawn on me like a bolt of lightning to the brain! There is a fundamental design flaw with the current ServiceWorker design/implementations in that there is only ONE per UA. Jake Archibald et al have been so blinkered with offline-first, cache, and the browser being a proxy-server that they will not tolerate anything else monopolizing the SW thread to the detriment of their fetch performance stats.

But God Bless Edge, notwithstanding their tardy arrival on the scene, who I believe have specialist SW instances for PUSH, FETCH, A.N.Other. This is fantastic!!!

Just add another specialist instance “GeoLocation” and we’re away.

Please don’t let self-interest stand in the way of this essential functionality. Let’s go!

But my question here is this: - Can someone please confirm that Edge implements multiple, specialist SW instances?

Cheers Richard Maher

Contact us to advertise here
# Richard Maher (2 days ago)

EDIT 1

Ok, it might have been Safari/Webkit but reading this webkit.org/blog/8090/workers-at-your-service it looks like 1

process for all ServiceWorker threads plus another to monitor/start/stop, but only one simultaneous SW instance per domain (plus that dodgy iFrame logic webkit has got going on)

So if neither Webkit or Edge do what my memory tells me then is it not a good performance idea? (Barring reduced hit rate on SW recycling)

EDIT 2

On third thoughts, the fact that everything in a ServiceWorker is Asynchronous or verbotten means Fetch, Push, Travel, events can all multiplex to the same SW instance without much performance degradation.

Oh Well, I'm back to "Stuffed if I know why no one is implementing the TravelManager :-("

FWIW The WebKit implementation of shared memory buffer must surely necessitate a Synchronous API? Breaking one of the major premises of SW design?

EPILOG

I apologise for spamming the recipients here even though I did it knowingly. I won't do it anymore. I didn't believe I was reaching an audience so I just kept pulling leavers and pushing any and all buttons available.

I have been made aware that, unbeknownst to me, some of the right people were hearing what I had to say and the TravelManager idea was gaining traction. To those people let me just say that I spent a fair bit of time on the Brotkrumen Web App which demarcates UA Developer and Web Developer contributions succinctly, provides smooth Google Map marker movement via CSS transitions to get the mug punters looking and, most importantly, is a fully working, fully documented, complete, sscce which provides real-time feedback on the ratio of ServiceWorker instances to Geolocation updates!

If there is a open/tolerant forum where people discuss such things then please let me know. Once again, no one can tell me there's anything wrong with the idea. OTOH I can tell you heaps of things that are wrong with the "alternative" WakeLock or Sensor ideas.

I also have a few good ideas for permissions/visibility on Background Geolocation if anyone is interested.

BTW when I said repeatedly that I am happy to "go away" it was on the proviso that the two issues I've been banging on about for two years were implemented.

1) Broadcast notifications where the client/UA can subscribe to a Topic. Once again W3C let us down but thanks to FCM we can access this much needed functionality so I let it go.

2) Background Geolocation. As ShamWow guys says "It sells itself". Why, WHY, WHY are people saying NO to this?

Cheers Richard

On Fri, Mar 2, 2018 at 11:22 AM, Richard Maher <maherrj at googlemail.com>

wrote:

Want more features?

Request early access to our private beta of readable email premium.