[Haskell-cafe] Optimizing a high-traffic network architecture

Joel Reymont joelr1 at gmail.com
Wed Dec 14 14:11:15 EST 2005

On Dec 14, 2005, at 6:06 PM, Bulat Ziganshin wrote:

> as i already said, you can write to socket directly in your worker
> thread

True. 1 less thread to deal with... multiplied by 4,000.

> you can use just one timeouts thread for all your bots. if this
> timeout is constant across program run, then this thread will be very
> simple - just:

Well, the bots may take a couple of hours to get on board. I don't  
think using one thread with a constant timeout is appropriate. This  
is also a keep-alive timeout, meaning that the bot sends a ping to  
server whenever the timer is fired.

I figure I can have a single timer thread and a timer map keyed on  
ClockTime. I would try to get the min. key from the map every few  
seconds, compare it to clock time, fire of the event as needed,  
remove the timer and repeat. This way I will have a single timer  
thread but as many timers as I need.

	Thanks, Joel


More information about the Haskell-Cafe mailing list