Loading...
Loading...
Compare original and translation side by side
undefinedundefined
---
---undefinedundefined
---
---undefinedundefined| Metric | Value |
|---|---|
| P50 latency | 480ms |
| P95 latency | 1,240ms |
| P99 latency | 3,100ms |
| RPS @ 50 VUs | 42 |
| Error rate | 0.8% |
| DB queries/req | 23 (N+1) |
| 指标 | 数值 |
|---|---|
| P50延迟 | 480ms |
| P95延迟 | 1,240ms |
| P99延迟 | 3,100ms |
| 50虚拟用户下的RPS | 42 |
| 错误率 | 0.8% |
| 每个请求的数据库查询数 | 23(N+1) |
| Metric | Before | After | Delta |
|---|---|---|---|
| P50 latency | 480ms | 48ms | -90% |
| P95 latency | 1,240ms | 120ms | -90% |
| P99 latency | 3,100ms | 280ms | -91% |
| RPS @ 50 VUs | 42 | 380 | +804% |
| Error rate | 0.8% | 0% | -100% |
| DB queries/req | 23 | 1 | -96% |
| 指标 | 优化前 | 优化后 | 变化量 |
|---|---|---|---|
| P50延迟 | 480ms | 48ms | -90% |
| P95延迟 | 1,240ms | 120ms | -90% |
| P99延迟 | 3,100ms | 280ms | -91% |
| 50虚拟用户下的RPS | 42 | 380 | +804% |
| 错误率 | 0.8% | 0% | -100% |
| 每个请求的数据库查询数 | 23 | 1 | -96% |
---
---Database
□ Missing indexes on WHERE/ORDER BY columns
□ N+1 queries (check query count per request)
□ Loading all columns when only 2-3 needed (SELECT *)
□ No LIMIT on unbounded queries
□ Missing connection pool (creating new connection per request)
Node.js
□ Sync I/O (fs.readFileSync) in hot path
□ JSON.parse/stringify of large objects in hot loop
□ Missing caching for expensive computations
□ No compression (gzip/brotli) on responses
□ Dependencies loaded in request handler (move to module level)
Bundle
□ Moment.js → dayjs/date-fns
□ Lodash (full) → lodash/function imports
□ Static imports of heavy components → dynamic imports
□ Images not optimized / not using next/image
□ No code splitting on routes
API
□ No pagination on list endpoints
□ No response caching (Cache-Control headers)
□ Serial awaits that could be parallel (Promise.all)
□ Fetching related data in a loop instead of JOIN数据库
□ WHERE/ORDER BY列缺少索引
□ N+1查询(检查每个请求的查询次数)
□ 查询所有列而只需要2-3列(SELECT *)
□ 无限制的未分页查询
□ 缺少连接池(每个请求创建新连接)
Node.js
□ 热点路径中使用同步I/O(fs.readFileSync)
□ 热点循环中对大对象进行JSON.parse/stringify
□ 昂贵计算缺少缓存
□ 响应未启用压缩(gzip/brotli)
□ 在请求处理程序中加载依赖(移到模块级别)
包体积
□ Moment.js → dayjs/date-fns
□ 完整Lodash → lodash/函数按需导入
□ 重组件的静态导入 → 动态导入
□ 图片未优化 / 未使用next/image
□ 路由未做代码分割
API
□ 列表接口未分页
□ 响应未设置缓存(Cache-Control头)
□ 可并行的串行await(应使用Promise.all)
□ 循环中获取关联数据而非使用JOINp(95) < 200msp(95) < 200ms