SQS Queue replication?

We have an application that runs in the eu-xxx AZ. It puts data into a Redis cache and then posts messages onto a SQS queue for processes to retrieve the data from the cache and do stuff. All is well and good and we are happy as to how things work given that most of our customers are part of the eu-xxx AZ

We now have a customer who is in a much more remote AZ and the performance of the system is unsatisfactory for them. We have looked at upgrading the Redis cache to a Global datastore and it is replicating the data from eu-xxx to ap-xxx is around 80ms. Which is exactly the sort of thing we were looking for

The problems are the queues. If we set up a queue for the customer in eu-xxx there is a significant delay in reading the messages off the queue in ap-xxx. It is at best 10x slower than reading in eu-xxx, sometimes messages are being read in seconds rather than ms

If we set up a queue in ap-xxx we still have to post to it from eu-xxx. Reading the queue in ap-xxx is much better but writing to the queue from eu-xxx is around 2 orders of magnitude worse!

I’m having to pick the least of two evils here. Queues (as a mechanism) are the correct choice for the application so we are stuck with that

Is there anything in the soup of AWS services that would do for SQS what Global datastores does for caches?

Do you post a message to each customer’s queue independently? If so, it sounds like the standard SNS —-fanout—-> SQS is a super easy fix for your problem: instead of SQS SendMessage-ing to each customer’s queue in a loop, simply create an SNS topic, subscribe all the customer queues to it, and replace your loop of SendMessage calls with a single SNS Publish call. SNS-to-SQS subscriptions can also cross regions, so your topic can be in one region and SNS takes care of the cross-region SQS calls for you

I’m sorry, I don’t have a solution off the top of my head. But I’m curious, why can’t queue processing tolerate a few more extra seconds, since it is already an async process ?

This seems to be the way. (me: avid sns->sqs user)

The application is based around real world sports events. We have to receive these events, process them and send them to the customer who also has to process them. Speed is of the essence

Think sports betting, if the process is too slow then someone on a telephone to someone watching the match could place or cancel bets based on the events in the match before the bookmaker knows that they have even happened

In reality this almost never happens and there are all sorts of safeguards but adding a second here and there to the process is opening up the window for such a thing

A concrete example would be in a Football match an outsider looked like they might score a goal (wild odds but promissing a big payout). Someone would set the bet up and wait to be told that the goal was scored or not before confirming the bet. Now bookies receive data (via our system) that tells them that a goal might be scored (opposition with the ball near the goal) at which point they would stop accepting goalscorer bets

The gap between a goal might be scored and actually happening can be only a few seconds. So if the “a goal might be scored” message is delayed by a few seconds someone could place a bet in that window

As I say it rarely happens but the thought of it will keep bookies awake at night :slight_smile:

I have sort of looked at SNS but getting a measure of how long it would take is tricky

Also looking at EventBridge Pipes which can do SQS <=> SQS but again got to see how much time this add as a solution

Have you looked at Kinesis? One of its listed features is low latency.

Thanks I will look into this too

With latency as a concern my first recommendation would be kinesis. Relying on the latency of sqs to be consistently low probably isn’t a good practice.

SNS is likely to be faster and cheaper than EventBridge.

Event Bridge “processes” rules which can add latency.

SNS just sends to the subscribers.

Both will use AWS backbone.

There does not seem to be and value in the EventBridge overhead

Thanks, looking at it there was also the issue of batching up events which also sounded like a source of latency