type
status
date
slug
summary
tags
category
icon
password
使用 RDS Serverless 的目标就是利用 Serverless 动态升降配置的特性来达到省钱的目标,直到我收到了欠费提醒……
欠费提醒
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F8a17eeee-704a-47d0-b7b8-a400631d97a9%2Fe8b315e128d471fccb845550fe35c06a.png?table=block&id=b6017563-90ae-4259-842d-cab427d24377&t=b6017563-90ae-4259-842d-cab427d24377)
事情还要从收到欠费提醒短信说起,当时我感到非常惊讶,何时费用来到这么高了?一天要10RMB+了,难道使用的力度太大了?
来看账单吧
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fb46cfc26-3a18-43a3-97f9-131679408c8a%2FUntitled.png?table=block&id=be24cab7-2f24-4102-80dd-50f27c5f6f30&t=be24cab7-2f24-4102-80dd-50f27c5f6f30)
从6月份开始每天干掉了十几RMB,我一开始还没有当作一回事,以为只是普通的高峰期,然后就忘记了这件事情。
之前一天也就几块钱,一个月才一百多,表示还可以接受。这下好了,费用直接翻倍,一个月干了三百多的费用。
三百多可以开一台很不错得机器了,RDS Serverless 怎么能跑到这个价格呢?所以一定是哪里出现了问题…
问题排查
思来想去,有一个表的查询量比较大,是一个 300+W 行的任务表,每天会从中拉取任务来跑,然后更新任务状态。
我当时以为是这个表的读写导致的,因此我的想法也很简单,就是把这个任务独立出去,弄台单独的机器跑 MySQL,然后把这张表迁移过去。
搞完这件事情后,过了几天,我发现费用依旧没有降下来,甚至费用都没有明显的波动。
非常奇怪~
监控显示 CPU 使用率一直在 34 左右,内存使用率高达 90,但是又没有给出任何的慢 SQL 之类的优化建议。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F4324f7a6-8db0-4c69-b475-0df0604fbace%2FUntitled.png?table=block&id=0a2b23f6-38e7-4602-a96d-16d30ce6e760&t=0a2b23f6-38e7-4602-a96d-16d30ce6e760)
感觉比较困惑,因为我对 MySQL 谈不上多熟悉吧,就只会简单的 CRUD,只能一通瞎搞。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F835ef71b-c745-45d2-b6f6-c5985dfca6ee%2FIMAGE_2023-07-22_175835.jpg?table=block&id=6c9284ac-b51f-451f-8fe4-3d7569d29257&t=6c9284ac-b51f-451f-8fe4-3d7569d29257)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F3d7f7c1d-fbcd-4b69-803e-4c33adc5465e%2FIMAGE_2023-07-22_175832.jpg?table=block&id=b19c8c20-d0fb-44d1-a57e-0b948a2e7fd0&t=b19c8c20-d0fb-44d1-a57e-0b948a2e7fd0)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F3c35ede8-5c7e-4bec-8a8a-42c4eca643dc%2FIMAGE_2023-07-22_175829.jpg?table=block&id=470a3f16-c8f5-40c0-ac25-bc3f03bfc8e0&t=470a3f16-c8f5-40c0-ac25-bc3f03bfc8e0)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F18808db7-8eb9-44b3-8d97-725054d5bd62%2FIMAGE_2023-07-22_175817.jpg?table=block&id=cd4af542-75a4-4644-9507-ca5692f8d9c4&t=cd4af542-75a4-4644-9507-ca5692f8d9c4)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F2dd73c0f-08ab-4850-ac62-e0d854861740%2FIMAGE_2023-07-22_175812.jpg?table=block&id=625f7fa1-4699-4066-b416-921734066133&t=625f7fa1-4699-4066-b416-921734066133)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F502d1836-b028-4cb6-b5ca-6880513abe84%2FIMAGE_2023-07-22_175809.jpg?table=block&id=a76cc930-18f9-4f0a-b876-5f613a2be25e&t=a76cc930-18f9-4f0a-b876-5f613a2be25e)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F704d13bd-a5ec-4027-bc21-b9d2e57dee36%2FIMAGE_2023-07-22_175805.jpg?table=block&id=b4a7e521-acb5-4496-9083-d73468cde18c&t=b4a7e521-acb5-4496-9083-d73468cde18c)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F758a0e47-db96-41dc-a30a-aef84ce41230%2FIMAGE_2023-07-22_175757.jpg?table=block&id=085ad699-c2b5-48ef-9e7a-282d2165c262&t=085ad699-c2b5-48ef-9e7a-282d2165c262)