hOW EFFICINT ARE THREADS for sending mails??
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Amit_R
Posted On:   Wednesday, April 10, 2002 01:42 AM

i'm writing a mailer daemon. My program will be querying a one column table for message ids. if there is a message id in that table then a master message table will be queried for that message id. From this master table we'll get to_id, from_id and body part of message. and By using JAVA mail API i'll send mail on to_id. and once mail is sent the record from one column table will be deleted. Somebody gave me suggetion to use treading for this application, so that the performance will be improved. According to him my program will start 5 threads at a time and will do the job what i've explained above and it'll improve performance by 5 times. I'm not convinced with this concept. can anybody comment on this or suggest scallable solution???    More>>

i'm writing a mailer daemon. My program will be querying a one column table for message ids. if there is a message id in that table then a master message table will be queried for that message id. From this master table we'll get to_id, from_id and body part of message. and By using JAVA mail API i'll send mail on to_id. and once mail is sent the record from one column table will be deleted.


Somebody gave me suggetion to use treading for this application, so that the performance will be improved. According to him my program will start 5 threads at a time and will do the job what i've explained above and it'll improve performance by 5 times. I'm not convinced with this concept. can anybody comment on this or suggest scallable solution???

   <<Less

Re: hOW EFFICINT ARE THREADS for sending mails??

Posted By:   Simon_Ablett  
Posted On:   Wednesday, April 10, 2002 07:52 AM

First off, do you have a timing issue? i.e. is your daemon not performing its actions fast enough. Trying to improve the speed of an operation that doesn't need improving is a waste of energy.

Secondly, as I understand it, your operations are as follows.

1. query index table for message id

2. retrieve record from master table using the retrieved message id as key

3. create email using data from record

4. send email

5. delete record from index table

Your latency is likely to lie in the database access. You could have a thread monitoring the index table and copying new rows into a data structure in memory (this thread should also be responsible for deleting rows in order to minimise the chances of locking problems). Another thread would then use this structure to query the master table and a third could generate and send emails. But, quite honestly, I doubt that you'd see any speed improvement unless you're processing a real high volume of messages. In fact I should think it would cause more problems than it would solve (synchronisation, database locking etc). I'd be highly sceptical of your obtaining 5 times improvements - in my opinion anyone stating that is being a little naive but I stand to be corrected!!

Regards.
About | Sitemap | Contact