[GHC] #9321: Support for waiting on multiple MVars
GHC
ghc-devs at haskell.org
Sat Jul 19 01:59:26 UTC 2014
#9321: Support for waiting on multiple MVars
-------------------------------------+-------------------------------------
Reporter: schyler | Owner: simonmar
Type: feature | Status: new
request | Milestone:
Priority: normal | Version: 7.8.3
Component: Runtime | Keywords: mvar
System | Operating System: Unknown/Multiple
Resolution: | Type of failure: None/Unknown
Differential Revisions: | Test Case:
Architecture: | Blocking:
Unknown/Multiple |
Difficulty: Unknown |
Blocked By: |
Related Tickets: |
-------------------------------------+-------------------------------------
Comment (by schyler):
I have been hacking together a benchmark for STM (attached) first, then
later I will put together the equivalent thing for MVar. On my i7 haswell
macbook pro I compile and run it like this:
{{{
$ ghc -O2 -threaded -fforce-recomp Bench.hs
$ time ./Bench +RTS -N8
}}}
This emulates the exact use case I mentioned for the server above,
actually. We have
* A packets queue, bounded, written and read by only 1
* An events chan, unbounded and written by everything (but individual
forks)
* A commands queue, bounded, written and read by 5% of the clients (but
individual forks)
In terms of the configurable parameters:
* `threshold` is how many events, commands OR packets clients want before
they just disconnect. I needed a fair simulation of throughput
* `clients` is the number of clients to simulate connected to the server
* There are adjustable delays on the client-local chans you can adjust,
`packetDelay`, `eventDelay` and `commandDelay`. This is just to give a
kind of estimate of the actual distribution of messages in a real server
(I expect i.e. there to be 50 events per 1 actual client packet per 5
client-specific commands)
Interestingly the bench terminates in 4 seconds when `clients = 20`. I set
`clients = 40` and couldn't get it to terminate for over 5 minutes (and my
laptop was really hot) so I killed it.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9321#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list