comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: "C - like: THIS" pointer to a task type inside a task function
Date: Wed, 25 Jan 2012 22:17:51 -0600
Date: 2012-01-25T22:17:51-06:00	[thread overview]
Message-ID: <jfqk5h$28v$1@munin.nbi.dk> (raw)
In-Reply-To: 1rp216zwnjx3j$.rjwu8m3hxgp1.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:1rp216zwnjx3j$.rjwu8m3hxgp1.dlg@40tude.net...
...
> Note one important advantage of having a queue of requests rather than
> communicating directly to the server. The queue decouples the readers from
> the server. So you could have two or three servers processing the requests
> from the queue. On a multi-core architecture that could give you better
> throughout. The number of servers can be adjusted later, you need not to
> decide it upfront as you would with direct rendezvous.

Right. My spam filter is structured this way. There is a pool of tasks for 
processing connections, and a manager task that initially receives 
connections and assigns them to tasks. If there aren't any tasks available, 
the filter is getting overloaded and the extra connections are just dropped 
(SMTP will retry them in a while if real, and if junk, who cares?). The 
connections are processed, and presuming that the connection is not blocked, 
the incoming mail message is read, a token created for it, and that is 
queued on the filter queue.

There is then a pool of filter tasks, which grab message tokens from the 
queue, filter the message, and determine what to do with it - delete, 
quarantine, or deliver. Delete is obvious, quarantine just involves moving 
the message files to a special place, and in the deliver case the token is 
put on a delivery queue.

And delivery works the same way: there is a pool of delivery tasks, which 
take messages off the delivery queue whose delivery time is current, and 
tries to deliver them. If successful, the message is deleted from the 
server; otherwise it is put back on the delivery queue with a time in the 
future (in order to support retries).

There are a lot more details (like returning non-delivery messages if a 
message has been retried too long), but that it is general outline -- and it 
works great. (All of the mail going to the Ada-Comment mailing list, along 
with many others, goes thru our spam filter - a 100% Ada program.)

                                              Randy.





  parent reply	other threads:[~2012-01-26  4:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23 19:32 "C - like: THIS" pointer to a task type inside a task function Ada BRL
2012-01-23 19:59 ` Dmitry A. Kazakov
2012-01-23 22:17   ` tmoran
2012-01-24  8:47     ` Dmitry A. Kazakov
2012-01-24 17:12   ` Ada BRL
2012-01-24 18:43     ` Dmitry A. Kazakov
2012-01-25 12:43       ` Ada BRL
2012-01-25 13:48         ` Dmitry A. Kazakov
2012-01-25 15:05           ` Ada BRL
2012-01-25 18:10             ` Dmitry A. Kazakov
2012-01-26 15:19               ` Ada BRL
2012-01-26  4:17           ` Randy Brukardt [this message]
2012-01-24 17:27   ` Ada BRL
2012-01-23 20:20 ` Jeffrey Carter
2012-01-24 17:13   ` Ada BRL
2012-01-24  6:39 ` J-P. Rosen
2012-01-25  0:42 ` Adam Beneschan
2012-01-25  0:46   ` Adam Beneschan
2012-01-25  7:38   ` J-P. Rosen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox