202 lines
6.1 KiB
Markdown
202 lines
6.1 KiB
Markdown
---
|
|
id: wiki-2026-0508-초기-로드-시간-initial-load-time
|
|
title: 초기 로드 시간 (Initial Load Time)
|
|
category: 10_Wiki/Topics
|
|
status: verified
|
|
canonical_id: self
|
|
aliases: [Initial Load Time, TTI, FCP, LCP]
|
|
duplicate_of: none
|
|
source_trust_level: A
|
|
confidence_score: 0.9
|
|
verification_status: applied
|
|
tags: [performance, web-vitals, optimization, frontend]
|
|
raw_sources: []
|
|
last_reinforced: 2026-05-10
|
|
github_commit: pending
|
|
tech_stack:
|
|
language: TypeScript
|
|
framework: Next.js / React
|
|
---
|
|
|
|
# 초기 로드 시간 (Initial Load Time)
|
|
|
|
## 매 한 줄
|
|
> **"매 첫 paint 의 1.8s, 매 TTI 의 3.5s 미만 — 매 user 의 stay 의 결정."**. 매 Core Web Vitals (LCP, FID/INP, CLS) 의 Google ranking signal 화 (2021) 이후, 매 initial load 의 SEO + UX dual concern. 매 2026 의 modern stack — RSC streaming, edge SSR, Vite 5, Bun bundler — 의 sub-second TTI 의 가능.
|
|
|
|
## 매 핵심
|
|
|
|
### 매 측정 지표
|
|
- **FCP (First Contentful Paint)**: 매 첫 DOM content 의 paint — target < 1.8s.
|
|
- **LCP (Largest Contentful Paint)**: 매 largest above-fold element 의 render — target < 2.5s.
|
|
- **TTI (Time to Interactive)**: 매 main thread 의 idle + listener 의 attach — target < 3.5s.
|
|
- **TBT (Total Blocking Time)**: 매 long task (>50ms) 의 합 — target < 200ms.
|
|
- **INP (Interaction to Next Paint)**: 매 FID 의 successor (2024 Web Vitals) — target < 200ms.
|
|
|
|
### 매 bottleneck 의 source
|
|
- 매 JavaScript bundle 의 크기 (>200KB gzipped 의 red flag).
|
|
- 매 render-blocking CSS / synchronous script.
|
|
- 매 unoptimized image (WebP / AVIF 의 미사용).
|
|
- 매 N+1 API call (waterfall fetch).
|
|
- 매 third-party script (analytics, ads) 의 main thread 점유.
|
|
|
|
### 매 응용
|
|
1. **E-commerce**: 매 100ms 의 latency 의 1% conversion drop (Amazon study).
|
|
2. **Media site**: 매 LCP 의 SEO ranking 의 직접 영향.
|
|
3. **SaaS dashboard**: 매 TTI 의 user retention 의 결정.
|
|
|
|
## 💻 패턴
|
|
|
|
### Code splitting (Next.js)
|
|
```tsx
|
|
// app/dashboard/page.tsx
|
|
import dynamic from 'next/dynamic';
|
|
|
|
const HeavyChart = dynamic(() => import('@/components/HeavyChart'), {
|
|
loading: () => <Skeleton />,
|
|
ssr: false, // client-only 의 heavy component
|
|
});
|
|
|
|
export default function Dashboard() {
|
|
return (
|
|
<div>
|
|
<Header />
|
|
<HeavyChart />
|
|
</div>
|
|
);
|
|
}
|
|
```
|
|
|
|
### React Server Components streaming
|
|
```tsx
|
|
// app/page.tsx — RSC 의 streaming
|
|
import { Suspense } from 'react';
|
|
|
|
export default function Page() {
|
|
return (
|
|
<>
|
|
<Header /> {/* immediate */}
|
|
<Suspense fallback={<Skeleton />}>
|
|
<SlowDataFetch /> {/* streamed when ready */}
|
|
</Suspense>
|
|
</>
|
|
);
|
|
}
|
|
|
|
async function SlowDataFetch() {
|
|
const data = await fetch('https://api/slow', { cache: 'force-cache' });
|
|
return <Chart data={await data.json()} />;
|
|
}
|
|
```
|
|
|
|
### Image optimization
|
|
```tsx
|
|
import Image from 'next/image';
|
|
|
|
<Image
|
|
src="/hero.jpg"
|
|
width={1200}
|
|
height={630}
|
|
priority // LCP candidate
|
|
placeholder="blur"
|
|
blurDataURL={blurUrl}
|
|
sizes="(max-width: 768px) 100vw, 1200px"
|
|
/>
|
|
```
|
|
|
|
### Resource hints
|
|
```html
|
|
<head>
|
|
<link rel="preconnect" href="https://api.example.com" />
|
|
<link rel="dns-prefetch" href="https://cdn.example.com" />
|
|
<link rel="preload" as="font" href="/fonts/inter.woff2" crossorigin />
|
|
<link rel="modulepreload" href="/_next/static/chunks/main.js" />
|
|
</head>
|
|
```
|
|
|
|
### Font loading
|
|
```css
|
|
/* CSS — FOUT 방지 */
|
|
@font-face {
|
|
font-family: 'Inter';
|
|
src: url('/fonts/inter.woff2') format('woff2');
|
|
font-display: swap; /* 매 fallback 의 즉시 show */
|
|
}
|
|
```
|
|
|
|
### Bundle 분석 (Vite)
|
|
```bash
|
|
# vite-bundle-visualizer
|
|
npx vite-bundle-visualizer
|
|
|
|
# Next.js
|
|
ANALYZE=true next build
|
|
```
|
|
|
|
### Critical CSS inline
|
|
```js
|
|
// Next.js — 매 default 로 critical CSS 의 extract
|
|
// Vite — vite-plugin-critical 의 use
|
|
import { defineConfig } from 'vite';
|
|
import critical from 'rollup-plugin-critical';
|
|
|
|
export default defineConfig({
|
|
plugins: [critical({ criticalBase: 'dist/', criticalPages: [{ uri: '', template: 'index' }] })],
|
|
});
|
|
```
|
|
|
|
### Service Worker caching
|
|
```js
|
|
// public/sw.js
|
|
self.addEventListener('fetch', (event) => {
|
|
if (event.request.destination === 'image') {
|
|
event.respondWith(
|
|
caches.open('images').then((cache) =>
|
|
cache.match(event.request).then((cached) => cached || fetch(event.request).then((res) => {
|
|
cache.put(event.request, res.clone());
|
|
return res;
|
|
}))
|
|
)
|
|
);
|
|
}
|
|
});
|
|
```
|
|
|
|
## 매 결정 기준
|
|
| 상황 | Approach |
|
|
|---|---|
|
|
| 매 SEO-critical page | SSR / SSG (Next.js, Astro) |
|
|
| 매 dashboard (auth-gated) | CSR + skeleton |
|
|
| 매 content site | Astro islands / 11ty static |
|
|
| 매 large bundle (>500KB) | code splitting + lazy load |
|
|
| 매 LCP > 2.5s | image optimization + preload |
|
|
| 매 TBT > 300ms | main thread offload (Web Worker) |
|
|
|
|
**기본값**: Next.js 15 RSC + edge runtime + Image component + dynamic import 의 heavy module.
|
|
|
|
## 🔗 Graph
|
|
- 부모: [[Performance Optimization]] · [[Core Web Vitals]]
|
|
- 변형: [[Server-Side Rendering]] · [[Static Site Generation]]
|
|
- 응용: [[E-commerce Performance]] · [[Media Site Optimization]]
|
|
- Adjacent: [[Bundle Optimization]] · [[Image Optimization]] · [[CDN Caching]]
|
|
|
|
## 🤖 LLM 활용
|
|
**언제**: 매 performance audit 의 explanation, 매 bundle analysis result 의 interpretation, 매 optimization strategy 의 brainstorm.
|
|
**언제 X**: 매 production performance regression 의 진단 — 매 real RUM data + Lighthouse CI 의 use.
|
|
|
|
## ❌ 안티패턴
|
|
- **Render-blocking sync script**: 매 `<script src>` 의 head 위치 + async/defer 의 누락.
|
|
- **Unsized image**: 매 width/height 의 missing — 매 CLS 의 발생.
|
|
- **Hydration mismatch**: 매 SSR HTML 과 client render 의 차이 — 매 re-render 의 cost.
|
|
- **Bundle bloat**: 매 lodash 의 entire import (`import _ from 'lodash'`) 의 사용.
|
|
- **Premature optimization**: 매 측정 의 없이 의 tweak — 매 RUM data 의 우선.
|
|
|
|
## 🧪 검증 / 중복
|
|
- Verified (web.dev/vitals, Next.js docs, Chrome UX Report).
|
|
- 신뢰도 A.
|
|
|
|
## 🕓 Changelog
|
|
| 날짜 | 변경 |
|
|
|---|---|
|
|
| 2026-05-08 | Phase 1 |
|
|
| 2026-05-10 | Manual cleanup — initial load 의 metrics + Next.js 15 RSC patterns |
|