core concepts

Sleepy Services

What is a Sleepy Service?

Putting an Application to sleep is a huge cost saving mechanism for development and production Environments alike.

On Noop, Sleepy Services are simply Services that shut down when they are not receiving Traffic for a set period of time. After the period of inactivity, Services go to “Sleep” and are woken up, or turned back on, when they once again receive a Traffic request.

Noop has gone to great lengths to ensure the wake up time is as fast as possible. In addition to container image caching, the first Service instance to come online will handle pending requests, meaning responses do not have to wait for the target service capacity to be met before reqests are handled by the Application.

When Should Sleepy Services be Used?

The most important consideration when deciding to use Sleepy Services is whether or not your app requires constant response times. When waking up, Sleepy Services will add their own startup time to the request that triggered their wake-up. Instance start-up time varies, but a typical wake-up might take between one and three seconds. Any app that can tolerate the added response time is a Sleepy Service candidate.

The Service wake-up time is influenced by the size of the image, the start-up time of the container Software, and the time it takes to get a successful health check. Large containers, with slow start-up times and slow health checks could create a timeout scenario. When the Service wake-up process takes more than 60 seconds, the Request that triggered the wake-up will fail with a timeout error. However, subsequent requests made within 60 seconds of the startup time will respond as usual.

Even with possible request timeouts, Non-production Environments are particularly good candidates for Sleepy Services because they can be configured to sleep when development and testing stops. In fact, by default all non-production Environments are configured to sleep after one hour of inactivity.

How to Create Sleepy Services?

In Noop, all non-production Services are Sleepy by default. To check whether a service is configured to Sleep, go to the Stack Service Scaling Settings page.

Menu location of the Service Scaling Settings

There are two options: first, whether the Service is sleepy or not. Second, what duration of inactivity will put the Services to sleep.

Configuring the inactivity period for a sleepy service

To ensure a service is always on, switch the sleep toggle to the off position.

Turning a Sleepy Service off