PHP队列失败安全

时间:2013-10-24 08:47:18

标签: php queue

目前使用像amazon的队列服务这样的队列系统设置。现在我正在使用主管让工人们戒烟。

尝试提供可以接收500-2K reqs / sec的前端点,并且需要通过队列捕获数据。有时队列服务[基于https]关闭,我当前正在运行beanstalkd作为备份队列,它接收相同的数据并发送到一组独立的工作者并将该数据存储在一个单独的数据库中,但具有与主数据库相同的表结构分贝。

我的想法是,我会从备份中获取数据并将其与预期的实际数据进行比较并进行审核,任何差异都会被报告并可能会添加到预期的数据集中。

这似乎是解决此问题的实用方法,因为我正在尝试确保捕获99.99%的数据。

下面的小“演示”可以帮助你拍照。

Endpoint A -- collects data(
    Queue1[amazon type queue]
    Queue2[beanstalkd]
)

Queue1 Worker sends data to DB1[used for reports]
Queue2 Worker sends data to DB2[storage --expect to have all data]

Audit Process compares data from DB2 to DB1 and reports the differences
If differences captured, tries to add them to DB1

1 个答案:

答案 0 :(得分:0)

决定接受N.B的评论并应用不同的模型。我有一个主要队列服务和一个辅助服务。如果第一个发送了无效或错误的http响应,我会将消息发送到备份队列。队列工作者将从两个源中提取并适当地运行它们。

这是一个小图表,结果是什么,所以你可以看到原始想法和最终想法之间的区别....

Endpoint A -- collects data(
    Queue1[amazon type queue]
    Queue2[amazon2 type queue]
)

Queue1 Worker sends data to DB1[used for reports]

If Queue1 fails, it auto sends data to Queue2, 
If Queue2 fails, it stores in database for later retrieval