All,

We are at our wits end.  We are trying to daily newsletters to 320,000 users
in a timely fashion.  We use the batchmail.cfm script below to batch the
mail through the cfx tag 250 emails at a time.  We use cfscheduler to call
the script every minute.  If the file is not done it assigns various
statuses until the mail is complete.  Once the status = complete the next
time the cfm page is called it does this all over again for the next 250
users(emails).


250 is taking on average of 90 seconds to complete! (Our server is a DELL
PowerApp120 with dual PIII 866s and 2GB RAM, CF 4.5.1 SP2, iMS POST
Enterprise 2.0.6 with CFX_IMSMAIL 2.6 (release candidate1) and we were
running 2.2 as well with no noticeable difference in speed)).

We have tried batching 1000 at a time with an average time of 290 seconds.
500 per time at 190 seconds.

We timed the scripts other than cfx and found them to run quite fast.  The
issue definetly seems to be CFX_IMSMAIL (2.6 as well as 2.2).

Any suggestions?  Any settings to tweak?  Anything?

12,000 emails per hour is sick on this machine.  We tried just cfmail to our
smtp server and in a test environment sent 90,000 emails per hour.  Isn't
CFX_IMSMAIL supposed to be faster?


Matt Boyce
101Marketing, Inc.


***************
Code of Batch Mail CFML page



<cfset StartTime = "#Hour(Now())#:#Minute(Now())#:#Second(Now())#">
<!--- �������� ������� ��������� --->

<cfquery datasource="weathercentral" name="GetMsgBatch" maxrows="1">
        SELECT * FROM MailBatch
        WHERE MailBatchStatus = 3
        ORDER BY MailBatchID</cfquery><!--- Not finished --->

<cfif GetMsgBatch.RecordCount is 0>
        <cfquery datasource="weathercentral" name="GetMsgBatch" maxrows="1">
                SELECT * FROM MailBatch
                WHERE MailBatchStatus = 2 ORDER BY MailBatchID</cfquery><!--- In
process --->
</cfif>

<cfif GetMsgBatch.RecordCount is 0>
        <cfquery datasource="weathercentral" name="GetMsgBatch" maxrows="1">
                SELECT * FROM MailBatch
                WHERE MailBatchStatus = 1 ORDER BY MailBatchID</cfquery><!--- Created 
--->
</cfif>

<cfif GetMsgBatch.RecordCount is 0>
        0 records<cfabort>
</cfif>
<cfif not IsNumeric(GetMsgBatch.LastUserIDRef)>
        wrong UserID<cfabort>
</cfif>
<cfif Len(GetMsgBatch.MailBatchQuery) is 0>
        wrong Query<cfabort>
</cfif>

<cfquery name="GetSet" datasource="weathercentral" maxrows="1">
        SELECT * FROM Settings</cfquery>

<cfif GetMsgBatch.MailBatchStatus is 2>
        <cfquery datasource="weathercentral" name="UpdTry">
                UPDATE MailBatch SET UnsuccessTry = <cfif
IsNumeric(GetMsgBatch.UnsuccessTry)>
                                                        UnsuccessTry + 
1<cfelse>1</cfif>
                WHERE MailBatchID = #GetMsgBatch.MailBatchID#
        </cfquery>
        <cfif GetMsgBatch.UnsuccessTry gte 20>
                <cfmail to="#Trim(GetSet.AdminEMail)#"
                        from="#Trim(GetSet.AdminEMail)#"
                        subject="mail batch fail : ("
                        server="#Trim(GetSet.EMailServer)#">msg send unsuccess</cfmail>
                <cfquery datasource="weathercentral" name="UpdTry">
                        UPDATE MailBatch SET MailBatchSTATUS = 6 <!--- 6 BADLY --->
                        WHERE MailBatchID = #GetMsgBatch.MailBatchID#
                </cfquery>

                <cfabort>
        </cfif><!--- <cfif GetMsgBatch.UnsuccessTry gte 10> --->
<cfabort>
</cfif><!--- <cfif GetMsgBatch.MailBatchStatus is 0> --->

<cfquery datasource="weathercentral" name="GetMsg" maxrows="1">
        SELECT * FROM Messages
        WHERE MsgID = #GetMsgBatch.MsgIDRef#</cfquery>

<cfset Qry = URLDecode(GetMsgBatch.MailBatchQuery)>
        <cfquery name="GetUsers" datasource="weathercentral" maxrows="250">
                #PreserveSingleQuotes(Qry)#
                AND Users.UserID > #GetMsgBatch.LastUserIDRef#
                ORDER BY Users.UserID
        </cfquery>
<cfif GetUsers.RecordCount gt 0>
        <cfquery datasource="weathercentral" name="UpdTry">
                UPDATE MailBatch SET MailBatchSTATUS = 2
                WHERE MailBatchID = #GetMsgBatch.MailBatchID#
        </cfquery>

</cfif><!--- <cfif GetUsers.RecordCount gt 0> --->

        <cfset CountToSenT=0>
        <cfset CountToSenD=0>
        <cfquery datasource="weathercentral" name="UpdTry">
                UPDATE MailBatch SET LastUserIDRef =
