Stark & Wayne
  • by Chris Weibel

Photo by Michael Longmire on Unsplash

Companies are looking for ways to cut costs and keep staff while offering the same level of service to their developers and customers. Hopefully, the suggestions below will help you identify a few opportunities to save money!

There are a few ways operators can save money on Cloud Foundry deployments. There are pros and cons to each approach, so please understand these before deciding to act on any suggestions.

Right-Size Instance Types

Using Prometheus dashboards, the amount of CPU, memory, and disk can be monitored for each virtual machine. Over time the usage patterns of each of these resources can be graphed to show which is over and under provisioned.


If you deployed to GCP, "Custom Machine Types" could be leveraged in which the vCPU and RAM can be configured separately. They also offer up suggestions on scaling instance types to different sizes after they've pulled instance statistics for a period of time.

Pros:

Cons:

Non HA Sandbox

Sandbox does not need to be highly available since it is only needed when testing upgrades. It should however attempt to match the instance types declared in the Cloud Config to match higher environments.

There is an ops file named scale-to-one-az.yml which scales the environment to a single AZ and one VM per instance group. This ops file is included and maintained in cf-deployment.

"Small Form Factor" or other types of deployments for which components are co-located on a reduced number VMs is not supported natively with ops files in cf-deployment and is not recommended since it would be an out-of-band modification which would need constant testing with each new release of cf-deployment. The feature is supported and maintained with versions of PCF and Genesis.

Pros:

Cons:

Use of Spot Instances

Spot Instances on AWS are regular but excess capacity EC2 instances which are auctioned off at a discounted rate. At any time, with just a few minutes notice, AWS can take the instance(s) away from you to sell to someone who has bid a higher price if the region is at capacity.

This solution leverages the power of BOSH to recreate VMs that have gone unresponsive after a period of time. The BOSH CPI for AWS can be configured with a bid price to provision VMs. The BOSH CPI can also be configured to fall back to On Demand EC2 Instances if the spot instances cannot be provisioned.

Pros:

Cons:

Pipeline Staring and Stopping Sandbox

It is potentially possible to spin down environments like Sandbox over nights/weekends. To do so, you would want to do the spin down and spin up in the following order:

  1. Stop monit or shutdown the BOSH Director
  2. Stop the instances for the desired deployments the BOSH Director was managing, like Cloud Foundry as the IaaS layer
  3. Save Money
  4. Start the instances at the IaaS layer
  5. Start the BOSH Director

Pros:

Cons:

Find more great articles with similar tags cloud foundry genesis author-cweibel