Web Worker Quality of Service

This page contains a video recording of the presentation made during the breakout session, along with a transcript. Video captions and transcript were automatically generated and may not properly translate the speaker's speech. Please use GitHub to suggest corrections.

Table of contents

  1. Video
  2. Transcript

See also:



Nervion I: Hi! So welcome everyone.
… I was at appropriate Sunday 2019 I where we showcased opencvjs with, and how we leveraged web assembly and threads to inside web workers
… to get native CPU like performance for processing.
… Yeah. But another talk actually caught my eye on it's surma here. And he summed up the main points pretty nicely, I said. Like
… the main thread is overworked and underpaid, so you know, we should, whenever possible, we should move
… things of the main threat to workers.
… but
… with screen refresh breaks.
… getting higher and higher, you know.
… Yeah, it makes sense to move any kind of man Javascript manipulation of the main thread, because 60 fps is like 16 ms, and with the desktop
… refresh monitors refresh rate as 1 44 you get 2 this time.
… So your your responsiveness is obviously one of the biggest metric for to keep users happy.
… In video
… conference, for example, like all the audio processing and voice suppression, eco cancellation, or even the background blur for video processing. You have been using web assembly quite a lot. So
… we'll get into specific use cases definitely. for example, in today's
… on zoom users.
… 70 back and for background processing about. And also something media pipe uses lot of workers. So yeah, you have the people here.
… Yeah, there's a demo Microsoft organized. So something about sustainability there, where you are showing that.
… if we use the e-course, how we can.
… Lord of forward
… district
… yeah. Workers have been supported on all mainstream browsers for a long time now.
… but this is one issue we have been using up. you know, cookie cutter approach
… We do not distinguish the fact that some workloads are different. Some might need this, some might need that.
… It's
… just a black box, and whatever comes we are.
… we are dependent on the voice schedule. That's so handy.
… Oh, yeah. I'll but by default we create all workloads
… to be optimized for performance. That's the use case usually today for 10 min. Oh.
… if there's a E code or the Eco performance code, or an efficiency cortex.
… for in our Portlands it could be big and little
… if if you have both of them idle. The task would be scheduled to a big code these days, I mean.
… because we want performance. Yep. always so.
… But yeah, workload characteristics. Some. Some are latency sensitive, like
… audio and real time audio and all those stuff. So that's why people have to use audio work. Let's for those situations.
… Some are not. Some are like background tasks, you know. You don't care about the time as long as does not.
… use too much energy. We are happy. It's not time since tips, background tasks, hence
… some are
… some neat priority, which means.
… I don't care which code you put me on. Just don't make me wait. Dispatcher should.
… whenever it comes it should
… respect.
… Let's talk about a bit of the
… on platforms on the
… on windows. We have the set thread information Api, which allows us to
… set high, and Eco Qos so windows internally will have quite a few levels of quality of service that you can see on the
… figure here, but
… the first one, the high and the Eco can only be but
… for thread sites, and that's what we
… have used a bit. Oh.
… the the other ones are decided by the OS scheduler many times we don't have
… of.
… We can't
… hint that way.
… Go ahead.
… The quality of service, as you can see, is associated with a thread is used to indicate the desired performance and power efficiency.
… and Qas is assigned at a thread level. Here
… I quickly check whether there's support for manus, and of course there is so
… of
… this universal management of our priority, and I think microwave says something like a brand dispatcher
… mechanism where
… everything is taken into account like frequency. Kind of role priority, core selection. It has. It's a queue voice. Api. I linked the
… source file there whatever I could find from open source. So yep.
… yeah. Linux and promos. I think
… someone you can share whatever with you.
… We can after some some time. But right now there is
… energy aware Scheduler in the Linux kernel. You know, if if by energy ever scheduler we mean it gives scheduled ability to predict the impact of its
… decisions on energy consumed by cpus
… it relies on energy model
… of cpus to select energy efficient course for each task
… with minimal impact on through port.
… But the community is also working on bringing a new Linux upstream scheduler for the heterogeneous course. And
… since Linux and Chrome OS are pretty similar.
… We can learn about whatever someone can share later on.
… Okay.
… so
… very simple
… simple name web worker quality.
… And
… in addition to web workers, as you can see intentionally, we have kept it very simple.
… course there could be.
… We can add few other options to be numb.
… like important or priority, and all those things. But I
… what to just start off like this
… my main thinking is
… energy efficiency. So like high.
… you know.
… Oh.
… yeah, bye, bye.
… The hardest part of the Api design right naming.
… So Hi! It will hint the scheduler that please put me to a big code or a performance code
… by law. It will hint
… to schedule dot that please put me
… efficiency core
… and before this something. And we decided I always prefer default to be efficiency. But that's up to the implementation.
… So I want to emphasize on always this, that this is always a hint. You know
… there's no guarantee
… that your tasks would be put on exact that core. But it's more of a in it
… because we
… us level, we we cannot override
… decision. We can give him. Someday.
… Okay,
… let me see. Okay. So we did some
… forward and performance analysis. And this is a particular video conference
… web app with where they had used Webassembly background blur.
… And we saw that
… if we use this quality of service as low. that means majority of time, it would.
… The work group would be on the
… efficient little course. We have a 21% power saving without actually losing fps, you know. So normally on video conference. We, the default Fps
… 300, and as long we. So we have a 33 ms deadline for the entire frame.
… And we found out that in this case
… it was not it was not affected. The Ps. Was
… not affected so well. Efficient course in model laptops can perform 720 p.
… Decode. Put in the task at 30 fps. So
… by your placing the course
… we get the 21% power savings.
… But it's not
… always that use this. And everything is going to be all good.
… Oh.
… we use this push app actually, for with the image encoding.
… and when we use quality of service there was a there was a
… savings of 10%. But
… you see, I mean, I don't know if Ps. Here. But let's say the execution time took import. Image was around 2.7 x.
… So the it will depend on workload a lot
… no.
… it's not like for everything you put and everything, and you'll get desired results.
… So yeah, this was something. Oh, I wanted to share that
… Sometimes the execution time of a workload can be as big as 2.7 x where you can only set 10
… from our.
… the specific case was, yeah, 50 and coding for scusha.
… Yeah, we have a
… you have a patch right now on windows only. But
… for
… my main objective of the session is that people
… try out
… dispatch. And when you see that your workload.
… yeah, you can do your own tests and see if
… this matters and
… I'm I'm most mostly I'm looking for
… more use cases. So we did some
… experiments with Zoom, and meet
… they have given some feedback. But II also want this
… thing to expand beyond web. PC,
… 3 years old. So I mean.
… yes.
… I'm also looking for. what kind of workloads would be used here. One, somebody suggested a
… 0 knowledge proof kind of encryption like
… to prove your identity. You have solved a puzzle like a encryption or something like that. Take your own sweet time. 5 min we don't care
… of.
… and then you put it in the e-cod. It's a high Comp. High computation of demanding and load
… latency sensitive. So of course, that workload suits.
… I'm I'm here to hear more on those workloads.
… Now, these are some of the open questions
… right now. It's I said, the quality of service right? That constructor. So
… is it modifiable, you know. Some people might want suddenly
… change. But
… yeah.
… do we need a getter sector on change? Even this is like general questions.
… Naming is always an issue. Oh.
… yeah, I didn't check. If there's a permission issue needed. If we want to
… use user defined thread priority, the priority is something we can
… discuss soon after this. Yeah, we we did consider worklets. And so priority hints also. But work, let's, as you know, are for limited purposes. Audio has a workplace, you know.
… It's totally controlled by browsers for specific job. This is a bit more
… syndrome and priority. Hence was more for fetching resources. So nothing
… computation, I guess. So. So, yeah, we did have input.
… Yeah, so this is so
… I compute, like, it's a simple Api edition just
… into scheduler, so that we can, you know.
… put our workloads within our power budget.
… I haven't added priority yet. If there's enough need.
… Course, every. This is just a proposal. So oh.
… yeah, open to questions.
… Do you want to say something.