4 ms·
That's by design. Your server 'sleeps' and - wakes up on for a request(few seconds delay on request), - stays awake (requests are fast here), - goes back to
by asadlionpk 6y ago
That's by design. Your server 'sleeps' and
- wakes up on for a request(few seconds delay on request),
- stays awake (requests are fast here),
- goes back to sleeping if idle for sometime (15mins?)
This is what keeps the costs low (or free). Same is true for Heroku, Lambda, Vercel, Azure Functions, etc.
- mrtksn 6y agoSure but it is not an acceptable level of latency when the product is supposed to respond on user input. When the app or the feature is new or obscure it would fall in this state all the time. Last time I checked I wasn’t renting a server, it was supposed to be a service that’s fast at any scale. A 5$ DO instance would provide much better experience. They should give an option to keep it awake albeit at a cost.
- oldmanhorton 6y agoAzure functions has that option, but at some point... Why not just use a "real" web server if you want it always online? The whole point of serverless was that you don't need a server always running in the background.
- ncw96 6y agoLambda also provides this functionality — they call it "provisioned concurrency": https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html https://docs.aws.amazon.com/lambda/latest/dg/configuration-c...
- mrtksn 6y agoI don’t want to deal with it until it’s worth dealing with it. That is, until the cost of managing a server and it’s integration is less than the cost of using Firebase(which comes with free integration and no management needs).
- asadlionpk 6y agoThe easiest way around it is to keep ping-ing it every 5 mins from either from a third party (like pingdom, uptimerobot.com) or a cron function (https://cloud.google.com/scheduler/docs/creating https://cloud.google.com/scheduler/docs/creating). But I would recommend using Cloud Run instead.
- soamv 6y agoIsn't Cloud Run's cold start latency even worse?
- asadlionpk 6y agoActually you are right. I was under the impression that we can define minimum-maximum instances to run. But apparently it scales down to zero and there is no way to prevent that.
- earthboundkid 6y agoPinging a Lambda is the blind leading the blind. Your Lambda still gets periodically shut down and you still have cold starts! To avoid cold start, don’t use Lambda!
- pier25 6y agoCloud functions are not a good option for low traffic services where you'd like to have good latency. Cloudflare Workers are probably the best option in terms of cold starts and latency but are much more limited than other services.
- niyazpk 6y agoTo reduce cold-start latency in AWS Lambda, use "Provisioned Concurrency": https://aws.amazon.com/blogs/aws/new-provisioned-concurrency-for-lambda-functions/ https://aws.amazon.com/blogs/aws/new-provisioned-concurrency...
- econcon 6y agoYes, but I usually run my lambda function in multiple regions This gives user low latency if the service is being used If I've to launch DO server in 10 region, it will cost me $50 even if I am receiving a few request per day.