zlacker

[parent] [thread] 15 comments
1. Jemacl+(OP)[view] [source] 2019-05-27 17:05:22
We love SQS, but one of the problems we're running into lately is the 256kb per message limitation. We do tens of millions of messages per day, with a small percentage of those reaching the 256kb limit. We're approaching the point where most of our messages will hit that limit.

What are our options for keeping SQS but somehow sending large payloads? Only thing I can think of is throwing them into another datastore and using the SQS just as a pointer to, say, a key in a Redis instance.

(Kafka is probably off the table for this, but I could be convinced. I'd like to hear other solutions first, though.

replies(6): >>somede+P >>m4r+52 >>mark24+r2 >>mateus+ad >>manish+Ck >>TeeWEE+MF1
2. somede+P[view] [source] 2019-05-27 17:10:39
>>Jemacl+(OP)
We point to an s3 object for any large payloads
replies(2): >>8note+d1 >>Jemacl+oA
◧◩
3. 8note+d1[view] [source] [discussion] 2019-05-27 17:13:00
>>somede+P
and there's a library around that can do it for you, at least in java
4. m4r+52[view] [source] 2019-05-27 17:19:19
>>Jemacl+(OP)
Hard to suggest smth without details, but imo 256kb per message is a lot and enough. One thing I would consider is storing such "messages" payload on s3, and sending notification to sqs allowing you to fetch given file and process it (this however might be expensive if you happen to have such high traffic)
5. mark24+r2[view] [source] 2019-05-27 17:22:51
>>Jemacl+(OP)
The Java SDK for SQS automatically drops >256k messages into an S3 bucket and stores a pointer to the message in SQS itself. You set the bucket and the client transparently handles retrieving a message from SQS/S3 when necessary.

Based on the structure of the message (UUIDv4) you could probably roll your own implementation in any language.

replies(1): >>Jemacl+sA
6. mateus+ad[view] [source] 2019-05-27 18:52:27
>>Jemacl+(OP)
We have a library that puts the payload in s3 bucket under random key, the bucket has expiration policy of few days. Then we generate http link to the object and send an sqs message with this url in metadata. The reader library gets data from s3, it doesn't even have to remove it. It will disappear automatically later.

We do it "by ourselves", not using the provided lib, because that way it works both for SQS and SNS. The provided lib only supports SQS.

Also our messages aren't typically very big, so we do this only if the payload size demands it.

replies(1): >>Jemacl+pA
7. manish+Ck[view] [source] 2019-05-27 19:58:52
>>Jemacl+(OP)
I've successfully been using Kafka in production with a tiny percentage of packets ~1Mb. We utilize gzip compression with chunking on some of those messages (system is legacy, no fancy compressed message format in use). IIRC, only had to modify settings at the broker level and it works perfectly fine.
replies(1): >>Jemacl+JA
◧◩
8. Jemacl+oA[view] [source] [discussion] 2019-05-27 22:54:26
>>somede+P
Wouldn't sending and later retrieving millions of S3 objects be expensive?
◧◩
9. Jemacl+pA[view] [source] [discussion] 2019-05-27 22:54:38
>>mateus+ad
Wouldn't sending and later retrieving millions of S3 objects be expensive?
replies(1): >>mateus+UZ
◧◩
10. Jemacl+sA[view] [source] [discussion] 2019-05-27 22:54:54
>>mark24+r2
That's a good idea, but wouldn't sending and later retrieving millions of S3 objects be expensive?
replies(1): >>maniga+qG
◧◩
11. Jemacl+JA[view] [source] [discussion] 2019-05-27 22:56:43
>>manish+Ck
We've discussed switching to Kafka. There are some pros/cons to doing that. With respect to my problem above, our messages _could _conceivably approach 1MB (or even surpass it), so we're really just delaying the inevitable. That said, we're a long, long way from hitting that limit, so it's definitely something we're looking at.

We just recently started gzipping our payloads, which buys us even more time.

◧◩◪
12. maniga+qG[view] [source] [discussion] 2019-05-28 00:20:49
>>Jemacl+sA
Yes, and slow, if you're actually doing it for millions. The comment was saying the library only does it for messages that are over the size limit though.
replies(1): >>Jemacl+wZ
◧◩◪◨
13. Jemacl+wZ[view] [source] [discussion] 2019-05-28 05:15:38
>>maniga+qG
Gotcha.
◧◩◪
14. mateus+UZ[view] [source] [discussion] 2019-05-28 05:21:49
>>Jemacl+pA
Messaging in our system is not high volume so not in this case. Also as I said - these big messages are pretty rare.
replies(1): >>Jemacl+vl2
15. TeeWEE+MF1[view] [source] 2019-05-28 13:56:58
>>Jemacl+(OP)
Why are your messages large? Messages should just be signalling events, like follows:

OrderCreated(order_id=23)

UserLoggedIn(user_id=342)

etc.

I guess you are sending the whole user object over the event bus? Isnt that an anti-pattern?

◧◩◪◨
16. Jemacl+vl2[view] [source] [discussion] 2019-05-28 17:54:32
>>mateus+UZ
Gotcha. That makes sense.
[go to top]