DaaS / Products / Deploy Production Stack with Full-Stack Performance Tuning

Deploy Production Stack with Full-Stack Performance Tuning

A DevOps team provisions a complete production web application stack using Terraform (VPC, ECS cluster, RDS, OceanBase, OSS, SLB with SSL), then performs comprehensive performance optimization across the entire stack: system-level diagnostics on Alibaba Cloud Linux (CPU, memory, I/O bottlenecks), deep RDS query tuning (slow SQL, index optimization, execution plans), and OceanBase optimization — covering both broad full-stack diagnosis and targeted database tuning in a single end-to-end workflow.

Products involved

Scenario

Use this workflow when a DevOps team provisions a production web stack via Terraform and encounters end-to-end latency under load. It bridges infrastructure-as-code deployment with real-time system diagnostics on Alibaba Cloud Linux and targeted query optimization across ApsaraDB RDS and OceanBase to resolve CPU, I/O, and execution plan bottlenecks in a single pipeline.

Integration steps

  1. Provision Infrastructure: Run terraform apply with modules defining VPC, ECS, RDS, OceanBase, and OSS. Ensure resource "alicloud_slb_listener" sets ssl_certificate_id = alicloud_cas_certificate.cert.id and backend_protocol = "https".
  2. Validate SLB/CAS Binding: Verify SSL termination via aliyun slb DescribeLoadBalancerAttribute --LoadBalancerId <slb_id>. Confirm ListenerPort=443 routes to ECS 8080.
  3. Diagnose Alibaba Cloud Linux: Execute the alinux-troubleshoot-performance workflow: perf record -g -p <app_pid> -- sleep 30 && perf report. Cross-reference with iostat -x 1 and free -m to isolate CPU steal or disk queue depth > 2.
  4. Tune RDS Queries: Trigger rds-optimize-performance by enabling slow logs: aliyun rds ModifyDBInstanceParameter --DBInstanceId <rds_id> --Parameters '[{"Name":"slow_query_log","Value":"ON"},{"Name":"long_query_time","Value":"1"}]'. Extract top offenders, run EXPLAIN ANALYZE <query>, and apply missing indexes via CREATE INDEX.
  5. Optimize OceanBase: Connect to the OB tenant and run SHOW FULL PROCESSLIST to detect lock waits. Scope tuning to the target tenant: ALTER SYSTEM SET ob_query_timeout=30000000, ob_sql_work_area_percentage=20. Rebuild fragmented partitions with ALTER TABLE ... REBUILD PARTITION.
  6. Apply & Verify: Commit Terraform state, restart application pods, and validate latency via aliyun cms DescribeMetricList --MetricName HttpLatency. Iterate until P99 < 200ms.

Architecture

Terraform orchestrates the foundational network (VPC), compute (ECS running Alibaba Cloud Linux), and data layers (RDS for relational workloads, OceanBase for distributed transactions). Inbound HTTPS traffic terminates at the SLB using CAS-managed certificates, then routes to ECS. ECS handles application logic and offloads static assets to OSS. Performance diagnostics run locally on ECS nodes via alinux-optimize-performance, while RDS and OceanBase expose query-level telemetry through their management APIs, enabling coordinated tuning without cross-service network hops.

Prerequisites

Common pitfalls

Typical questions

FAQ

Q: How do I deploy a production stack with Terraform and perform full-stack performance tuning? A: You provision a complete production web application stack using Terraform and then perform comprehensive performance optimization across the entire infrastructure and database layers. This end-to-end workflow includes system-level diagnostics on Alibaba Cloud Linux to identify CPU, memory, and I/O bottlenecks, alongside deep RDS query tuning for slow SQL and index optimization. The process also covers OceanBase optimization to address full-stack performance in a single deployment cycle.