mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Docs: add info on batch send performance
This commit is contained in:
@@ -12,8 +12,4 @@ done with Anymail:
|
|||||||
django_templates
|
django_templates
|
||||||
securing_webhooks
|
securing_webhooks
|
||||||
test_backend
|
test_backend
|
||||||
|
performance
|
||||||
.. TODO:
|
|
||||||
.. Working with django-mailer(2)
|
|
||||||
.. Sharing backend connections (sessions)
|
|
||||||
|
|
||||||
|
|||||||
24
docs/tips/performance.rst
Normal file
24
docs/tips/performance.rst
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
.. _performance:
|
||||||
|
|
||||||
|
Batch send performance
|
||||||
|
======================
|
||||||
|
|
||||||
|
If you are sending batches of hundreds of emails at a time, you can improve
|
||||||
|
performance slightly by reusing a single HTTP connection to your ESP's
|
||||||
|
API, rather than creating (and tearing down) a new connection for each message.
|
||||||
|
|
||||||
|
Most Anymail EmailBackends automatically reuse their HTTP connections when
|
||||||
|
used with Django's batch-sending functions :func:`~django.core.mail.send_mass_mail` or
|
||||||
|
:meth:`connection.send_messages`. See :ref:`django:topics-sending-multiple-emails`
|
||||||
|
in the Django docs for more info and an example.
|
||||||
|
|
||||||
|
(The exception is when Anymail wraps an ESP's official Python package, and that
|
||||||
|
package doesn't support connection reuse. Django's batch-sending functions will
|
||||||
|
still work, but will incur the overhead of creating a separate connection for each
|
||||||
|
message sent. Currently, only SparkPost has this limitation.)
|
||||||
|
|
||||||
|
If you need even more performance, you may want to consider your ESP's batch-sending
|
||||||
|
features. When supported by your ESP, Anymail can send multiple messages with a single
|
||||||
|
API call. See :ref:`batch-send` for details, and be sure to check the
|
||||||
|
:ref:`ESP-specific info <supported-esps>` because batch sending capabilities vary
|
||||||
|
significantly between ESPs.
|
||||||
Reference in New Issue
Block a user