W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2009

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

From: Drew Wilson <atwilson@google.com>
Date: Mon, 7 Dec 2009 14:57:28 -0800
Message-ID: <f965ae410912071457p6ecd6a52mb352b211eb4da3b2@mail.gmail.com>
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.htm>
Received on Monday, 7 December 2009 14:57:28 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:54 UTC