分布式系统中的滑动窗口速率限制
Like many other companies, Grab uses marketing communications to notify users of promotions or other news. If a user receives these notifications from multiple companies, it would be a form of information overload and they might even start considering these communications as spam. Over time, this could lead to some users revoking their consent to receive marketing communications altogether. Hence, it is important to find a rate-limited solution that sends the right amount of communications to our users.
像许多其他公司一样,Grab使用营销通信向用户通知促销活动或其他新闻。如果用户从多个公司接收到这些通知,这将成为信息过载的形式,他们甚至可能开始将这些通信视为垃圾邮件。随着时间的推移,这可能导致一些用户撤销接收营销通信的同意。因此,找到一个适当的速率限制解决方案,向我们的用户发送适量的通信非常重要。
Background
背景
In Grab, marketing emails and push notifications are part of carefully designed campaigns to ensure that users get the right notifications (i.e. based on past orders or usage patterns). Trident is Grab’s in-house tool to compose these campaigns so that they run efficiently at scale. An example of a campaign is scheduling a marketing email blast to 10 million users at 4 pm. Read more about Trident’s architecture here.
在Grab中,营销电子邮件和推送通知是精心设计的活动的一部分,以确保用户获得正确的通知(即基于过去的订单或使用模式)。Trident是Grab的内部工具,用于组合这些活动,以便它们在规模上高效运行。一个活动的示例是在下午4点向1000万用户发送营销电子邮件。在此处阅读有关Trident架构的更多信息here。
Trident relies on Hedwig, another in-house service, to deliver the messages to users. Hedwig does the heavy lifting of delivering large amounts of emails and push notifications to users while maintaining a high query per second (QPS) rate and minimal delay. The following high-level architectural illustration demonstrates the interaction between Trident and Hedwig.
Trident依赖于另一个内部服务Hedwig,向用户发送消息。Hedwig负责大量邮件和推送通知的传递,同时保持高查询每秒(QPS)速率和最小延迟。以下高级架构示意图展示了Trident和Hedwig之间的交互。
Diagram of data interaction between Trident and Hedwig
Trident和Hedwig之间的数据交互图
The aim is to regulate the number of marketing comms sent to users daily and weekly, tailored based on their interaction patterns with the Grab superapp.
目标是根据用户与Grab超级应用程序的互动模式,调整每天和每周发送给用户的营销通信数量。
Solution
解决方案
Based on their interaction pattern...