doubang9906 2015-03-31 20:58
浏览 40
已采纳

使用Swiftmailer和Symfony2的多个线轴

What is the best approach for sending the highest email rate possible with Swiftmailer?

We own an email automation tool and sometimes there are single sendouts of 40.000 emails. Our average rate with the spool:send command is of ~50 emails/min. I've tried copying the same command on the cron 5 times and it worked (i.e. it was sending ~250 emails/min), but it looks like the SMTP server got dizzy, because some contacts were receiving emails with another contact's information (any idea on what could be causing that?).

So now I was thinking about setting up 5 different mailers that spools the emails on different folders and running the 5 commands with a cron, each one for one of those mailers. Should it work? Any other recommended solution?

  • 写回答

1条回答 默认 最新

  • dqp10099 2015-03-31 21:14
    关注

    If you're sending 250 emails per minute, then you need something more resilient than the cron and the Swiftmailer spool. It will be hard to scale, a nightmare to debug, and not very inflexible. The Swiftmailer spool is great if you're sending no more than a couple of emails a minute, but any bigger than that and it's hard to scale and a nightmare to debug.

    Instead, use a job queue like PHP Resque or Rabbit MQ (both are open source). You can replicate the 'spool' by having a queue of emails that need to be sent, and you can add multiple workers and queues. You could also have a second queue that actually adds the jobs to the first queue.

    The advantage is that Rabbit MQ comes with a manager interface, so you can see things like how many emails are being sent, how many are failing, etc. Also, it's easier to scale up and down by adding and removing workers when you're under heavy load, for example.

    Kacper from Sensio Labs actually gave a talk on Rabbit MQ with Symfony last year - http://www.slideshare.net/cakper/2014-0821-symfony-uk-meetup-scaling-symfony2-apps-with-rabbit-mq.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?
  • ¥15 YOLOv8obb获取边框坐标时报错AttributeError: 'NoneType' object has no attribute 'xywhr'
  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸
  • ¥15 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?