0Pricing
AWS for Backend Developers (EC2, S3, RDS, Lambda) · 课时

RDS 扩展与性能调优

学习如何纵向和横向扩展 Amazon RDS 实例、监控性能,并针对生产工作负载调整数据库。

RDS 扩展与性能调优 是 CoddyKit 上的免费 AWS for Backend Developers (EC2, S3, RDS, Lambda) 课时。 这是第 4 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 AWS for Backend Developers (EC2, S3, RDS, Lambda) 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 AWS for Backend Developers (EC2, S3, RDS, Lambda) 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

Why Scaling Matters

As your application grows, a single RDS instance may struggle to keep up with traffic. Scaling ensures your database stays responsive under load.

There are two broad strategies:

  • Vertical scaling — make the instance bigger (more CPU/RAM)
  • Horizontal scaling — spread reads across multiple instances

Vertical Scaling (Instance Class)

Vertical scaling means changing the DB instance class, for example moving from db.t3.medium to db.m6g.large.

RDS applies the change during a maintenance window or immediately, usually with a short restart.

aws rds modify-db-instance \
  --db-instance-identifier mydb \
  --db-instance-class db.m6g.large \
  --apply-immediately

Storage Auto Scaling

RDS can automatically grow your storage when free space runs low. Enable Storage Autoscaling and set a maximum threshold so you never run out of disk unexpectedly.

  • Set a max allocated storage cap
  • RDS adds storage in increments as needed
aws rds modify-db-instance \
  --db-instance-identifier mydb \
  --max-allocated-storage 500 \
  --apply-immediately

Read Replicas for Read Scaling

For read-heavy workloads, create read replicas. Replicas serve SELECT queries while the primary handles writes.

Point reporting dashboards and analytics at replicas to take load off the primary.

aws rds create-db-instance-read-replica \
  --db-instance-identifier mydb-replica \
  --source-db-instance-identifier mydb

Connection Pooling with RDS Proxy

Opening too many database connections wastes memory and can exhaust limits. Amazon RDS Proxy pools and reuses connections, which is especially helpful for serverless apps and Lambda.

  • Reduces connection overhead
  • Improves failover times

Monitoring with Enhanced Monitoring

Enhanced Monitoring gives OS-level metrics (CPU, memory, disk I/O) at up to 1-second granularity. Combine it with CloudWatch to spot bottlenecks before they cause outages.

Performance Insights

Performance Insights visualizes database load and shows you the top SQL statements, waits, and users driving load.

Use it to identify slow queries that need indexing or rewriting.

Indexing for Faster Queries

The single biggest performance win is often a good index. Indexes let the database find rows without scanning the whole table.

Add indexes on columns used in WHERE, JOIN, and ORDER BY clauses.

CREATE INDEX idx_orders_customer
ON orders (customer_id);

Parameter Groups for Tuning

RDS exposes engine settings through DB parameter groups. Tune values like max_connections or buffer pool size to match your workload.

Create a custom parameter group rather than editing the default.

aws rds create-db-parameter-group \
  --db-parameter-group-name mydb-tuned \
  --db-parameter-group-family mysql8.0 \
  --description 'Tuned for prod'

Caching to Reduce DB Load

Not every query needs to hit the database. Put a cache like Amazon ElastiCache (Redis/Memcached) in front of RDS for frequently read, rarely changing data.

  • Lower latency for hot data
  • Fewer queries reaching RDS

Scaling Checklist

Before scaling, follow this order:

  • Profile with Performance Insights
  • Add or fix indexes
  • Offload reads to replicas
  • Add caching
  • Only then scale the instance up

Throwing a bigger instance at a missing index is expensive and rarely the real fix.

Quick Check

Test your scaling knowledge.

Recap

You learned to scale RDS effectively:

  • Vertical scaling changes the instance class
  • Read replicas scale reads horizontally
  • RDS Proxy pools connections
  • Performance Insights and indexing tune queries

Always profile first, fix indexes, offload and cache before paying for a bigger instance.

常见问题解答

「RDS 扩展与性能调优」课时是免费的吗?

是的 — 「RDS 扩展与性能调优」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 AWS for Backend Developers (EC2, S3, RDS, Lambda) 课程的其余内容,请升级到 CoddyKit PRO。 AWS for Backend Developers (EC2, S3, RDS, Lambda) 课程共包含 4 节课。

「RDS 扩展与性能调优」这节课中我会学到什么?

学习如何纵向和横向扩展 Amazon RDS 实例、监控性能,并针对生产工作负载调整数据库。 你通过在浏览器中直接运行的动手代码来练习 AWS for Backend Developers (EC2, S3, RDS, Lambda),全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 AWS for Backend Developers (EC2, S3, RDS, Lambda) 需要有经验吗?

无需任何先前经验。CoddyKit 上的 AWS for Backend Developers (EC2, S3, RDS, Lambda) 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 4 节课,共 4 节。

「RDS 扩展与性能调优」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 AWS for Backend Developers (EC2, S3, RDS, Lambda) 课中编写并运行代码吗?

能。每节 AWS for Backend Developers (EC2, S3, RDS, Lambda) 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. Amazon RDS 入门
  2. 启动并连接到 RDS
  3. RDS 备份与高可用性
  4. RDS 扩展与性能调优
← 返回 AWS for Backend Developers (EC2, S3, RDS, Lambda)