[whatwg] [WebWorkers] Maximum number of workers (was "About the delegation example")

Drew Wilson atwilson at google.com
Mon Dec 7 14:57:28 PST 2009


We discussed this previously (
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2009-July/020865.html) -
the consensus was that since the Worker APIs are inherently asynchronous,
user agents were free to impose limits on worker creation (and queue up new
creation requests when the limit has been hit), but the spec should be
silent on this issue.

FWIW, Chrome does this - we limit each tab to a maximum of 16 workers, with
an overall limit of 64 - the 17th worker creation request for a tab is
queued up until another worker exits to make room for it. Chrome currently
has the limitation that each worker runs in its own process - when we
address that limitation, we expect to adjust the limits accordingly.

-atw

On Mon, Dec 7, 2009 at 1:39 PM, David Bruant <bruant at enseirb-matmeca.fr>wrote:

> David Bruant :
> > "In the delegation example, the number of workers chosen is an arbitrary
> > 10. But, in a single-core processor, having only one worker will result
> > in more or less the same running time, because at the end, each worker
> > runs on the only core."
> >
> Ian Hickson :
> "That depends on the algorithm. If the algorithm uses a lot of data, then
> a single hardware thread might be able to run two workers in the same time
> as it runs one, with one worker waiting for data while the other runs
> code, and with the workers trading back and forth.
>
> Personally I would recommend basing the number of workers on the number of
> shards that the input data is split into, and then relying on the UA to
> avoid thrashing. I would expect UAs to notice when a script spawns a
> bazillion workers, and have the UA run them in a staggered fashion, so as
> to not starve the system resources. This is almost certainly needed
> anyway, to prevent pages from DOSing the user's system."
>
> => Wouldn't it be preferable to have an implementation-dependant "maximum
> number of workers" and to raise a security exception when this number is
> reached ? Maximum per domain ? per document ?
> Maybe a different maximum for shared and dedicated workers.
>
> Any opinion on this ?
>
> David
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20091207/c1a0031e/attachment-0002.htm>


More information about the whatwg mailing list