[Zope] Re: zserver-threads
Florent Guillaume
fg at nuxeo.com
Tue Jan 31 18:44:08 EST 2006
Dieter Maurer wrote:
> Jens Vagelpohl wrote at 2006-1-31 15:07 +0000:
>> On 31 Jan 2006, at 15:01, Jake wrote:
>>
>>> http://plone.org/documentation/how-to/threads-vs-cache-size
>> That article contains little information to back up the conclusions,
>> and some of it is patently wrong. Another case of hearsay and half-
>> thruths being propagated by well-meaning but uninformed parties.
>
> There is a convincing example (I think from Matt Kromer) what
> happens to "mean response time" when the number of threads
> is increased from 1 to 2:
>
> Assume you have 2 units of work. If you have a single
> thread, 1 unit is done, then the second. The
> mean response time is (1 + 2) / 2 = 1.5.
>
> Now assume you have two threads (but a single processor).
> Both threads work (quasi) parallel but have only half of the
> processor power. Both will take 2 time units to perform
> their unit of work. The mean response time is (2 + 2) / 2 = 2.
This is specious reasoning from a statistical point of view. You never
have only two requests. To have a proper statistical evaluation, you
need a theoretical model of the distribution of requests over time. This
can be as simple as "a request every t". Then you have a continuous flow
of requests, and the two means become equal.
Just try it with 4 units of work and equivalent time distribution as in
the original example:
- Case 1: (1+2+3+4)/4 = 2.5
- Case 2: (2+2+4+4)/4 = 3
If you generalize to n units of work, you'll get (the math is simple):
- Case 1: n(n+1)/2n = n/2+0.5
- Case 2: 4((n/2)(n/2+1)/2)/n = n/2+1
Which are equivalent to n/2 when n grows.
Florent
--
Florent Guillaume, Nuxeo (Paris, France) Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope
mailing list