Concept Flow - Stream vs polling comparison
Start
New Data in DB?
+--Yes--+
Stream
Event
Process
End
This flow shows how data changes trigger processing either instantly via streams or repeatedly via polling.
1. Stream: Wait for DB event -> Process event 2. Polling: Repeat every 5s -> Check DB -> Process new data
| Step | Method | Action | Data Detected | Process Triggered | Next Step |
|---|---|---|---|---|---|
| 1 | Stream | Wait for DB event | No | No | Wait |
| 2 | Stream | Wait for DB event | Yes (New item added) | Yes | Process event |
| 3 | Stream | Process event | N/A | N/A | Wait for next event |
| 4 | Polling | Check DB | No new data | No | Wait 5 seconds |
| 5 | Polling | Wait 5 seconds | N/A | N/A | Check DB again |
| 6 | Polling | Check DB | New item found | Yes | Process new data |
| 7 | Polling | Process new data | N/A | N/A | Wait 5 seconds |
| Variable | Start | After Step 2 | After Step 4 | After Step 6 | Final |
|---|---|---|---|---|---|
| Data Detected | No | Yes | No | Yes | N/A |
| Process Triggered | No | Yes | No | Yes | N/A |
| Wait State | Waiting | Processing | Waiting | Processing | Waiting |
Stream vs Polling in DynamoDB: - Stream: Event-driven, triggers instantly on data change - Polling: Time-driven, checks DB at intervals - Stream is efficient, low latency - Polling can cause delays and higher resource use - Choose based on app needs and cost considerations