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.
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.
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".aliyun slb DescribeLoadBalancerAttribute --LoadBalancerId <slb_id>. Confirm ListenerPort=443 routes to ECS 8080.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.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.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.aliyun cms DescribeMetricList --MetricName HttpLatency. Iterate until P99 < 200ms.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.
aliyun) configured with AccessKey and SecretKeyalicloud provider v1.210+rds:ModifyDBInstanceParameter, oceanbase:ModifyDBInstance, slb:DescribeLoadBalancerAttributesysstat, perf, and tcpdump installedbackend_protocol = "http" while ECS expects HTTPS causes 502 Bad Gateway due to TLS handshake failure.slow_query_log without adjusting long_query_time floods disk I/O, worsening the exact bottleneck you're diagnosing.ob_sql_work_area_percentage at the cluster level starves other tenants; always scope changes to the specific tenant ID.ALTER SYSTEM commands without updating Terraform parameters blocks causes terraform plan to force-recreate instances on next apply.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.