Improve EXM Dispatch Performance

Improve EXM Dispatch Performance

Sitecore EXM is a great feature for sending newsletters and it offers a lot of cool features. But I can take a while to dispatch if you are sending a lot of emails. For example, 40k emails can take up to 3 hours with the Azure P2V2 App service plan using Sitecore default dispatch settings. This can impact the performance of your Content management instance until the dispatch finishes if you do not have the Dedicated Dispatch Server setup. Having a Dedicated Dispatch Server can be a costly affair if you are not sending newsletters frequently as we have the resources configured for the Dedicated Dispatch Server used only when dispatching newsletters.

We can improve this performance by making minor tweaking to the dispatch settings to reduce the 3 hours of dispatching to less than 20 minutes. Apply the below patch file to update the setting in your Content Management instance.

<configuration   xmlns:patch=  xmlns:role= xmlns:eds= xmlns:exmEnabled=>

    <sitecore exmEnabled:require="yes" role:require="Standalone or ContentManagement or DedicatedDispatch">


            <!-- SEND EMAIL PIPELINE
                 This pipeline dispatches a single email through the SMTP server.

                <processor type="Sitecore.EmailCampaign.Cm.Pipelines.SendEmail.Sleep, Sitecore.EmailCampaign.Cm">
                    <!-- Number of milliseconds to put the thread to sleep for after an email has been sent. -->
                    <param desc="sleep">
                        <patch:delete />
                    <param desc="sleep" patch:before="*[1]">0</param>

            <!-- The number of threads that you can use for sending messages. -->
            <setting name="NumberThreads" value="32"  patch:instead="setting[@name='NumberThreads']" />

            <!-- Specifies how many sending threads can generate messages at the same time.
                  Value should be no less than 1.
                  Default value: Environment.ProcessorCount * 2 -->
            <setting name="MaxGenerationThreads" value="32" patch:instead="setting[@name='MaxGenerationThreads']" />

The above patch configuration changes the sleep time before dispatching each email to 0 from the default value of 50ms, so it will continuously dispatch the emails. With the default sleep of 50ms per email, it will add up to 2000 seconds for 40000 emails, that’s just over 33 mins quicker.

It also updates the NumberThreads to 32 from 10, this setting will add additional 22 threads to process the dispatch and MaxGenerationThreads to 32 from the Default value set to empty (which is Environment.ProcessorCount * 2, which will be 4 if you are using Azure P2V2 plan).

These 3 changes will improve the dispatching drastically and reduces the dispatch time significantly and also adds up a lot of load on the app service plan. The CPU and Memory on the app service plan will reach 100% in about 15 minutes making Content Management hardly usable until the dispatch is done and the dispatch will finish in about 20 minutes.

The number of emails dispatched without these settings per second is around 10 against the average of around 45 emails per second and also increases the queuing time making it worth the impact it adds on Content Management.

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *