[Haskell-cafe] Re: Threads with high CPU usage

Simon Marlow marlowsd at gmail.com
Tue Jan 6 11:10:38 EST 2009


Duncan Coutts wrote:
> On Tue, 2008-12-23 at 03:56 +0100, wman wrote:
>> Thanks to you all for inspiration.
>>
>> My web app (which otherwise ran ok) was getting stuck while getting
>> harassed by ab (apache-benchmark) after receiving some 800+ requests
>> in short succession (not less, never gotten to 900, what was weird
>> that running like 500 reqs - pause - 500 reqs ... went ok).
>>
>> After compiling with -threaded and running with +RTS -N2 it handles
>> 10k+ requests (with 10 concurrent request running at once) without
>> missing a beat.
> 
> How about compiled with -threaded and running with just +RTS -N1 ?
> 
> I would expect the crucial thing is the -threaded not the number of cpus
> running Haskell code concurrently (-threaded uses a pool of OS threads
> to make blocking foreign calls effectively non-blocking).

Exactly - adding another virtual CPU with +RTS -N2 should never turn a 
deadlocked program into a responsive one (unless there are threads busy not 
allocating anything, that is).

Cheers,
	Simon


More information about the Haskell-Cafe mailing list