I am running a SQL RDS with AWS Serverless, and run into errors when I test APIs. At the beginning of the day I will get a 502 error, however this resolves after I retry 1-4 times. I believe this error is due to some 'deadtime' that occurs when serverless is trying to 'boot up' from 0 capacity units after a period of inactivity? This does not seem to occur when the server is idle at 1 cap unit.
The only solution I have been able to think of is setting the server capacity min to 1 but this seems to defeat the purpose of serverless + increases price.
Has anyone else run into this problem/successfully implemented a solution?
Before you run the API tests, you can start a paused serverless DB by sending it a scale command:
aws rds modify-current-db-cluster-capacity --db-cluster-identifier mydatabase --capacity 1
and then poll every few seconds to see if it is available:
aws rds describe-db-clusters --db-cluster-identifier mydatabase | jq -r '.DBClusters[].Status'
Once it is available you should be able to test your APIs without getting 502 errors.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加