·조회수 67

To prevent serverless websites from experiencing Cold start, warm them up.

Situation

While deploying the Denver Server Time project that retrieves server time, I encountered a cold start phenomenon where the screen appeared after a delay of about 4 seconds when I accessed it after not connecting for a few minutes. Serverless deployment via Vercel is cost-effective and I use it frequently, but I wanted to avoid long loading times that inconvenience users. While considering solutions, I came across Tobin's article "Speeding up AWS Amplify NextJS First Render + Cold Start: An Unexpected Result," which helped me resolve the issue. I am sharing the process as many developers may need a serverless warm-up method to address cold starts.

Implementation

In short, warm-up involves continuously loading and waking up the site before it falls asleep. A website that no one accesses for about 5 minutes falls into a deep sleep in a cold state. Therefore, loading it once again before it falls asleep wakes it up for another 5 minutes. By repeating this process, you can create a serverless website that is always awake. By accessing the AWS Route53 console and going to Health checks in the left menu, you can create a health check that periodically checks if the site is alive. Press Create health check and create it with the options below. That's it. The cost is approximately $1 per month per health check. You can find more detailed information in the referenced blog post. I hope this article is helpful.

References

https://medium.com/aws-tip/speeding-up-aws-amplify-nextjs-first-render-cold-start-and-images-an-unexpected-result-36a416d69615

김지식
김지식
웹, 앱 개발자입니다.

댓글

댓글을 불러오는 중...