@@ -417,18 +417,30 @@ maxBuffer n st =
417getMaxBuffer :: Config -> Limit
417getMaxBuffer :: Config -> Limit
418getMaxBuffer = _bufferHigh
418getMaxBuffer = _bufferHigh
420−-- | Specify the pull rate of a channel.
420+-- | Specify the stream evaluation rate of a channel.
421−-- A 'Nothing' value resets the rate to default which is unlimited. When the
421+--
422+-- A 'Nothing' value means there is no smart rate control, concurrent execution
423+-- blocks only if 'maxThreads' or 'maxBuffer' is reached, or there are no more
424+-- concurrent tasks to execute. This is the default.
422−-- rate is specified, concurrent production may be ramped up or down
426+-- When rate (throughput) is specified, concurrent production may be ramped
423−-- automatically to achieve the specified yield rate. The specific behavior for
427+-- up or down automatically to achieve the specified stream throughput. The
424−-- different styles of 'Rate' specifications is documented under 'Rate'. The
428+-- specific behavior for different styles of 'Rate' specifications is
425−-- effective maximum production rate achieved by a channel is governed by:
429+-- documented under 'Rate'. The effective maximum production rate achieved by
430+-- a channel is governed by:
427-- * The 'maxThreads' limit
432-- * The 'maxThreads' limit
428-- * The 'maxBuffer' limit
433-- * The 'maxBuffer' limit
429-- * The maximum rate that the stream producer can achieve
434-- * The maximum rate that the stream producer can achieve
430-- * The maximum rate that the stream consumer can achieve
435-- * The maximum rate that the stream consumer can achieve
437+-- Maximum production rate is given by:
439+-- \(rate = \frac{maxThreads}{latency}\)
441+-- If we know the average latency of the tasks we can set 'maxThreads'
432rate :: Maybe Rate -> Config -> Config
444rate :: Maybe Rate -> Config -> Config
433rate r st = st { _maxStreamRate = r }
445rate r st = st { _maxStreamRate = r }