chore(brain): ASTRA 성장 자산 동기화 — 기능 인벤토리·growth(약점프로필/학습큐)·일화기억·장기기억·회의록 원문
This commit is contained in:
@@ -0,0 +1,192 @@
|
||||
---
|
||||
id: wiki-2026-0508-edge-computing
|
||||
title: Edge Computing
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Edge AI, Fog Computing, Edge Inference, MEC]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.92
|
||||
verification_status: applied
|
||||
tags: [edge, iot, distributed-systems, latency, on-device]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: Rust/C++/Python
|
||||
framework: K3s / Cloudflare Workers / ONNX Runtime / WasmEdge
|
||||
---
|
||||
|
||||
# Edge Computing
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 edge computing 의 핵심: compute moves to data — latency + bandwidth + privacy"**. 매 2010s CDN edge → 매 2020s function-edge (Cloudflare Workers, Deno Deploy, AWS Lambda@Edge), 매 2022 edge AI inference, 매 2024 5G MEC. 매 2026 현재 phone (Apple Intelligence, Pixel Gemini Nano) → CDN edge (Workers AI) → micro-DC 의 3-tier edge stack 의 일반화.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 edge spectrum
|
||||
- **Device edge**: 매 phone, sensor, MCU, robot.
|
||||
- **Near edge / On-prem**: 매 factory floor, retail store K8s.
|
||||
- **Far edge / CDN**: 매 Cloudflare, Fastly, Akamai PoPs.
|
||||
- **MEC (Mobile Edge Computing)**: 매 5G base station co-located.
|
||||
|
||||
### 매 drivers
|
||||
- **Latency**: 매 <10ms — 매 cloud round-trip 의 불가능.
|
||||
- **Bandwidth**: 매 video / sensor stream의 cloud 전송 cost.
|
||||
- **Privacy / sovereignty**: 매 data 의 region / device 외 미반출.
|
||||
- **Resilience**: 매 offline operation.
|
||||
- **Cost**: 매 egress fee 회피.
|
||||
|
||||
### 매 응용
|
||||
1. Real-time vision (autonomous driving, AR).
|
||||
2. Voice assistants (Siri on-device wake-word).
|
||||
3. Industrial control (PLC + edge AI).
|
||||
4. Game streaming, low-latency RTC.
|
||||
5. Edge AI inference (Llama 3.2 on phone, Whisper on Pi).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Cloudflare Workers (function edge)
|
||||
```ts
|
||||
export default {
|
||||
async fetch(req: Request, env: Env): Promise<Response> {
|
||||
const cache = caches.default;
|
||||
const cached = await cache.match(req);
|
||||
if (cached) return cached;
|
||||
const data = await env.DB.prepare("SELECT * FROM posts LIMIT 10").all();
|
||||
const res = new Response(JSON.stringify(data),
|
||||
{ headers: { "cache-control": "max-age=60" } });
|
||||
await cache.put(req, res.clone());
|
||||
return res;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### Workers AI (edge LLM inference)
|
||||
```ts
|
||||
export default {
|
||||
async fetch(req, env) {
|
||||
const { prompt } = await req.json();
|
||||
const out = await env.AI.run("@cf/meta/llama-3.2-3b-instruct",
|
||||
{ prompt, max_tokens: 200 });
|
||||
return Response.json(out);
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### K3s (lightweight K8s for edge)
|
||||
```bash
|
||||
# Install on edge node
|
||||
curl -sfL https://get.k3s.io | sh -s - --disable traefik --node-name edge-01
|
||||
# Deploy edge inference service
|
||||
kubectl apply -f - <<EOF
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata: { name: edge-yolo }
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
spec:
|
||||
nodeSelector: { tier: edge }
|
||||
containers:
|
||||
- name: yolo
|
||||
image: ghcr.io/me/yolo11n:latest
|
||||
resources: { limits: { cpu: "2", memory: 2Gi } }
|
||||
EOF
|
||||
```
|
||||
|
||||
### ONNX Runtime on edge (Raspberry Pi 5)
|
||||
```python
|
||||
import onnxruntime as ort
|
||||
import numpy as np
|
||||
sess = ort.InferenceSession("yolov11n.onnx",
|
||||
providers=["CPUExecutionProvider"])
|
||||
out = sess.run(None, {"images": img.astype(np.float32)})
|
||||
```
|
||||
|
||||
### WasmEdge (portable edge runtime)
|
||||
```rust
|
||||
// Compile Rust → wasm32-wasi
|
||||
fn main() {
|
||||
let img = std::fs::read("input.jpg").unwrap();
|
||||
let result = run_inference(&img);
|
||||
println!("{:?}", result);
|
||||
}
|
||||
// Run: wasmedge app.wasm
|
||||
```
|
||||
|
||||
### MQTT-bridged hierarchical edge
|
||||
```python
|
||||
# Edge gateway aggregates sensors, forwards summaries to cloud
|
||||
import paho.mqtt.client as mqtt
|
||||
|
||||
def on_local(client, _, msg):
|
||||
summary = aggregate(msg.payload)
|
||||
cloud.publish("plant/summary", summary)
|
||||
|
||||
local = mqtt.Client(); local.connect("localhost"); local.on_message = on_local
|
||||
local.subscribe("sensors/#"); local.loop_start()
|
||||
|
||||
cloud = mqtt.Client(); cloud.connect("cloud.broker.com")
|
||||
```
|
||||
|
||||
### CRDT-based offline-first sync
|
||||
```ts
|
||||
import * as Y from "yjs";
|
||||
import { WebsocketProvider } from "y-websocket";
|
||||
const doc = new Y.Doc();
|
||||
// Works offline, merges automatically when reconnected
|
||||
new WebsocketProvider("wss://sync.edge.local", "doc1", doc);
|
||||
```
|
||||
|
||||
### Edge LLM with quantization (mobile)
|
||||
```python
|
||||
# Convert Llama 3.2 3B to 4-bit GGUF for mobile
|
||||
# llama.cpp or MLX
|
||||
from mlx_lm import convert
|
||||
convert("meta-llama/Llama-3.2-3B-Instruct",
|
||||
mlx_path="llama-3b-q4", quantize=True, q_bits=4)
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Static asset / API cache | CDN (Cloudflare, Fastly) |
|
||||
| Low-latency API | Workers / Deno Deploy |
|
||||
| Stateful edge service | K3s on near-edge |
|
||||
| Sensor / IoT | MQTT + edge gateway |
|
||||
| Edge AI inference | ONNX Runtime / TFLite / Core ML |
|
||||
| Cross-platform portable | Wasm (WasmEdge, Spin) |
|
||||
| Personal AI | On-device LLM (MLX, llama.cpp) |
|
||||
|
||||
**기본값**: 매 latency-sensitive read 은 CDN edge, 매 sensor data 의 edge gateway 에서 aggregate.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Distributed Systems]]
|
||||
- 변형: [[CDN]] · [[Serverless]] · [[MEC]]
|
||||
- 응용: [[클라우드_인프라_및_IaC_운영_표준|IoT]] · [[Edge AI]] · [[On-device AI]]
|
||||
- Adjacent: [[Cloud Native]] · [[Data Privacy & Local Processing]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 edge deployment scaffolding (K3s manifests, Workers code), 매 quantization workflow, 매 latency-budget reasoning.
|
||||
**언제 X**: 매 hard-real-time (<1ms) — 매 LLM 의지 X. 매 deterministic timing 의 RTOS 사용.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Edge as cloud-with-extra-steps**: 매 unnecessary 사용 — 매 latency / privacy 명확한 driver 없으면 cloud.
|
||||
- **No degradation strategy**: 매 edge offline → 전체 fail.
|
||||
- **State at every edge**: 매 consistency nightmare — 매 CRDT / eventual 의 사용.
|
||||
- **Same model size as cloud**: 매 device OOM — 매 quantize + distill.
|
||||
- **Ignoring network partitions**: 매 split-brain → corrupted state.
|
||||
- **Pushing all logic to client**: 매 trust boundary violation.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Cloudflare Workers docs 2025, K3s docs, ETSI MEC spec, ONNX Runtime mobile docs, Llama 3.2 release notes 2024).
|
||||
- 신뢰도 A.
|
||||
- 관련: [[Cloud Native]], [[Data Privacy & Local Processing]].
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — edge spectrum + 2026 tooling (Workers AI, MLX, K3s) |
|
||||
Reference in New Issue
Block a user