SQS 큐
메시지 큐. 생산자와 소비자를 떼어 놓는 버퍼
이게 뭔가요? / What is this?
SQS는 서버나 데이터베이스가 아니라, 메시지를 안전하게 담아두는 가상의 우편함(큐)입니다. 받는 사람이 잠깐 자리를 비워도 편지가 사라지지 않고 우편함에 그대로 남아 있는 것처럼, 뒷단 시스템이 느리거나 잠깐 죽어 있어도 메시지는 유실되지 않고 큐 안에서 기다립니다.
개요 / Overview
SQS는 메시지를 안전히 보관해 뒷단이 느리거나 죽어도 요청이 유실되지 않게 합니다. "트래픽 급증을 흡수하라", "구성 요소를 분리하라", "작업이 유실되면 안 된다"는 문제의 정답입니다.
동작 원리 / How it works
SQS는 메시지를 여러 서버에 중복 저장해 두고, 소비자가 폴링으로 가져가는 큐입니다. 메시지를 받아 가면 즉시 지워지지 않고 가시성 제한 시간 동안 다른 소비자에게 숨겨집니다. 소비자가 처리를 끝내고 명시적으로 삭제해야 사라지고, 실패하거나 죽으면 제한 시간이 지나 다시 보이게 되어 다른 소비자가 집어갑니다. 이 "빌려주고 확인받는" 구조가 작업 유실을 막는 원리입니다.
Standard 큐는 이 구조를 분산 저장 위에 올려 거의 무제한 처리량을 내지만, 그 대가로 순서를 보장하지 않고 드물게 중복 전달이 일어납니다. FIFO 큐는 메시지 그룹 단위로 순서와 정확히 한 번 처리를 보장하지만 처리량 상한이 낮습니다.
시험은 무엇을 보는가 / What the exam is testing
SQS는 디커플링 문제의 중심입니다. "한 구성 요소가 죽으면 전체가 멈춘다", "트래픽 급증에 뒷단이 무너진다", "작업이 유실되면 안 된다"는 모두 큐를 삽입하는 것이 정답입니다. 두 번째 출제 각도는 큐 깊이로 ASG를 조정하는 것이고, 세 번째는 Standard와 FIFO 중 어느 쪽인지입니다.
시험 포인트 / Exam points
Standard는 거의 무제한 처리량이지만 순서를 보장하지 않고 중복 전달이 가능합니다. FIFO는 순서와 정확히 한 번 처리를 보장합니다. "순서대로 처리해야 한다"면 FIFO입니다.
소비자가 메시지를 가져가면 일정 시간 다른 소비자에게 보이지 않습니다. 처리 시간보다 짧으면 같은 메시지가 중복 처리되므로 넉넉히 잡아야 합니다.
지정 횟수만큼 처리에 실패한 메시지를 별도 큐로 보내 원인을 분석합니다. "실패한 메시지를 격리하라"의 정답입니다.
큐 깊이를 CloudWatch 지표로 삼아 워커 수를 조정하면 부하에 정확히 비례하는 확장이 됩니다.
자주 틀리는 함정 / Common traps
가시성 제한 시간을 처리 시간보다 짧게 두는 구성 — 같은 메시지가 중복 처리됩니다.
순서가 중요한 주문 처리에 Standard 큐를 고르는 것 — FIFO가 정답입니다.
실패 메시지 격리 없이 무한 재시도하는 구성 — 독성 메시지가 큐를 막습니다. 데드레터 큐가 필요합니다.
헷갈리는 것 구분하기 / Telling them apart
메시지 한 건을 한 소비자가 처리하면 SQS(큐), 여러 구독자가 각자 받아야 하면 SNS(브로드캐스트)입니다. 둘을 겹쳐 SNS 토픽에 여러 SQS 큐를 구독시키는 팬아웃이 시험의 대표 정답 구조입니다.
Amazon SQS
A message queue that buffers producers from consumers
이게 뭔가요? / What is this?
SQS is not a server or a database — it is a virtual mailbox (a queue) that holds messages safely. Just as a letter stays waiting in the mailbox even if the recipient steps away for a while, messages sit safely in the queue even when the backend system is slow or briefly down, instead of being lost.
개요 / Overview
SQS durably holds messages so requests survive a slow or failed backend. It answers "absorb traffic spikes", "decouple components", and "no work may be lost".
동작 원리 / How it works
SQS stores each message redundantly across servers and consumers poll for it. Receiving a message does not delete it; it hides it from other consumers for the visibility timeout. It disappears only when the consumer explicitly deletes it after finishing, and a failure or crash lets the timeout expire so another consumer picks it up. This lease-and-acknowledge structure is what prevents lost work.
Standard queues put that on distributed storage for near-unlimited throughput, at the cost of no ordering guarantee and occasional duplicate delivery. FIFO queues guarantee ordering and exactly-once processing per message group, with a lower throughput ceiling.
시험은 무엇을 보는가 / What the exam is testing
SQS sits at the centre of decoupling questions. "A failure in one component stops everything", "spikes overwhelm the backend", and "work must not be lost" all answer with inserting a queue. The second angle is scaling an ASG on queue depth; the third is Standard versus FIFO.
시험 포인트 / Exam points
Standard offers near-unlimited throughput without ordering and may deliver duplicates. FIFO guarantees order and exactly-once processing. "Must be processed in order" → FIFO.
A consumed message is hidden from others for this period. If it is shorter than processing time, the message is processed twice — set it generously.
Messages that fail a set number of times move to a separate queue for analysis — the answer to "isolate failed messages".
Scaling workers on queue depth as a CloudWatch metric produces scaling that tracks load precisely.
자주 틀리는 함정 / Common traps
Setting the visibility timeout shorter than processing time — the same message gets processed twice.
Choosing a Standard queue for order processing where sequence matters — FIFO is the answer.
Retrying forever with no isolation for failures — a poison message blocks the queue. A dead-letter queue is needed.
헷갈리는 것 구분하기 / Telling them apart
One message handled by one consumer → SQS (queue). Every subscriber receiving it → SNS (broadcast). Layering them — several SQS queues subscribed to one SNS topic — is the signature exam answer.
AWS SAA Hub Pro는 독립 학습 자료이며 Amazon Web Services, Inc.의 공식 서비스가 아닙니다. 시험 정책과 서비스 사양은 AWS 공식 문서를 기준으로 확인하세요.