

# REL01-BP03 透過架構適應固定服務配額和限制
<a name="rel_manage_service_limits_aware_fixed_limits"></a>

請注意不可變更的服務配額、服務限制和實際資源限制。設計應用程式和服務的架構以防止這些限制影響可靠性。

範例包括 API 閘道的網路頻寬、無伺服器函數叫用承載大小、調節爆量速率，以及資料庫的使用者同時連線數目。

 **預期成果：**在正常和高流量條件下，應用程式或服務會如預期般執行。它們已設計為在該資源的固定限制或服務配額內運作。

 **常見的反模式：**
+ 選擇使用一項服務的一項資源的設計，但未注意到擴展時會導致此項設計失效的設計限制。
+ 執行不切實際的基準並且在測試期間達到服務固定配額。例如，以爆量限制執行測試，但是進行擴充的時間量。
+  選擇若超過固定服務配額時無法擴展或修改的設計。例如，SQS 承載大小為 256KB。
+  未設計可觀測性並且實作以監控和提醒在高流量活動期間可能有風險之服務配額的閾值 

 **建立此最佳實務的優勢：**確認應用程式是否會在所有預計的服務負載層級下執行，而不會中斷或降級。

 **未建立此最佳實務時的曝險等級：**中 

## 實作指引
<a name="implementation-guidance"></a>

 不同於以較高容量單位取代的軟性服務配額，AWS 服務的固定配額無法變更。這表示這裡所有類型的 AWS 服務都必須在使用於應用程式設計中時評估其潛在硬性容量限制。

 硬性限制會顯示在 Service Quotas 主控台中。如果資料欄顯示 `ADJUSTABLE = No`，則服務有硬性限制。硬性限制也會顯示在一些資源組態頁面中。例如，Lambda 有無法調整的特定硬性限制。

 例如，設計 Python 應用程式在 Lambda 函數中執行時，應用程式應該評估以判斷 Lambda 是否有機會執行超過 15 分鐘。如果程式碼可能執行超過此服務配額限制，則必須考慮替代技術或設計。如果在生產部署後達到此限制，應用程式會遭受降級和中斷直到可以矯正為止。與軟性配額不同，沒有任何方法可以變更這些限制，即使是在緊急嚴重性 1 活動下。

 一旦應用程式部署到測試環境，應該使用策略來尋找是否達到任何硬性限制。壓力測試、負載測試和混亂測試應該是引入測試計劃的一部分。

 **實作步驟** 
+  審核可用於應用程式設計階段的 AWS 服務完整清單。
+  審核這些服務的軟性配額限制和硬性配額限制。並非所有限制都會顯示在 Service Quotas 主控台中。有些服務[會在替代位置描述這些限制](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html)。
+  隨著您設計您的應用程式，審核您的工作負載的業務和技術驅動來源，例如業務成果、使用案例、相依系統、可用性目標和災難復原物件。讓您的業務和技術驅動來源引導程序以識別適合您的工作負載的分散式系統。
+  分析區域和帳戶之間的服務負載。許多硬性限制對於服務是區域型的。不過，某些限制是帳戶型。
+  分析區域 (Zonal) 失敗和區域 (Regional) 失敗期間資源用量的彈性架構。在使用主動/主動、主動/被動 – 熱、主動/被動 - 冷和主動/被動 - 指示燈方法的多區預設定進度中，這些失敗案例會導致較高的用量。這會建立達到硬性限制的潛在使用案例。

## 資源
<a name="resources"></a>

 **相關的最佳實務：**
+  [REL01-BP01 了解服務配額和限制](rel_manage_service_limits_aware_quotas_and_constraints.md) 
+  [REL01-BP02 管理跨帳戶和區域的服務配額](rel_manage_service_limits_limits_considered.md) 
+  [REL01-BP04 監控和管理配額](rel_manage_service_limits_monitor_manage_limits.md) 
+  [REL01-BP05 自動化配額管理](rel_manage_service_limits_automated_monitor_limits.md) 
+  [REL01-BP06 確保目前配額與最大用量之間存在足夠差距以適應容錯移轉](rel_manage_service_limits_suff_buffer_limits.md) 
+  [REL03-BP01 選擇如何分割工作負載](rel_service_architecture_monolith_soa_microservice.md) 
+  [REL10-BP01 將工作負載部署至多個位置](rel_fault_isolation_multiaz_region_system.md) 
+  [REL11-BP01 監控工作負載的所有元件以偵測故障](rel_withstand_component_failures_monitoring_health.md) 
+  [REL11-BP03 將所有分層的修復自動化](rel_withstand_component_failures_auto_healing_system.md) 
+  [REL12-BP04 使用混沌工程測試彈性](rel_testing_resiliency_failure_injection_resiliency.md) 

 **相關文件：**