#GetMsgBatch.LastUserIDRef[GetMsgBatch.RecordCount]#
        </cfquery>

<cfloop query="GetUsers">

        <cfset MessageBody = Replace(GetMsgBatch.MsgTEXTBody, "%40%40%40UID",
"#UserUID#","ALL")>
        <cfset MessageBody = Replace(MessageBody, "%40%40%40MsgID",
"#GetMsg.MsgID#","ALL")>
        <cfset MessageBody = Replace(MessageBody, "%40%40%40UserFirstName",
"#Trim(UserFirstName)#","ALL")>
        <cfset MessageBody = Replace(MessageBody, "%40%40%40UserLastName",
"#Trim(UserLastName)#","ALL")>
        <cfset MessageBody = Replace(MessageBody, "%40%40%40UserSalutation",
"#Trim(UserSalutation)#","ALL")>
        <cfset MessageBody = Replace(MessageBody, "%40%40%40UserEmail",
"#UserEmail#","ALL")>
        <cfset MessageBody = Replace(MessageBody, "%40%40%40AdminName",
"#GetSet.AdminName#","ALL")>
        <cfset MessageBody = Replace(MessageBody, "%40%40%40AdminEmail",
"#GetSet.AdminEmail#","ALL")>
        <cfset MessageBody = Replace(MessageBody, "%40%40%40SystemURL",
"#GetSet.SystemURL#","ALL")>

        <!--- Start Parse HTML body --->
        <cfset MessageHTMLBody = Replace(GetMsgBatch.MsgHTMLBody, "%40%40%40UID",
"#UserUID#","ALL")>
        <cfset MessageHTMLBody = Replace(MessageHTMLBody, "%40%40%40MsgID",
"#GetMsg.MsgID#","ALL")>
        <cfset MessageHTMLBody = Replace(MessageHTMLBody, "%40%40%40UserFirstName",
"#Trim(UserFirstName)#","ALL")>
        <cfset MessageHTMLBody = Replace(MessageHTMLBody, "%40%40%40UserLastName",
"#Trim(UserLastName)#","ALL")>
        <cfset MessageHTMLBody = Replace(MessageHTMLBody,
"%40%40%40UserSalutation", "#Trim(UserSalutation)#","ALL")>
        <cfset MessageHTMLBody = Replace(MessageHTMLBody, "%40%40%40UserEmail",
"#UserEmail#","ALL")>
        <cfset MessageHTMLBody = Replace(MessageHTMLBody, "%40%40%40AdminName",
"#GetSet.AdminName#","ALL")>
        <cfset MessageHTMLBody = Replace(MessageHTMLBody, "%40%40%40AdminEmail",
"#GetSet.AdminEmail#","ALL")>
        <cfset MessageHTMLBody = Replace(MessageHTMLBody, "%40%40%40SystemURL",
"#GetSet.SystemURL#","ALL")>
        <!--- End Parse HTML body --->

<!---   <cfquery datasource="weathercentral" name="GetMessToday">
                SELECT * FROM MailLog
                WHERE DateCreated='#DateFormat(NOW(),"yyyy-mm-dd")#'
                        AND UserIdRef=#GetUsers.UserID#
        </cfquery>

        <cfif GetMessToday.RecordCount LT GetSet.MessagesPerDay> --->
                <cfset CountToSenD=CountToSenD+1>

                <cfif GetSet.UseCFMail eq 1>

                        <cfif GetUsers.HtmlText is 1>
                                <cfset SendMsg=URLDecode(MessageHTMLBody)>
                        <cfelse>
                                <cfset SendMsg=URLDecode(MessageBody)>
                        </cfif>

                  <cfif GetMsg.MsgSendHTML eq 1>

                        <cfmail to="#Trim(GetUsers.UserEmail)#"
                                from="#Trim(URLDecode(GetMsg.MsgFROM))#"
                                subject="#Trim(URLDecode(GetMsg.MsgTitle))#"
                                server="#Trim(GetSet.EMailServer)#"
                                type="#iif(GetUsers.HtmlText is 1, DE('html'),
DE(''))#">#Trim(SendMsg)#</cfmail>
                  <cfelse><!--- <cfif GetMsg.MsgSendHTML eq 1> --->
                        <cfmail to="#Trim(GetUsers.UserEmail)#"
                                from="#Trim(URLDecode(GetMsg.MsgFROM))#"
                                subject="#Trim(URLDecode(GetMsg.MsgTitle))#"
                                server="#Trim(GetSet.EMailServer)#"
                                type="">#Trim(URLDecode(MessageBody))#</cfmail>
                  </cfif><!--- <cfif GetMsg.MsgSendHTML eq 1> --->

                <cfelse><!--- <cfif GetSet.UseCFMail eq 1> --->


                  <cfif GetMsg.MsgSendHTML eq 1>
                        <cfif GetUsers.HtmlText is 1>
                                <cfx_imsmail
                                        Header_Reply_To = "#Trim(GetSet.AdminEmail)#"
                                        smtpto = "#Trim(GetUsers.UserEmail)#"
                                        header_to = "#Trim(GetUsers.UserEmail)#"
                                        smtpfrom = "#Trim(URLDecode(GetMsg.MsgFROM))#"
                                        header_from = 
