Re: [twsocket] Optimal number of TWSocket per thread
Arno, It's should be optimized anyway because multipart/alternative messages can be relatively large (20-30 kb of html+text+headers). To send this message current implementation perform about 320 calls to DataNext. While optimized - only 20 calls. For high load smtp relay it's a VERY big difference. Right now I playing with enlarging send buffer... With 900 bytes length I see about 300% of speed increase (from 200 megabytes/sec to 600 megabytes/sec). --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Arno Garrels Sent: Wednesday, November 07, 2012 10:31 PM To: ICS support mailing Subject: Re: [twsocket] Optimal number of TWSocket per thread Max Terentiev wrote: > Hi Angus, > > I perform some tests but cannot send fasten than 200 megabit/sec. > > On large messages (100kb+) Looks like a bottleneck in SmtpCli's > Data/DataNext function. > > I see the code and found what DataNext send message line by line. You are right, that's indeed some bottleneck. I already changed that for attachments some months ago. On the other side, it's unlikely that a message body will contain plenty of lines. -- Arno -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Optimal number of TWSocket per thread
> I perform some tests but cannot send fasten than 200 megabit/sec. Which is pretty good performance, presumably you need more because this is running on a hosted server with gigabyte connectivity? > I see RFC 2821 and found what max line length can be 1000 > characters! Not strictly relevant, I think that is for text, not MIME. > My question is: why message data send line-by-line instead of larger > portions ? But that does not mean SmtpCli can not send multiple MIME lines at a time using Send or something, reducing the number of function calls. It was probably written to send a line at time at a time when were all using slow modems to communicate with each other. It is probably a relatively simple change to SmtpCli, but finding the time to look at it is difficult for all of us. Is it something you can change yourself? Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Optimal number of TWSocket per thread
Max Terentiev wrote: > Hi Angus, > > I perform some tests but cannot send fasten than 200 megabit/sec. > > On large messages (100kb+) Looks like a bottleneck in > SmtpCli's Data/DataNext function. > > I see the code and found what DataNext send message line by line. You are right, that's indeed some bottleneck. I already changed that for attachments some months ago. On the other side, it's unlikely that a message body will contain plenty of lines. -- Arno -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Optimal number of TWSocket per thread
Hi Angus, I perform some tests but cannot send fasten than 200 megabit/sec. On large messages (100kb+) Looks like a bottleneck in SmtpCli's Data/DataNext function. I see the code and found what DataNext send message line by line. Since typical MIME message contains lines with max 64 characters length - for 100kb message DataNext/WSocket.SendStr/OnDataSent/Etc called about 1600 times ! I see RFC 2821 and found what max line length can be 1000 characters! So, in single SendStr call we can send up to 15 message lines (64 characters each), and for 100 kb message we will have only 100 DataNext/WSocket.SendStr/OnDataSent calls instead of 1600 ! My question is: why message data send line-by-line instead of larger portions ? Because it's violate some another Smtp protocol rules ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com >In your case, once you have written the code to support more than one instance and more than one thread, just >make it totally configurable so you can try 10 threads with 400 instance, or 40 threads with 100 instance, >etc, so you can easily experiment. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Optimal number of TWSocket per thread
> How many TSmtpCli(s) should be used inside one TThread ? > I need to send about 4000 messages in parallel, so I need 4000 > TSmtpCli(s). > At this time I try to use 25 TSmtpCli per Thread but see very high > CPU usage and app interface responding this delays.. The 'app interface' could be your problem, if you are calling the main thread using synchronise to update a GUI dynamically. Ensure you don't call synchronise more than once every few (configurable) seconds which is quite adequate to keep someone watching happy that it has not died. ICS will usually handle a few hundred async component instances quite happily in the same thread all processing at the same time. In your case, once you have written the code to support more than one instance and more than one thread, just make it totally configurable so you can try 10 threads with 400 instance, or 40 threads with 100 instance, etc, so you can easily experiment. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be