+ [AWS Well-Architected Framework 的可靠性支柱：可用性](https://docs.aws.amazon.com/wellarchitected/latest/reliability-pillar/availability.html)
+  [AWS Service Quotas (先前稱為 Service Limits)](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html) 
+  [AWS Trusted Advisor 最佳實務檢查 (請參閱 Service Limits 章節)](https://aws.amazon.com/premiumsupport/technology/trusted-advisor/best-practice-checklist/) 
+  [AWS Answers 上的 AWS Limit Monitor](https://aws.amazon.com/answers/account-management/limit-monitor/) 
+  [Amazon EC2 Service Limits](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-resource-limits.html) 
+  [什麼是 Service Quotas？](https://docs.aws.amazon.com/servicequotas/latest/userguide/intro.html) 
+ [如何請求提高配額](https://docs.aws.amazon.com/servicequotas/latest/userguide/request-quota-increase.html)
+ [服務端點和配額](https://docs.aws.amazon.com/general/latest/gr/aws-service-information.html)
+  [Service Quotas 使用者指南](https://docs.aws.amazon.com/servicequotas/latest/userguide/intro.html) 
+ [Quota Monitor for AWS](https://aws.amazon.com/solutions/implementations/quota-monitor/)
+ [AWS 故障隔離界限](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/abstract-and-introduction.html)
+ [備援的可用性](https://docs.aws.amazon.com/whitepapers/latest/availability-and-beyond-improving-resilience/availability-with-redundancy.html)
+ [AWS for Data](https://aws.amazon.com/data/)
+ [什麼是持續整合？](https://aws.amazon.com/devops/continuous-integration/)
+ [什麼是持續交付？](https://aws.amazon.com/devops/continuous-delivery/)
+ [APN 合作夥伴：可以幫助進行組態管理的合作夥伴](https://partners.amazonaws.com/search/partners?keyword=Configuration+Management&ref=wellarchitected)
+ [管理 AWS 上每租用戶帳戶 SaaS 環境中的帳戶生命週期](https://aws.amazon.com/blogs/mt/managing-the-account-lifecycle-in-account-per-tenant-saas-environments-on-aws/)
+ [管理和監控工作負載中的 API 限流](https://aws.amazon.com/blogs/mt/managing-monitoring-api-throttling-in-workloads/)
+ [使用 AWS Organizations 大規模檢視 AWS Trusted Advisor 建議](https://aws.amazon.com/blogs/mt/organizational-view-for-trusted-advisor/)
+ [使用 AWS Control Tower 自動提高服務限制和企業支援](https://aws.amazon.com/blogs/mt/automating-service-limit-increases-enterprise-support-aws-control-tower/)
+ [Service Quotas 的動作、資源和條件金鑰](https://docs.aws.amazon.com/service-authorization/latest/reference/list_servicequotas.html)

 **相關影片：**
+  [AWS Live re:Inforce 2019 - Service Quotas](https://youtu.be/O9R5dWgtrVo) 
+ [使用 Service Quotas 檢視和管理 AWS 服務的配額](https://www.youtube.com/watch?v=ZTwfIIf35Wc)
+ [AWS IAM 配額示範](https://www.youtube.com/watch?v=srJ4jr6M9YQ)
+ [AWS re:Invent 2018：閉環與開放思維：如何取得大小型系統的控制權](https://www.youtube.com/watch?v=O8xLxNje30M)

 **相關工具：**
+ [AWS CodeDeploy](https://aws.amazon.com/codedeploy/)
+ [AWS CloudTrail](https://aws.amazon.com/cloudtrail/)
+ [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/)
+ [Amazon EventBridge](https://aws.amazon.com/eventbridge/)
+ [Amazon DevOps Guru](https://aws.amazon.com/devops-guru/)
+ [AWS Config](https://aws.amazon.com/config/)
+ [AWS Trusted Advisor](https://aws.amazon.com/premiumsupport/technology/trusted-advisor/)
+ [AWS CDK](https://aws.amazon.com/cdk/)
+ [AWS Systems Manager](https://aws.amazon.com/systems-manager/)
+ [AWS Marketplace](https://aws.amazon.com/marketplace/search/results?searchTerms=CMDB)