Containers - Workspace freezing

Within Sphere Engine Containers, there are integrated mechanisms enabling the freezing and unfreezing of workspaces.


Sometimes you may want to suspend the operations of a workspace without removing it. In such cases, you can choose to "freeze" the workspace. While frozen, the workspace retains its data but becomes inactive, making it unusable until you choose to "unfreeze" it.

Freezing the workspace also frees up the slots occupied by it, allowing those resources to be allocated elsewhere. You can unfreeze the workspace at any time to resume its normal functionality.

Below is a diagram of the life of the workspace when you use the freezing functionality. It shows the different states and the transitions between them.

Stop Workspace
Remove Workspace
Resume Workspace
Workspace Running
Workspace Stopped
Workspace Removed
Fig. 1. Lifecycle of the workspace

Creating a freezable workspace

To enable the freezing feature for a workspace, adjust the max_inactivity_storage_time parameter in the workspace creation API method to a value greater than 0.

Important: Workspaces created with the default value of max_inactivity_storage_time parameter or with max_inactivity_storage_time = 0 cannot be frozen. The value of this parameter uses minutes as a unit and it is 0 by default.

curl -X POST -F "project_id=<project_id>" -F "max_inactive_storage_time=5" "https://<customer_id><access_token>"

Setting the max_inactivity_storage_time parameter to a value of 5 will result in the workspace being frozen after 5 minutes of inactivity. In such a case, the workspace will be frozen but not removed.

You can also set an additional parameter, max_storage_time, to specify the maximum lifespan of the workspace. This is the maximum time after which the workspace will be removed. This parameter is also measured in minutes and is set to 0 by default, which means the workspace will not be removed.

curl -X POST -F "project_id=<project_id>" -F "max_inactive_storage_time=5" -F "max_storage_time=120" "https://<customer_id><access_token>"

This means that the workspace will be frozen after 5 minutes of inactivity and will be removed after 120 minutes, regardless of whether it is frozen or not.

Freezing the workspace

Freezing the workspace can be accomplished by invoking the PUT method on the endpoint /api/v1/workspaces/<project_id>/stop.

curl -X PUT "https://<customer_id><project_id>/stop?access_token=<access_token>"

Alternatively, you can manually freeze the workspace through the customer panel here. Simply click the stop button in the Actions column.

Unfreezing the workspace

To unfreeze the workspace it's enough for the end-user to re-enter it. Upon re-entry, the workspace will be restored to its state before freezing occurred.

Involved workspace parameters

There are three parameters of the workspace that affect the behavior of the freezing mechanism:

  • max_inactive_storage_time - the maximum time for which the workspace will be stored as freezed,
  • max_storage_time - the maximum time after which the workspace will be unconditionally removed,
  • inactivity_timeout - the time after which the inactive workspace will be either frozen or removed.