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

Bulat Ziganshin bulatz at HotPOP.com
Wed Dec 14 16:00:57 EST 2005

Hello Tomasz,

Wednesday, December 14, 2005, 10:48:43 PM, you wrote:

TZ> You don't have to check "every few seconds". You can determine
TZ> exactly how much you have to sleep - just check the timeout/event with
TZ> the lowest ClockTime.

this scenario don't count that we can receive new request while
sleeping and if this thread services different waiting periods, the
new message may require more earlier answer

TZ> On Wed, Dec 14, 2005 at 07:11:15PM +0000, Joel Reymont wrote:
>> 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.

i repeat my thought - if you have one or several fixed waiting periods
(say, 1 sec, 3 sec and 1 minute), then you don't need even to sort
requests - just use one waking thread for each waiting period and
requests will be arrive already sorted. in this way, you can really
sleep as Tomasz suggests

Wednesday, December 14, 2005, 11:04:38 PM, you wrote:
JR> Right, thanks for the tip! I would need to way a predefined amount of
JR> time when the map is empty, though.

no. you just read next message from the Chan (but don't use MVar here!

Best regards,
 Bulat                            mailto:bulatz at HotPOP.com

More information about the Haskell-Cafe mailing list