AWS SQS - unders/mywiki GitHub Wiki

Duplication

Go

SQS -> Lambda

  • Just as a quick note here, our Lambda function timeout has to be lower than the queue’s visibility timeout in order to create the event mapping from SQS to Lambda.
  • Standard queues provide at-least-once delivery, which means that each message is delivered at least once.
  • By grouping messages into batches, you can reduce your Amazon SQS costs.
  • Instead of trying to process failing messages until they expire, it is better to move them to a dead-letter queue after a few processing attempts.
  • Typical latencies for SendMessage, ReceiveMessage, and DeleteMessage API requests are in the tens or low hundreds of milliseconds.
  • Amazon SQS long polling results in higher performance at reduced cost in the majority of use cases.
  • The AmazonSQSBufferedAsyncClient for Java provides an implementation of the AmazonSQSAsyncClient interface and adds several important features: Prefetching of messages into a local buffer that allows your application to immediately process messages from Amazon SQS without waiting for the messages to be retrieved
  • This attribute specifies the limit on bytes that an Amazon SQS message can contain. Set this limit to a value between 1,024 bytes (1 KB), and 262,144 bytes (256 KB)
  • However, there is a 120,000 limit for the number of inflight messages for a standard queue
  • At-Least-Once Delivery – A message is delivered at least once, but occasionally more than one copy of a message is delivered.
  • For example, if the latency from an Amazon EC2-based client to Amazon SQS in the same region averages 20 ms, the maximum throughput from a single thread over a single connection averages 50 TPS.
  • For example, by default, instances of the AWS SDK for Java AmazonSQSClient class maintain at most 50 connections to Amazon SQS.
  • Batching performs more work during each round trip to the service (for example, when you send multiple messages with a single SendMessageBatch request).
  • Because ReceiveMessage can process 10 messages at a time, there is no ReceiveMessageBatch action.
  • Because each round trip carries more work, batch requests make more efficient use of threads and connections, improving throughput.
  • You can use batched Amazon SQS actions to send, receive, or delete up to 10 messages at a time. Because Amazon SQS charges by the request, batching can substantially reduce your costs.
  • delay queue allows the user to set a default delay on a queue such that delivery of all messages enqueued is postponed for that time duration
  • Each message receives a system-assigned message ID that SQS returns to with the SendMessage response.
  • Consumer should delete the message within the Visibility timeout. If the consumer fails to delete the message before the visibility timeout expires, the message is visible again for other consumers.
  • Pricing adds insult to the injury of performance in these services. If we wanted to scale this application to 1 million messages a second, the SQS request rate alone would cost $1,584 per hour. Note that this does not account for the Lambda execution costs. T

Papers

Kubernetes

Cloud Agnostic