@umacloud/knowledge 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/00-governance/governance-capabilities.md +557 -0
- package/00-governance/knowledge-map.md +39 -0
- package/00-governance/maintenance-policy.md +76 -0
- package/00-governance/review-checklist.md +81 -0
- package/README.md +13 -0
- package/ai/01-standards/agent-development-complete.md +691 -0
- package/ai/01-standards/llm-application-complete.md +488 -0
- package/ai/01-standards/mlops-complete.md +798 -0
- package/ai/01-standards/prompt-engineering-complete.md +646 -0
- package/ai/01-standards/rag-architecture-complete.md +649 -0
- package/ai/02-playbooks/llm-evaluation-playbook.md +847 -0
- package/ai/03-checklists/ai-project-checklist.md +215 -0
- package/ai/04-antipatterns/ai-antipatterns.md +661 -0
- package/ai/05-cases/case-rag-production.md +147 -0
- package/ai/06-glossary/ai-glossary.md +162 -0
- package/ai/agent-evaluation-benchmark.md +53 -0
- package/ai/ai-agent-memory-context-management.md +41 -0
- package/ai/ai-cost-capacity-optimization-playbook.md +42 -0
- package/ai/ai-data-security-and-compliance-playbook.md +37 -0
- package/ai/ai-domain-index-and-checklist.md +40 -0
- package/ai/ai-governance-maturity-model.md +50 -0
- package/ai/ai-model-selection-and-routing-strategy.md +47 -0
- package/ai/ai-observability-and-oncall-runbook.md +52 -0
- package/ai/ai-rag-engineering-playbook.md +42 -0
- package/ai/ai-red-team-and-safety-evaluation.md +42 -0
- package/ai/ai-release-readiness-and-rollback-gate.md +42 -0
- package/ai/llm-agent-engineering-deep-dive.md +57 -0
- package/ai/prompt-and-tool-guardrails.md +52 -0
- package/api/01-standards/enterprise-api-standards.md +198 -0
- package/api/01-standards/rest-api-design-guide.md +63 -0
- package/api/02-playbooks/api-pagination-playbook.md +93 -0
- package/api/02-playbooks/graphql-production-playbook.md +176 -0
- package/api/03-checklists/api-review-checklist.md +55 -0
- package/api/04-antipatterns/api-antipatterns.md +112 -0
- package/architecture/01-standards/api-gateway-patterns.md +496 -0
- package/architecture/01-standards/cloud-native-patterns.md +644 -0
- package/architecture/01-standards/distributed-systems-patterns.md +591 -0
- package/architecture/01-standards/event-driven-architecture.md +595 -0
- package/architecture/01-standards/microservices-patterns-complete.md +968 -0
- package/architecture/01-standards/microservices-patterns.md +495 -0
- package/architecture/01-standards/system-design-interview.md +664 -0
- package/architecture/02-playbooks/microservices-patterns-playbook.md +137 -0
- package/architecture/02-playbooks/migration-playbook.md +780 -0
- package/architecture/02-playbooks/system-design-playbook.md +779 -0
- package/architecture/03-checklists/architecture-decision-checklist.md +297 -0
- package/architecture/04-antipatterns/architecture-antipatterns.md +417 -0
- package/architecture/05-cases/case-netflix-microservices.md +413 -0
- package/architecture/06-glossary/architecture-glossary.md +164 -0
- package/architecture/adr-template-and-examples.md +38 -0
- package/architecture/api-gateway-deep-dive.md +1291 -0
- package/architecture/configuration-management.md +1162 -0
- package/architecture/distributed-transactions.md +1220 -0
- package/architecture/microservices-complete.md +735 -0
- package/architecture/resilience-and-disaster-patterns.md +37 -0
- package/architecture/service-governance.md +1198 -0
- package/architecture/system-architecture-deep-dive.md +37 -0
- package/backend/01-standards/analytics-and-growth.md +65 -0
- package/backend/01-standards/api-and-error-conventions.md +120 -0
- package/backend/01-standards/application-layering-and-packaging.md +160 -0
- package/backend/01-standards/auth-implementation.md +104 -0
- package/backend/01-standards/backend-framework-idioms.md +74 -0
- package/backend/01-standards/background-jobs-and-async.md +66 -0
- package/backend/01-standards/caching-strategies-complete.md +390 -0
- package/backend/01-standards/config-and-observability.md +77 -0
- package/backend/01-standards/data-modeling-and-persistence.md +94 -0
- package/backend/01-standards/django-complete.md +1765 -0
- package/backend/01-standards/email-and-notifications.md +64 -0
- package/backend/01-standards/fastapi-complete.md +925 -0
- package/backend/01-standards/file-upload-and-storage.md +66 -0
- package/backend/01-standards/graphql-api-complete.md +416 -0
- package/backend/01-standards/llm-application-standard.md +78 -0
- package/backend/01-standards/message-queue-patterns.md +379 -0
- package/backend/01-standards/microservices-and-distributed.md +78 -0
- package/backend/01-standards/nestjs-complete.md +2167 -0
- package/backend/01-standards/payment-integration.md +80 -0
- package/backend/01-standards/rate-limiting-complete.md +451 -0
- package/backend/01-standards/realtime-and-websocket.md +65 -0
- package/backend/01-standards/search-and-filtering.md +64 -0
- package/backend/01-standards/spring-boot-complete.md +445 -0
- package/backend/02-playbooks/api-design-playbook.md +718 -0
- package/backend/02-playbooks/email-send-playbook.md +130 -0
- package/backend/02-playbooks/file-upload-s3-playbook.md +153 -0
- package/backend/02-playbooks/typescript-enterprise-playbook.md +133 -0
- package/backend/02-playbooks/websocket-realtime-playbook.md +154 -0
- package/backend/03-checklists/api-launch-checklist.md +189 -0
- package/backend/04-antipatterns/backend-antipatterns.md +1051 -0
- package/blockchain/01-standards/blockchain-basics.md +557 -0
- package/blockchain/01-standards/smart-contract-development.md +1315 -0
- package/cicd/01-standards/deployment-and-delivery-standard.md +96 -0
- package/cicd/01-standards/github-actions-complete.md +473 -0
- package/cicd/01-standards/release-and-store-submission.md +75 -0
- package/cicd/02-playbooks/cicd-pipeline-playbook.md +144 -0
- package/cicd/02-playbooks/release-management-playbook.md +605 -0
- package/cicd/03-checklists/pipeline-security-checklist.md +168 -0
- package/cicd/04-antipatterns/cicd-antipatterns.md +589 -0
- package/cicd/05-cases/case-deployment-automation.md +221 -0
- package/cicd/05-cases/case-gitops-transformation.md +212 -0
- package/cicd/06-glossary/cicd-glossary.md +114 -0
- package/cicd/cicd-blueprint-deep-dive.md +38 -0
- package/cicd/release-readiness-gate.md +37 -0
- package/cloud-native/01-standards/container-security.md +741 -0
- package/cloud-native/01-standards/kubernetes-complete.md +812 -0
- package/cloud-native/02-playbooks/api-gateway-playbook.md +155 -0
- package/cloud-native/02-playbooks/gitops-with-argocd.md +760 -0
- package/cloud-native/02-playbooks/k8s-troubleshooting-playbook.md +1942 -0
- package/cloud-native/02-playbooks/message-queue-playbook.md +129 -0
- package/cloud-native/02-playbooks/multicloud-governance.md +726 -0
- package/cloud-native/02-playbooks/serverless-patterns.md +788 -0
- package/cloud-native/02-playbooks/service-mesh-playbook.md +612 -0
- package/cloud-native/02-playbooks/terraform-iac-playbook.md +143 -0
- package/cloud-native/03-checklists/container-security-checklist.md +431 -0
- package/cloud-native/03-checklists/k8s-production-readiness-checklist.md +460 -0
- package/cloud-native/04-antipatterns/container-antipatterns.md +660 -0
- package/cloud-native/04-antipatterns/k8s-antipatterns.md +743 -0
- package/cloud-native/05-cases/case-k8s-migration.md +478 -0
- package/cloud-native/05-cases/case-k8s-scaling.md +642 -0
- package/cloud-native/05-cases/case-k8s-security-incident.md +397 -0
- package/cloud-native/06-glossary/cloud-native-glossary.md +337 -0
- package/cross-platform/01-standards/cross-platform-frameworks.md +83 -0
- package/cross-platform/01-standards/platform-selection-and-architecture.md +77 -0
- package/data/01-standards/elasticsearch-complete.md +2098 -0
- package/data/01-standards/postgresql-complete.md +1613 -0
- package/data/01-standards/redis-complete.md +1527 -0
- package/data/02-playbooks/database-optimization-playbook.md +403 -0
- package/data/02-playbooks/elasticsearch-production-playbook.md +132 -0
- package/data/03-checklists/database-launch-checklist.md +187 -0
- package/data/04-antipatterns/database-antipatterns.md +873 -0
- package/data/05-cases/case-database-migration.md +310 -0
- package/data/06-glossary/database-glossary.md +440 -0
- package/data/data-governance-and-modeling-deep-dive.md +39 -0
- package/data-engineering/01-standards/airflow-complete.md +523 -0
- package/data-engineering/01-standards/kafka-complete.md +1521 -0
- package/data-engineering/02-playbooks/spark-etl-playbook.md +496 -0
- package/data-engineering/03-checklists/pipeline-launch-checklist.md +194 -0
- package/data-engineering/04-antipatterns/data-pipeline-antipatterns.md +684 -0
- package/data-engineering/05-cases/case-real-time-pipeline.md +355 -0
- package/data-engineering/06-glossary/data-engineering-glossary.md +429 -0
- package/database/01-standards/database-schema-standards.md +147 -0
- package/database/02-playbooks/postgresql-optimization-quick.md +52 -0
- package/database/02-playbooks/postgresql-performance-optimization.md +58 -0
- package/database/02-playbooks/postgresql-production-playbook.md +146 -0
- package/database/02-playbooks/redis-caching-playbook.md +117 -0
- package/database/03-checklists/database-review-checklist.md +50 -0
- package/database/04-antipatterns/database-antipatterns.md +112 -0
- package/design/01-standards/ui-design-system-complete.md +423 -0
- package/design/02-playbooks/design-handoff-playbook.md +254 -0
- package/design/02-playbooks/design-review-playbook.md +388 -0
- package/design/03-checklists/design-review-checklist.md +246 -0
- package/design/04-antipatterns/design-antipatterns.md +378 -0
- package/design/05-cases/case-design-system-adoption.md +328 -0
- package/design/06-glossary/design-glossary.md +329 -0
- package/design/ui-full-lifecycle-cross-platform-playbook.md +571 -0
- package/design/ux-system-deep-dive.md +38 -0
- package/design-systems/00-craft-rules.md +71 -0
- package/design-systems/aesthetic-families.md +43 -0
- package/design-systems/anti-ai-slop.md +162 -0
- package/design-systems/bold-geometric.md +120 -0
- package/design-systems/brutalist-bold.md +103 -0
- package/design-systems/editorial-clean.md +109 -0
- package/design-systems/glass-aurora.md +108 -0
- package/design-systems/modern-minimal.md +145 -0
- package/design-systems/premium-luxury.md +106 -0
- package/design-systems/product-type-design-map.md +48 -0
- package/design-systems/soft-warm.md +123 -0
- package/design-systems/tech-utility.md +113 -0
- package/desktop/01-standards/desktop-app-standard.md +72 -0
- package/desktop/01-standards/desktop-design.md +71 -0
- package/development/00-governance/document-template.md +41 -0
- package/development/01-standards/api-versioning-strategies.md +432 -0
- package/development/01-standards/authentication-patterns-complete.md +479 -0
- package/development/01-standards/css-architecture-complete.md +550 -0
- package/development/01-standards/database-migration-strategies.md +484 -0
- package/development/01-standards/elasticsearch-complete.md +347 -0
- package/development/01-standards/git-complete.md +371 -0
- package/development/01-standards/golang-complete.md +1565 -0
- package/development/01-standards/graphql-complete.md +298 -0
- package/development/01-standards/javascript-bundlers-complete.md +469 -0
- package/development/01-standards/javascript-typescript-complete.md +528 -0
- package/development/01-standards/jest-complete.md +275 -0
- package/development/01-standards/linux-complete.md +234 -0
- package/development/01-standards/logging-observability-complete.md +526 -0
- package/development/01-standards/microservices-communication.md +502 -0
- package/development/01-standards/mongodb-complete.md +406 -0
- package/development/01-standards/oauth2-complete.md +285 -0
- package/development/01-standards/performance-optimization-complete.md +289 -0
- package/development/01-standards/playwright-complete.md +247 -0
- package/development/01-standards/postgresql-complete.md +456 -0
- package/development/01-standards/pytest-complete.md +340 -0
- package/development/01-standards/python-async-programming.md +902 -0
- package/development/01-standards/python-complete.md +956 -0
- package/development/01-standards/python-decorators-complete.md +799 -0
- package/development/01-standards/python-design-patterns.md +2854 -0
- package/development/01-standards/python-packaging-distribution.md +420 -0
- package/development/01-standards/python-testing-strategies.md +607 -0
- package/development/01-standards/python-web-frameworks-comparison.md +471 -0
- package/development/01-standards/redis-complete.md +317 -0
- package/development/01-standards/rest-api-complete.md +316 -0
- package/development/01-standards/rust-complete.md +578 -0
- package/development/01-standards/typescript-advanced-types.md +1513 -0
- package/development/01-standards/web-security-complete.md +292 -0
- package/development/02-playbooks/api-design-playbook.md +810 -0
- package/development/02-playbooks/database-migration-playbook.md +580 -0
- package/development/02-playbooks/debugging-playbook.md +692 -0
- package/development/02-playbooks/feature-delivery-playbook.md +430 -0
- package/development/02-playbooks/incident-hotfix-playbook.md +387 -0
- package/development/02-playbooks/performance-optimization-playbook.md +531 -0
- package/development/02-playbooks/performance-tuning-playbook.md +652 -0
- package/development/02-playbooks/refactor-playbook.md +403 -0
- package/development/02-playbooks/release-playbook.md +469 -0
- package/development/03-checklists/architecture-review-checklist.md +168 -0
- package/development/03-checklists/data-migration-checklist.md +157 -0
- package/development/03-checklists/oncall-handover-checklist.md +173 -0
- package/development/03-checklists/pr-checklist.md +158 -0
- package/development/03-checklists/production-readiness-checklist.md +190 -0
- package/development/03-checklists/release-readiness-checklist.md +154 -0
- package/development/03-checklists/security-review-checklist.md +182 -0
- package/development/04-antipatterns/api-antipatterns.md +657 -0
- package/development/04-antipatterns/architecture-antipatterns.md +686 -0
- package/development/04-antipatterns/backend-antipatterns.md +648 -0
- package/development/04-antipatterns/cicd-antipatterns.md +540 -0
- package/development/04-antipatterns/code-smell-antipatterns.md +571 -0
- package/development/04-antipatterns/data-antipatterns.md +658 -0
- package/development/04-antipatterns/database-antipatterns.md +578 -0
- package/development/04-antipatterns/frontend-antipatterns.md +635 -0
- package/development/04-antipatterns/reliability-antipatterns.md +700 -0
- package/development/04-antipatterns/security-antipatterns.md +747 -0
- package/development/05-cases/case-api-version-migration.md +428 -0
- package/development/05-cases/case-authorization-hardening.md +383 -0
- package/development/05-cases/case-bluegreen-rollback.md +466 -0
- package/development/05-cases/case-cache-snowball-protection.md +485 -0
- package/development/05-cases/case-ci-cd-pipeline.md +544 -0
- package/development/05-cases/case-database-scaling.md +500 -0
- package/development/05-cases/case-db-hotspot-optimization.md +487 -0
- package/development/05-cases/case-incident-mttr-reduction.md +563 -0
- package/development/05-cases/case-microservice-migration.md +375 -0
- package/development/05-cases/case-performance-optimization.md +406 -0
- package/development/05-cases/case-security-incident-response.md +345 -0
- package/development/06-glossary/full-stack-glossary.md +166 -0
- package/development/09-maturity/quarterly-audit-template.md +35 -0
- package/development/11-ui-excellence/ui-aesthetic-system.md +41 -0
- package/development/11-ui-excellence/ui-engineering-excellence.md +435 -0
- package/development/12-scenarios/development-scenarios-guide.md +565 -0
- package/development/13-implementation-assets/implementation-toolkit.md +282 -0
- package/development/13-implementation-assets/knowledge-gates-execution.md +43 -0
- package/development/14-full-lifecycle/software-lifecycle-gates.md +511 -0
- package/development/15-lifecycle-templates/project-templates-collection.md +791 -0
- package/development/api-contract-and-versioning-guide.md +36 -0
- package/development/api-governance-complete.md +43 -0
- package/development/backend-engineering-complete.md +43 -0
- package/development/code-review-quality-complete.md +43 -0
- package/development/concurrency-reliability-complete.md +43 -0
- package/development/database-engineering-complete.md +43 -0
- package/development/engineering-effectiveness-complete.md +43 -0
- package/development/engineering-standards-deep-dive.md +38 -0
- package/development/frontend-engineering-complete.md +43 -0
- package/development/performance-capacity-complete.md +43 -0
- package/development/refactor-migration-complete.md +42 -0
- package/development/refactoring-and-techdebt-playbook.md +37 -0
- package/development/security-in-development-complete.md +43 -0
- package/devops/01-standards/cicd-pipeline-complete.md +262 -0
- package/devops/01-standards/docker-complete.md +1490 -0
- package/devops/01-standards/github-actions-complete.md +337 -0
- package/devops/01-standards/kubernetes-complete.md +638 -0
- package/devops/01-standards/terraform-complete.md +2117 -0
- package/devops/02-playbooks/docker-compose-playbook.md +233 -0
- package/devops/02-playbooks/docker-k8s-production-playbook.md +186 -0
- package/devops/02-playbooks/docker-production-playbook.md +952 -0
- package/edge-iot/01-standards/edge-iot-complete.md +473 -0
- package/experts/architect/api-design.md +178 -0
- package/experts/architect/methodology.md +124 -0
- package/experts/architect/security.md +75 -0
- package/experts/backend-lead/methodology.md +216 -0
- package/experts/devops/methodology.md +160 -0
- package/experts/frontend-lead/methodology.md +178 -0
- package/experts/product-manager/industry/ecommerce.md +43 -0
- package/experts/product-manager/industry/saas.md +40 -0
- package/experts/product-manager/methodology.md +97 -0
- package/experts/qa-lead/methodology.md +123 -0
- package/experts/qa-lead/test-strategy.md +128 -0
- package/experts/uiux-designer/methodology.md +125 -0
- package/frontend/01-standards/accessibility-complete.md +532 -0
- package/frontend/01-standards/accessibility-standard.md +74 -0
- package/frontend/01-standards/admin-dashboard-and-crud.md +72 -0
- package/frontend/01-standards/design-tokens-complete.md +444 -0
- package/frontend/01-standards/forms-and-validation.md +77 -0
- package/frontend/01-standards/frontend-architecture-and-layering.md +119 -0
- package/frontend/01-standards/i18n-and-localization.md +65 -0
- package/frontend/01-standards/nextjs-complete.md +451 -0
- package/frontend/01-standards/react-complete.md +713 -0
- package/frontend/01-standards/react-hooks-complete-guide.md +1100 -0
- package/frontend/01-standards/react-hooks-complete.md +1171 -0
- package/frontend/01-standards/seo-and-web-vitals.md +77 -0
- package/frontend/01-standards/state-management-complete.md +444 -0
- package/frontend/01-standards/vue-complete.md +499 -0
- package/frontend/01-standards/vue3-complete.md +2002 -0
- package/frontend/01-standards/web-framework-best-practices.md +64 -0
- package/frontend/01-standards/web-performance-complete.md +495 -0
- package/frontend/02-playbooks/accessibility-a11y-playbook.md +161 -0
- package/frontend/02-playbooks/frontend-performance-playbook.md +707 -0
- package/frontend/02-playbooks/i18n-internationalization-playbook.md +120 -0
- package/frontend/02-playbooks/performance-optimization-playbook.md +163 -0
- package/frontend/02-playbooks/react-nextjs-production-playbook.md +167 -0
- package/frontend/02-playbooks/react-state-management-playbook.md +173 -0
- package/frontend/03-checklists/component-quality-checklist.md +166 -0
- package/frontend/03-checklists/frontend-launch-checklist.md +299 -0
- package/frontend/04-antipatterns/frontend-antipatterns.md +886 -0
- package/frontend/05-cases/case-performance-optimization.md +274 -0
- package/harmony/01-standards/harmonyos-arkts-standard.md +75 -0
- package/harmony/01-standards/harmonyos-design.md +65 -0
- package/high-quality-engineering-playbook.md +54 -0
- package/incident/01-standards/incident-response-complete.md +303 -0
- package/incident/02-playbooks/chaos-engineering-playbook.md +883 -0
- package/incident/02-playbooks/postmortem-playbook.md +398 -0
- package/incident/03-checklists/incident-readiness-checklist.md +181 -0
- package/incident/04-antipatterns/incident-antipatterns.md +490 -0
- package/incident/05-cases/case-cascade-failure.md +176 -0
- package/incident/06-glossary/incident-glossary.md +114 -0
- package/incident/postmortem-and-response-deep-dive.md +39 -0
- package/industries/ecommerce/ecommerce-complete.md +631 -0
- package/industries/education/education-complete.md +555 -0
- package/industries/fintech/fintech-complete.md +501 -0
- package/industries/gaming/gaming-complete.md +587 -0
- package/industries/healthcare/healthcare-complete.md +452 -0
- package/low-code/01-standards/low-code-complete.md +944 -0
- package/miniprogram/01-standards/ai-common-mistakes.md +61 -0
- package/miniprogram/01-standards/miniprogram-custom-navbar-capsule.md +77 -0
- package/miniprogram/01-standards/miniprogram-design.md +61 -0
- package/miniprogram/01-standards/miniprogram-standard.md +81 -0
- package/mobile/01-standards/android-material-design.md +70 -0
- package/mobile/01-standards/flutter-complete.md +384 -0
- package/mobile/01-standards/ios-design-hig.md +78 -0
- package/mobile/01-standards/mobile-app-standard.md +85 -0
- package/mobile/01-standards/react-native-complete.md +352 -0
- package/mobile/02-playbooks/mobile-cross-platform-playbook.md +175 -0
- package/mobile/02-playbooks/mobile-performance.md +473 -0
- package/mobile/03-checklists/mobile-release-checklist.md +234 -0
- package/mobile/04-antipatterns/mobile-antipatterns.md +798 -0
- package/mobile/05-cases/case-app-performance.md +500 -0
- package/mobile/05-cases/case-app-startup-optimization.md +218 -0
- package/mobile/06-glossary/mobile-glossary.md +484 -0
- package/observability/01-standards/observability-standards.md +103 -0
- package/observability/02-playbooks/prometheus-grafana-playbook.md +135 -0
- package/observability/02-playbooks/structured-logging-playbook.md +73 -0
- package/observability/03-checklists/observability-checklist.md +54 -0
- package/observability/04-antipatterns/observability-antipatterns.md +106 -0
- package/operations/01-standards/prometheus-monitoring-complete.md +1578 -0
- package/operations/02-playbooks/capacity-planning-playbook.md +620 -0
- package/operations/03-checklists/production-launch-checklist.md +365 -0
- package/operations/04-antipatterns/operations-antipatterns.md +664 -0
- package/operations/05-cases/case-sre-practices.md +581 -0
- package/operations/06-glossary/operations-glossary.md +120 -0
- package/operations/aiops-anomaly-detection.md +758 -0
- package/operations/capacity-planning.md +1061 -0
- package/operations/chaos-engineering.md +659 -0
- package/operations/incident-command-system.md +38 -0
- package/operations/observability-complete.md +442 -0
- package/operations/slo-sli-playbook.md +517 -0
- package/operations/sre-operations-deep-dive.md +39 -0
- package/package.json +8 -0
- package/performance/01-standards/performance-and-scalability.md +80 -0
- package/performance/01-standards/performance-standards.md +156 -0
- package/performance/02-playbooks/query-optimization-playbook.md +103 -0
- package/performance/03-checklists/performance-checklist.md +56 -0
- package/performance/04-antipatterns/performance-antipatterns.md +146 -0
- package/product/01-standards/product-management-complete.md +285 -0
- package/product/02-playbooks/feature-launch-playbook.md +207 -0
- package/product/02-playbooks/user-research-playbook.md +532 -0
- package/product/03-checklists/feature-launch-checklist.md +275 -0
- package/product/04-antipatterns/product-antipatterns.md +355 -0
- package/product/05-cases/case-mvp-to-scale.md +384 -0
- package/product/06-glossary/product-glossary.md +462 -0
- package/product/feature-prioritization-framework.md +40 -0
- package/product/kpi-and-metric-tree.md +37 -0
- package/product/product-discovery-and-prd-deep-dive.md +41 -0
- package/quantum/01-standards/quantum-complete.md +1186 -0
- package/security/01-standards/api-security-complete.md +511 -0
- package/security/01-standards/container-runtime-security.md +574 -0
- package/security/01-standards/data-protection-gdpr.md +543 -0
- package/security/01-standards/owasp-top10-complete.md +1890 -0
- package/security/01-standards/secure-coding-baseline.md +90 -0
- package/security/01-standards/supply-chain-security.md +441 -0
- package/security/01-standards/web-security-checklist.md +108 -0
- package/security/01-standards/zero-trust-architecture.md +521 -0
- package/security/02-playbooks/auth-sso-playbook.md +166 -0
- package/security/02-playbooks/incident-response-security-playbook.md +588 -0
- package/security/02-playbooks/owasp-api-security-playbook.md +129 -0
- package/security/02-playbooks/payment-integration-playbook.md +119 -0
- package/security/02-playbooks/penetration-testing-playbook.md +517 -0
- package/security/03-checklists/security-audit-checklist.md +356 -0
- package/security/04-antipatterns/security-coding-antipatterns.md +580 -0
- package/security/05-cases/case-log4shell-incident.md +537 -0
- package/security/05-cases/case-major-breaches.md +468 -0
- package/security/06-glossary/security-glossary.md +212 -0
- package/security/compliance-automation.md +993 -0
- package/security/container-security.md +680 -0
- package/security/devsecops-complete.md +426 -0
- package/security/sast-dast-sca.md +775 -0
- package/security/secrets-management.md +594 -0
- package/security/security-architecture-deep-dive.md +37 -0
- package/security/threat-modeling-stride-playbook.md +40 -0
- package/seed-templates/auth-system.md +59 -0
- package/seed-templates/blog-content.md +94 -0
- package/seed-templates/dashboard.md +89 -0
- package/seed-templates/docs-site.md +73 -0
- package/seed-templates/e-commerce.md +50 -0
- package/seed-templates/saas-landing.md +92 -0
- package/seed-templates/settings-page.md +51 -0
- package/testing/01-standards/test-strategy-and-layering.md +83 -0
- package/testing/01-standards/testing-strategy-complete.md +422 -0
- package/testing/01-standards/unit-testing-best-practices.md +118 -0
- package/testing/02-playbooks/e2e-testing-playbook.md +988 -0
- package/testing/02-playbooks/testing-strategy-playbook.md +126 -0
- package/testing/03-checklists/test-strategy-checklist.md +208 -0
- package/testing/04-antipatterns/testing-antipatterns.md +718 -0
- package/testing/05-cases/case-testing-transformation.md +300 -0
- package/testing/06-glossary/testing-glossary.md +110 -0
- package/testing/risk-based-test-matrix.md +36 -0
- package/testing/testing-strategy-deep-dive.md +37 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: case-performance-optimization
|
|
3
|
+
title: 案例研究:P99 延迟从 2s 降到 200ms 的性能优化实战
|
|
4
|
+
domain: development
|
|
5
|
+
category: 05-cases
|
|
6
|
+
difficulty: intermediate
|
|
7
|
+
tags: [agent, case, checklist, development, optimization, performance, 元数据]
|
|
8
|
+
quality_score: 70
|
|
9
|
+
last_updated: 2026-06-15
|
|
10
|
+
---
|
|
11
|
+
# 案例研究:P99 延迟从 2s 降到 200ms 的性能优化实战
|
|
12
|
+
|
|
13
|
+
## 元数据
|
|
14
|
+
|
|
15
|
+
| 字段 | 值 |
|
|
16
|
+
|------|------|
|
|
17
|
+
| 行业 | 在线教育 SaaS 平台 |
|
|
18
|
+
| 系统规模 | 注册用户 800 万,日活 120 万 |
|
|
19
|
+
| 技术栈 | Go + PostgreSQL + Redis + Elasticsearch |
|
|
20
|
+
| 团队规模 | 后端 12 人,SRE 3 人 |
|
|
21
|
+
| 优化周期 | 6 周(2024-03 至 2024-04) |
|
|
22
|
+
| 核心目标 | 课程详情页 P99 延迟从 2.1s 降到 200ms 以内 |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 一、背景
|
|
27
|
+
|
|
28
|
+
### 1.1 业务场景
|
|
29
|
+
|
|
30
|
+
某在线教育 SaaS 平台的课程详情页是转化漏斗的关键节点。用户从广告/搜索引擎进入后,70% 的首次访问落在课程详情页。该页面需要聚合以下数据:
|
|
31
|
+
|
|
32
|
+
- 课程基本信息(标题、简介、讲师、大纲)
|
|
33
|
+
- 价格与优惠(原价、活动价、优惠券适用)
|
|
34
|
+
- 用户学习进度(如已购买)
|
|
35
|
+
- 评价与评分(综合评分 + 最新 20 条评价)
|
|
36
|
+
- 推荐课程列表(基于协同过滤)
|
|
37
|
+
- 实时在学人数
|
|
38
|
+
|
|
39
|
+
### 1.2 性能现状
|
|
40
|
+
|
|
41
|
+
通过 APM(SkyWalking)采集的 7 天数据:
|
|
42
|
+
|
|
43
|
+
| 指标 | 值 |
|
|
44
|
+
|------|------|
|
|
45
|
+
| P50 延迟 | 680ms |
|
|
46
|
+
| P90 延迟 | 1,450ms |
|
|
47
|
+
| P99 延迟 | 2,100ms |
|
|
48
|
+
| P999 延迟 | 4,800ms |
|
|
49
|
+
| 错误率 | 0.3% |
|
|
50
|
+
| QPS 峰值 | 3,200 |
|
|
51
|
+
| 超时率(>3s) | 2.1% |
|
|
52
|
+
|
|
53
|
+
### 1.3 业务影响
|
|
54
|
+
|
|
55
|
+
- 用户跳出率 38%(行业基准 20%)
|
|
56
|
+
- 广告 ROI 低于预期 25%(因着陆页体验差)
|
|
57
|
+
- 用户反馈"页面卡顿"占客诉 Top 3
|
|
58
|
+
- 产品经理估算:P99 降到 500ms 以下,转化率可提升 15%
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 二、挑战
|
|
63
|
+
|
|
64
|
+
### 2.1 系统复杂度
|
|
65
|
+
|
|
66
|
+
课程详情页的单次请求涉及 6 个下游服务调用:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
API Gateway
|
|
70
|
+
└── Course Detail API (Go)
|
|
71
|
+
├── Course Service → PostgreSQL (基本信息)
|
|
72
|
+
├── Price Service → PostgreSQL + Redis (价格计算)
|
|
73
|
+
├── Progress Service → Redis (学习进度)
|
|
74
|
+
├── Review Service → Elasticsearch (评价)
|
|
75
|
+
├── Recommendation Service → Redis + ML模型 (推荐)
|
|
76
|
+
└── Counter Service → Redis (实时计数)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 2.2 约束条件
|
|
80
|
+
|
|
81
|
+
1. **不能降低数据新鲜度**:价格和库存必须实时,评价延迟不超过 5 分钟
|
|
82
|
+
2. **不能增加硬件预算**:当前基础设施预算已锁定
|
|
83
|
+
3. **不能影响其他接口**:优化改动不能引入回归
|
|
84
|
+
4. **时间紧迫**:4 月底有大型营销活动,必须在此之前完成
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 三、分析过程
|
|
89
|
+
|
|
90
|
+
### 3.1 全链路 Trace 分析
|
|
91
|
+
|
|
92
|
+
从 SkyWalking 抽样 1000 个慢请求(P99 以上),分析耗时分布:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
请求总耗时分解(P99 = 2100ms):
|
|
96
|
+
┌─────────────────────────────────────┐
|
|
97
|
+
│ 网络入站 + 网关路由 50ms │
|
|
98
|
+
│ Course Service DB查询 380ms │ ← 热点
|
|
99
|
+
│ Price Service 计算 220ms │ ← 热点
|
|
100
|
+
│ Progress Service Redis 15ms │
|
|
101
|
+
│ Review Service ES查询 680ms │ ← 最大瓶颈
|
|
102
|
+
│ Recommendation Service 520ms │ ← 热点
|
|
103
|
+
│ Counter Service Redis 8ms │
|
|
104
|
+
│ 数据组装 + 序列化 120ms │ ← 可疑
|
|
105
|
+
│ 网络出站 107ms │
|
|
106
|
+
└─────────────────────────────────────┘
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**发现**:6 个下游调用是**串行**执行的,而非并行。
|
|
110
|
+
|
|
111
|
+
### 3.2 逐层深入分析
|
|
112
|
+
|
|
113
|
+
#### Course Service(380ms)
|
|
114
|
+
|
|
115
|
+
```sql
|
|
116
|
+
-- 慢查询 1:课程详情 + 讲师信息 + 大纲章节
|
|
117
|
+
SELECT c.*, t.name AS teacher_name, t.avatar, t.bio,
|
|
118
|
+
ch.id AS chapter_id, ch.title AS chapter_title,
|
|
119
|
+
le.id AS lesson_id, le.title AS lesson_title
|
|
120
|
+
FROM courses c
|
|
121
|
+
LEFT JOIN teachers t ON c.teacher_id = t.id
|
|
122
|
+
LEFT JOIN chapters ch ON ch.course_id = c.id
|
|
123
|
+
LEFT JOIN lessons le ON le.chapter_id = ch.id
|
|
124
|
+
WHERE c.id = $1 AND c.status = 'published'
|
|
125
|
+
ORDER BY ch.sort_order, le.sort_order;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
问题分析:
|
|
129
|
+
- 该 JOIN 查询返回行数 = 课程章节数 x 课时数,平均 200+ 行
|
|
130
|
+
- `chapters` 表缺少 `(course_id, sort_order)` 组合索引
|
|
131
|
+
- `EXPLAIN ANALYZE` 显示 Seq Scan on chapters(40 万行全表扫描)
|
|
132
|
+
|
|
133
|
+
#### Review Service(680ms)
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
// Elasticsearch 查询
|
|
137
|
+
{
|
|
138
|
+
"query": {
|
|
139
|
+
"bool": {
|
|
140
|
+
"must": [
|
|
141
|
+
{"term": {"course_id": 12345}},
|
|
142
|
+
{"term": {"status": "approved"}}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"sort": [{"created_at": "desc"}],
|
|
147
|
+
"size": 20,
|
|
148
|
+
"aggs": {
|
|
149
|
+
"avg_rating": {"avg": {"field": "rating"}},
|
|
150
|
+
"rating_dist": {"terms": {"field": "rating"}}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
问题分析:
|
|
156
|
+
- ES 索引未按 `course_id` 做 routing,查询扇出到所有 5 个 shard
|
|
157
|
+
- 聚合计算(avg_rating + rating_dist)每次都实时计算
|
|
158
|
+
- 索引有 2000 万条评价,mapping 中 `created_at` 未开启 doc_values 优化
|
|
159
|
+
|
|
160
|
+
#### Recommendation Service(520ms)
|
|
161
|
+
|
|
162
|
+
问题分析:
|
|
163
|
+
- 每次请求实时调用 ML 推荐模型(Python Flask 微服务)
|
|
164
|
+
- 模型推理平均 400ms
|
|
165
|
+
- 推荐结果相对稳定,同一课程的推荐列表 1 小时内变化不大
|
|
166
|
+
|
|
167
|
+
#### 数据组装(120ms)
|
|
168
|
+
|
|
169
|
+
问题分析:
|
|
170
|
+
- 使用标准 `encoding/json` 序列化,大量反射开销
|
|
171
|
+
- 响应体平均 45KB,含未被前端使用的冗余字段
|
|
172
|
+
- 未启用 Gzip 压缩
|
|
173
|
+
|
|
174
|
+
### 3.3 瓶颈优先级排序
|
|
175
|
+
|
|
176
|
+
| 排名 | 瓶颈 | 当前耗时 | 优化潜力 | 实施难度 |
|
|
177
|
+
|------|------|----------|----------|----------|
|
|
178
|
+
| 1 | 串行调用改并行 | - | -1200ms | 低 |
|
|
179
|
+
| 2 | ES 查询优化 | 680ms | -580ms | 中 |
|
|
180
|
+
| 3 | 推荐结果缓存 | 520ms | -500ms | 低 |
|
|
181
|
+
| 4 | DB 查询优化 | 380ms | -300ms | 中 |
|
|
182
|
+
| 5 | 价格计算缓存 | 220ms | -180ms | 中 |
|
|
183
|
+
| 6 | 序列化优化 | 120ms | -80ms | 低 |
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 四、优化方案与实施
|
|
188
|
+
|
|
189
|
+
### 4.1 第一轮:串行改并行(Week 1)
|
|
190
|
+
|
|
191
|
+
**改动**:将 6 个下游调用从串行改为并行(Go goroutine + errgroup)
|
|
192
|
+
|
|
193
|
+
```go
|
|
194
|
+
// 优化前(串行)
|
|
195
|
+
course, _ := courseService.GetDetail(ctx, courseID)
|
|
196
|
+
price, _ := priceService.Calculate(ctx, courseID, userID)
|
|
197
|
+
progress, _ := progressService.Get(ctx, courseID, userID)
|
|
198
|
+
reviews, _ := reviewService.Query(ctx, courseID)
|
|
199
|
+
recs, _ := recService.Get(ctx, courseID)
|
|
200
|
+
counter, _ := counterService.Get(ctx, courseID)
|
|
201
|
+
|
|
202
|
+
// 优化后(并行)
|
|
203
|
+
g, ctx := errgroup.WithContext(ctx)
|
|
204
|
+
g.Go(func() error { course, err = courseService.GetDetail(ctx, courseID); return err })
|
|
205
|
+
g.Go(func() error { price, err = priceService.Calculate(ctx, courseID, userID); return err })
|
|
206
|
+
g.Go(func() error { progress, err = progressService.Get(ctx, courseID, userID); return err })
|
|
207
|
+
g.Go(func() error { reviews, err = reviewService.Query(ctx, courseID); return err })
|
|
208
|
+
g.Go(func() error { recs, err = recService.Get(ctx, courseID); return err })
|
|
209
|
+
g.Go(func() error { counter, err = counterService.Get(ctx, courseID); return err })
|
|
210
|
+
if err := g.Wait(); err != nil { ... }
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**效果**:P99 从 2100ms 降到 850ms(总耗时 = 最慢的单个调用 680ms + 网关开销)
|
|
214
|
+
|
|
215
|
+
### 4.2 第二轮:ES 查询优化(Week 2)
|
|
216
|
+
|
|
217
|
+
**改动 1**:按 `course_id` 做 routing
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
// 写入时指定 routing
|
|
221
|
+
PUT /reviews/_doc/123?routing=course_12345
|
|
222
|
+
{
|
|
223
|
+
"course_id": 12345,
|
|
224
|
+
"rating": 5,
|
|
225
|
+
"content": "..."
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// 查询时指定 routing,只查 1 个 shard
|
|
229
|
+
GET /reviews/_search?routing=course_12345
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**改动 2**:聚合结果预计算
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
每次评价写入时异步更新 Redis:
|
|
236
|
+
course:{id}:review_stats = {
|
|
237
|
+
avg_rating: 4.7,
|
|
238
|
+
total_count: 3256,
|
|
239
|
+
rating_1: 23, rating_2: 45, rating_3: 189,
|
|
240
|
+
rating_4: 876, rating_5: 2123
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
查询时直接读 Redis(<5ms),ES 只查评价列表
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**改动 3**:优化 ES mapping
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"created_at": {
|
|
251
|
+
"type": "date",
|
|
252
|
+
"doc_values": true,
|
|
253
|
+
"format": "epoch_millis"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**效果**:Review Service 耗时从 680ms 降到 45ms
|
|
259
|
+
|
|
260
|
+
### 4.3 第三轮:推荐结果缓存(Week 3)
|
|
261
|
+
|
|
262
|
+
**策略**:推荐结果写入 Redis,TTL 30 分钟,每 15 分钟异步刷新
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
Key: rec:course:{course_id}
|
|
266
|
+
Value: JSON array of recommended course IDs
|
|
267
|
+
TTL: 30 minutes
|
|
268
|
+
Refresh: 每 15 分钟异步批量刷新热门课程的推荐列表
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**兜底策略**:缓存未命中时返回基于分类的热门课程列表(<10ms),而非实时调用 ML 模型
|
|
272
|
+
|
|
273
|
+
**效果**:Recommendation Service 耗时从 520ms 降到 8ms(缓存命中率 96%)
|
|
274
|
+
|
|
275
|
+
### 4.4 第四轮:DB 查询优化(Week 4)
|
|
276
|
+
|
|
277
|
+
**改动 1**:添加复合索引
|
|
278
|
+
|
|
279
|
+
```sql
|
|
280
|
+
CREATE INDEX idx_chapters_course_sort ON chapters(course_id, sort_order);
|
|
281
|
+
CREATE INDEX idx_lessons_chapter_sort ON lessons(chapter_id, sort_order);
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**改动 2**:拆分查询 + 应用层组装
|
|
285
|
+
|
|
286
|
+
```go
|
|
287
|
+
// 拆分为 2 个小查询代替 1 个大 JOIN
|
|
288
|
+
course, _ := db.QueryRow("SELECT * FROM courses WHERE id=$1", courseID)
|
|
289
|
+
chapters, _ := db.Query(
|
|
290
|
+
"SELECT c.*, l.id AS lid, l.title AS ltitle "+
|
|
291
|
+
"FROM chapters c LEFT JOIN lessons l ON l.chapter_id=c.id "+
|
|
292
|
+
"WHERE c.course_id=$1 ORDER BY c.sort_order, l.sort_order", courseID)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**改动 3**:课程基本信息加 Redis 缓存(TTL 10 分钟)
|
|
296
|
+
|
|
297
|
+
**效果**:Course Service 耗时从 380ms 降到 35ms(缓存命中)/ 80ms(缓存未命中)
|
|
298
|
+
|
|
299
|
+
### 4.5 第五轮:序列化与传输优化(Week 5)
|
|
300
|
+
|
|
301
|
+
**改动 1**:使用 `json-iterator` 替换标准库
|
|
302
|
+
|
|
303
|
+
```go
|
|
304
|
+
import jsoniter "github.com/json-iterator/go"
|
|
305
|
+
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**改动 2**:裁剪响应字段,移除前端不使用的 12 个字段
|
|
309
|
+
|
|
310
|
+
**改动 3**:启用 Gzip 压缩(响应体从 45KB 降到 12KB)
|
|
311
|
+
|
|
312
|
+
**效果**:序列化 + 传输耗时从 120ms + 107ms 降到 35ms + 30ms
|
|
313
|
+
|
|
314
|
+
### 4.6 第六轮:全局兜底与降级(Week 6)
|
|
315
|
+
|
|
316
|
+
- 为每个下游调用设置独立超时(300ms)
|
|
317
|
+
- 推荐服务和评价聚合可降级(超时返回缓存/默认值)
|
|
318
|
+
- 接入 Sentinel 限流,峰值 QPS 超过 5000 时启动降级
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## 五、验证过程
|
|
323
|
+
|
|
324
|
+
### 5.1 压测环境
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
工具: wrk2 + k6
|
|
328
|
+
场景: 课程详情页 GET /api/v1/courses/{id}
|
|
329
|
+
并发: 500 并发连接
|
|
330
|
+
持续: 10 分钟稳定负载
|
|
331
|
+
数据: 50,000 门课程随机访问
|
|
332
|
+
环境: Staging(与生产 1:1 配置)
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### 5.2 每轮优化后的压测数据
|
|
336
|
+
|
|
337
|
+
| 轮次 | P50 | P90 | P99 | P999 | QPS | 错误率 |
|
|
338
|
+
|------|-----|-----|-----|------|-----|--------|
|
|
339
|
+
| 基线 | 680ms | 1450ms | 2100ms | 4800ms | 3200 | 0.3% |
|
|
340
|
+
| 第一轮(并行) | 320ms | 580ms | 850ms | 1900ms | 3200 | 0.3% |
|
|
341
|
+
| 第二轮(ES) | 210ms | 380ms | 520ms | 1100ms | 3200 | 0.2% |
|
|
342
|
+
| 第三轮(推荐缓存) | 155ms | 260ms | 380ms | 680ms | 3200 | 0.1% |
|
|
343
|
+
| 第四轮(DB) | 68ms | 120ms | 195ms | 380ms | 3200 | 0.05% |
|
|
344
|
+
| 第五轮(序列化) | 52ms | 95ms | 160ms | 320ms | 3200 | 0.05% |
|
|
345
|
+
| 第六轮(降级) | 52ms | 95ms | 158ms | 280ms | **8500** | 0.02% |
|
|
346
|
+
|
|
347
|
+
### 5.3 生产验证
|
|
348
|
+
|
|
349
|
+
灰度上线后 7 天的生产数据:
|
|
350
|
+
|
|
351
|
+
| 指标 | 优化前 | 优化后 | 变化 |
|
|
352
|
+
|------|--------|--------|------|
|
|
353
|
+
| P99 延迟 | 2,100ms | 168ms | -92% |
|
|
354
|
+
| 超时率 | 2.1% | 0.01% | -99.5% |
|
|
355
|
+
| 跳出率 | 38% | 22% | -42% |
|
|
356
|
+
| 转化率 | 3.2% | 4.1% | +28% |
|
|
357
|
+
| 广告 ROI | 1.8 | 2.4 | +33% |
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## 六、经验教训
|
|
362
|
+
|
|
363
|
+
### 6.1 方法论总结
|
|
364
|
+
|
|
365
|
+
1. **先分析再优化**:不要凭直觉猜瓶颈。本案例中直觉认为 DB 是最大瓶颈,实际上串行调用和 ES 查询才是主因
|
|
366
|
+
2. **从架构层开始**:串行改并行这一个改动就贡献了 60% 的优化效果,投入产出比最高
|
|
367
|
+
3. **分轮次验证**:每轮优化后独立压测,明确每个改动的贡献,避免多个变量同时引入
|
|
368
|
+
4. **缓存不是万能的**:缓存引入了数据一致性复杂度,必须设计好失效策略和降级方案
|
|
369
|
+
5. **关注长尾**:P99 和 P999 才是用户体验的真正杀手,P50 好看不代表用户满意
|
|
370
|
+
|
|
371
|
+
### 6.2 常见陷阱
|
|
372
|
+
|
|
373
|
+
- **过早优化**:在没有数据支撑的情况下优化是浪费时间
|
|
374
|
+
- **只看平均值**:平均延迟 300ms 可能隐藏了 5% 用户的 3s 超时
|
|
375
|
+
- **忽略序列化开销**:在高 QPS 场景下,JSON 序列化的 CPU 开销不可忽视
|
|
376
|
+
- **缓存雪崩**:必须对缓存 TTL 加随机抖动,避免同时过期
|
|
377
|
+
- **压测不充分**:只测峰值 QPS 不够,还要测持续负载下的稳定性
|
|
378
|
+
|
|
379
|
+
### 6.3 关键认知
|
|
380
|
+
|
|
381
|
+
- 性能优化的 80/20 法则:20% 的改动解决 80% 的问题
|
|
382
|
+
- 架构层优化 > 代码层优化 > 硬件层优化
|
|
383
|
+
- 可观测性是性能优化的前提,没有 Trace 就没有优化方向
|
|
384
|
+
- 性能优化不是一次性工作,需要建立持续监控和告警机制
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Agent Checklist
|
|
389
|
+
|
|
390
|
+
在 AI Agent 辅助执行性能优化任务时,应逐项确认:
|
|
391
|
+
|
|
392
|
+
- [ ] **基线采集**:是否通过 APM/Trace 采集了当前 P50/P90/P99/P999 基线数据
|
|
393
|
+
- [ ] **瓶颈定位**:是否通过全链路 Trace 分析确定了 Top 3 瓶颈点
|
|
394
|
+
- [ ] **调用拓扑**:是否梳理了请求的完整调用链路和依赖关系
|
|
395
|
+
- [ ] **并行化检查**:串行调用中是否有可以并行执行的部分
|
|
396
|
+
- [ ] **SQL 分析**:是否对慢查询执行了 EXPLAIN ANALYZE
|
|
397
|
+
- [ ] **索引审查**:关键查询是否有合适的索引覆盖
|
|
398
|
+
- [ ] **缓存策略**:是否为适合缓存的数据设计了缓存层(含 TTL + 失效 + 降级)
|
|
399
|
+
- [ ] **序列化检查**:响应体是否有冗余字段,是否使用了高效序列化库
|
|
400
|
+
- [ ] **压缩启用**:HTTP 响应是否启用了 Gzip/Brotli 压缩
|
|
401
|
+
- [ ] **超时设置**:每个下游调用是否有独立的超时配置
|
|
402
|
+
- [ ] **降级策略**:非核心数据源超时后是否有降级方案
|
|
403
|
+
- [ ] **压测验证**:每轮优化后是否在压测环境独立验证
|
|
404
|
+
- [ ] **灰度上线**:是否通过灰度发布验证生产效果
|
|
405
|
+
- [ ] **监控看板**:是否建立了性能监控 Dashboard 和告警规则
|
|
406
|
+
- [ ] **回归保障**:是否有性能回归检测机制防止后续劣化
|