Ram Prasad wrote:
> Sorry for being OT
> I am trying to search for a simple C threadpool library for linux ,
> But almost all results lead to C# libraries.
>
> Is Threadpooling under linux not used or recommended ?
>
> I am trying to implement a multi-threaded app to send mails for a
> client. This has to connect to a mysql database get the records for
> the day and then send a mail.
> The current one in php is too slow , these are important market
> reports , which have to reach as soon as possible to the clients
> before the market opens for the day.
>
> I am trying to use a multi-threaded system so that I can maximize
> the throughput.
>
> What is the recommended way ?
Have you studied the rate-limiting step in your architecture ?
Where is the bottleneck ?
(The email server has finite limits - profile the processing of
each message, and see if all the time is spent conversing with
the email server. Running in parallel might not help, because
the email server will have a "number of connections" limit.)
I have a feeling, you're assuming since you have a gigabit connection
to the email server, it will run at one gigabit per second, if
your program runs fast enough. The email server may only accept
20 emails per second, and a dialup connection would have enough
bandwidth for that. And if the email server is designed to
accept messages faster, it only causes the internal queue in the
email server to grow, and the messages won't leave the
server for another eight hours.
If the ISP or company had 100 email servers, you could fork 100
threads and send 20 emails per second in each thread. Still no
where near what you were expecting.
You can write and run your own email server. Good luck with that.
Who will accept a connection from you ? Will your server
be instantly blacklisted ? Think of the upstream servers you
will be overloading, with one million emails at 7:59AM in the
morning. Now, those servers take eight hours to deliver
all the mail.
Start by benchmarking the processing rate of the email
back end. If you really have infinite email capacity
in your system, the rest of your project *will* be
trivial.
(An example of programmers fighting with email...)
http://social.msdn.microsoft.com/For...b-8787a0443610
Paul