9148c358d0
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
6.0 KiB
6.0 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-real-time-data-streaming | Real-time Data Streaming | 10_Wiki/Topics | verified | self |
|
none | A | 0.95 | applied |
|
2026-05-10 | pending |
|
Real-time Data Streaming
매 한 줄
"매 batch ETL 의 X — 매 unbounded events 매 milliseconds latency 매 process". Kafka (LinkedIn 2010) → Flink / Spark Structured Streaming / Pulsar / Materialize / RisingWave 매 modern stack. 매 2026 매 sub-second analytics 매 default.
매 핵심
매 layers
- Ingest: Kafka, Pulsar, Kinesis, Redpanda — 매 durable log.
- Process: Flink, Spark Streaming, Kafka Streams, Bytewax, Arroyo.
- Serve: Materialize, RisingWave, Pinot, Druid, ClickHouse.
매 windowing
- Tumbling: fixed, non-overlapping (1-min buckets).
- Sliding: overlapping (5-min, slide 1-min).
- Session: gap-based (user activity until 30s inactivity).
- Hopping: same as sliding (different name).
매 time semantics
- Event time: 매 actual occurrence — 매 correctness 위해 default.
- Processing time: 매 broker arrival — 매 latency 측정.
- Ingestion time: 매 broker append.
- Watermarks: 매 lateness threshold — Flink/Beam 핵심.
매 응용
- Fraud detection — 매 payment stream + ML inference.
- Real-time dashboards — Materialize + Grafana.
- CDC pipelines — Debezium → Kafka → warehouse.
- IoT telemetry — MQTT → Kafka → anomaly detection.
- Personalization — clickstream → feature store → model.
💻 패턴
Kafka Streams (Python via Faust / Bytewax)
import bytewax.operators as op
from bytewax.dataflow import Dataflow
from bytewax.connectors.kafka import KafkaSource, KafkaSink
flow = Dataflow("fraud")
src = op.input("in", flow, KafkaSource(["localhost:9092"], ["payments"]))
parsed = op.map("parse", src, lambda kv: json.loads(kv.value))
flagged = op.filter("flag", parsed, lambda p: p["amount"] > 10000)
op.output("out", flagged, KafkaSink(["localhost:9092"], "alerts"))
Flink SQL (windowed aggregation)
CREATE TABLE clicks (
user_id STRING, ts TIMESTAMP(3),
WATERMARK FOR ts AS ts - INTERVAL '5' SECOND
) WITH ('connector' = 'kafka', ...);
SELECT
user_id,
TUMBLE_START(ts, INTERVAL '1' MINUTE) AS w_start,
COUNT(*) AS clicks
FROM clicks
GROUP BY user_id, TUMBLE(ts, INTERVAL '1' MINUTE);
Materialize (streaming SQL view)
CREATE SOURCE orders FROM KAFKA BROKER 'kafka:9092' TOPIC 'orders'
FORMAT AVRO USING SCHEMA REGISTRY 'http://sr:8081';
CREATE MATERIALIZED VIEW revenue_5min AS
SELECT
date_trunc('minute', ts) AS minute,
SUM(amount) AS revenue
FROM orders
WHERE ts > now() - INTERVAL '5 minutes'
GROUP BY 1;
-- Subscribe to changes
SUBSCRIBE TO revenue_5min;
Spark Structured Streaming
df = (spark.readStream.format("kafka")
.option("subscribe", "events")
.load())
agg = (df.selectExpr("CAST(value AS STRING) as json")
.select(from_json("json", schema).alias("e"))
.withWatermark("e.ts", "10 minutes")
.groupBy(window("e.ts", "1 minute"), "e.user")
.count())
agg.writeStream.format("delta").outputMode("append").start("/lake/agg")
Pulsar Functions (lightweight processing)
from pulsar import Function
class EnrichOrder(Function):
def process(self, msg, ctx):
order = json.loads(msg)
order["region"] = lookup_region(order["zip"])
ctx.publish("orders.enriched", json.dumps(order))
Exactly-once with Kafka transactions
producer = KafkaProducer(transactional_id="tx-1", enable_idempotence=True)
producer.init_transactions()
try:
producer.begin_transaction()
producer.send("out", value=processed)
producer.send_offsets_to_transaction(offsets, group_id)
producer.commit_transaction()
except:
producer.abort_transaction()
CDC with Debezium
# connector config
connector.class: io.debezium.connector.postgresql.PostgresConnector
database.hostname: pg
table.include.list: public.orders
plugin.name: pgoutput
# emits CDC events to Kafka topic "pg.public.orders"
매 결정 기준
| 상황 | Stack |
|---|---|
| 매 simple transform | Kafka Streams / Bytewax |
| 매 complex windowing, joins | Flink |
| 매 SQL-first analytics | Materialize / RisingWave |
| 매 batch+stream unified | Spark Structured / Beam |
| 매 lightweight, serverless | Pulsar Functions / AWS Lambda |
| 매 OLAP serving | Pinot / Druid / ClickHouse |
기본값: 매 2026 매 SQL-on-streams (Materialize/RisingWave) 매 default — DX 압도적.
🔗 Graph
- 부모: Data Engineering · Event-Driven Architecture
- 변형: Stream-Processing-Architectures · CEP
- 응용: CDC
- Adjacent: Kafka · Materialize
🤖 LLM 활용
언제: 매 SQL DDL/query generation, 매 schema evolution analysis, 매 anomaly investigation summarization. 언제 X: 매 latency-critical hot path — LLM inference 매 too slow. 매 trained ML model 사용.
❌ 안티패턴
- Processing time everywhere: 매 out-of-order events 매 wrong results — event time + watermarks 사용.
- Unbounded state: 매 keyed state 매 grows forever — TTL / windows 필수.
- Tiny files: 매 1 record / file → S3 explosion. 매 batching + compaction.
- Sync external calls in pipeline: 매 backpressure 폭발. 매 async + bulkhead.
- No replay strategy: 매 bad code → poisoned downstream. 매 reset offset + idempotent sinks.
🧪 검증 / 중복
- Verified (Akidau — "Streaming 101/102"; Kafka docs; Flink docs 1.18+).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — full streaming entry with Materialize/RisingWave |