"#Trim(URLDecode(GetMsg.MsgFROM))#"
                                        html = "#Trim(URLDecode(MessageHTMLBody))#"
                                        header_subject = 
"#Trim(URLDecode(GetMsg.MsgTitle))#"
                                ></cfx_imsmail>
                        <cfelse><!--- <cfif GetMsg.MsgSendHTML eq 1> --->
                                <cfx_imsmail
                                        Header_Reply_To = "#Trim(GetSet.AdminEmail)#"
                                        smtpto = "#Trim(GetUsers.UserEmail)#"
                                        header_to = "#Trim(GetUsers.UserEmail)#"
                                        smtpfrom = "#Trim(URLDecode(GetMsg.MsgFrom))#"
                                        header_from = 
"#Trim(URLDecode(GetMsg.MsgFrom))#"
                                        body = "#Trim(URLDecode(MessageBody))#"
                                        header_subject = 
"#Trim(URLDecode(GetMsg.MsgTitle))#"
                                ></cfx_imsmail><!--- MX = "#Trim(GetSet.EMailServer)#" 
--->
                        </cfif><!--- <cfif GetUsers.HtmlText is 1> --->
                  <cfelse><!--- <cfif GetMsg.MsgSendHTML eq 1> --->
                                <cfx_imsmail
                                        Header_Reply_To = "#Trim(GetSet.AdminEmail)#"
                                        smtpto = "#Trim(GetUsers.UserEmail)#"
                                        header_to = "#Trim(GetUsers.UserEmail)#"
                                        smtpfrom = "#Trim(URLDecode(GetMsg.MsgFrom))#"
                                        header_from = 
"#Trim(URLDecode(GetMsg.MsgFrom))#"
                                        body = "#Trim(URLDecode(MessageBody))#"
                                        header_subject = 
"#Trim(URLDecode(GetMsg.MsgTitle))#"
                                ></cfx_imsmail>
                  </cfif>
                </cfif><!--- <cfif IsDefined("SendHTML")> --->

                <cfquery datasource="weathercentral" name="GetMessToday">
                        INSERT INTO MailLog
                                        (UserIdRef, MessageSubject,
                                        DateCreated)
                        VALUES (#GetUsers.UserID#, 
'#Trim(URLDecode(GetMsg.MsgTitle))#',
                                        '#DateFormat(NOW(),"yyyy-mm-dd")#')
                </cfquery>

<!---   <cfelse><!--- <cfif GetMessToday.RecordCount LT
GetSet.MessagesPerDay> --->
                <cfset CountToSenT=CountToSenT+1>
        </cfif><!--- <cfif GetMessToday.RecordCount LT GetSet.MessagesPerDay> --->
 --->
</cfloop><!--- <cfloop query="GetUsers"> --->

<cfif GetUsers.RecordCount gt 0>
<cfset EndTime = "#Hour(Now())#:#Minute(Now())#:#Second(Now())#">

        <cfquery datasource="weathercentral" name="UpdTry">
                UPDATE MailBatch SET
                        UsersCntWasSended = UsersCntWasSended + #CountToSenD#,
                        LastUserIDRef = #GetUsers.UserID[GetUsers.RecordCount]#,
                        UnsuccessTry = 0,
                        MailBatchSTATUS = 3, <!--- Not Finished --->
                        MailBatchProcessTime = '#StartTime# - #EndTime#'
                WHERE MailBatchID = #GetMsgBatch.MailBatchID#
        </cfquery>
<cfelse><!--- <cfif GetUsers.RecordCount gt 0> --->
        <cfquery datasource="weathercentral" name="UpdTry">
                UPDATE MailBatch SET MailBatchSTATUS = 5 <!--- 5 FINISHED --->
                WHERE MailBatchID = #GetMsgBatch.MailBatchID#
        </cfquery>
</cfif><!--- <cfif GetUsers.RecordCount gt 0> --->


<cfoutput>
The message was successfully sent to #CountToSenD# person(s)
and #CountToSenT# person(s) were sent earlier
</cfoutput>

<!--- <cftry>
        <cfschedule action="UPDATE" task="MailBatch"  operation="HTTPRequest"
url="http://cf.avm.ru/wethercentral/admin/MailBatch.cfm";
startdate="01/01/2001" starttime="#DatePart('h', Now())#:#DatePart('n',
Now())#:#DatePart('s', Now())#" interval="60" resolveurl="No" publish="No">
<cfcatch type="Any">oops</cfcatch>
</cftry> --->


========================================================================
     This list server is Powered by iMS
   'The Swiss Army Knife of Mail Servers'
   --------------------------------------
To leave this list please complete the form at 
http://www.coolfusion.com/iMSSupport.cfm
Need an iMS Developer license?  Sign up for a free license here:
http://www.coolfusion.com/iMSDevelopers.cfm
List archives: http://www.mail-archive.com/infusion-email%40eoscape.com/
========================================================================

Reply via email to