How to Optimize your Codespaces: Pro-tips for managing quotas
Published Jan 10 2023 12:00 AM 8,739 Views
Microsoft

As a developer, you're likely familiar with the concept of "quotas" when it comes to using cloud-based services. These limits are put in place to ensure that resources are used efficiently and to prevent any one user from consuming too many resources. In this post, we'll take a look at how quotas are affected by Codespaces and provide some suggestions for avoiding the limits on free Codespaces.

 

Before getting into the suggestions, it's important to recognize two key features of how Codespaces effect quotas:
 

  1. Every Codespace that has been created (but not deleted) has the potential to deplete your included quota.
  2. Running Codespaces will use both CPU core-hours and storage, while stopped Codespaces will consume your storage quota only.

 

It can be tricky to figure out exactly how your Codespaces are consuming your monthly quotas, but here are four good tips for lowering your spending on your personal account:

 

1. Delete Codespaces aggressively
You can conserve quotas by deleting Codespaces instances after each use. Additionally, under the Codespaces settings page, try lowering the default retention time to 1 day (the default is 30 days). This will help guarantee that you only consume resources when they are truly required.

 

Screenshot 2023-01-09 at 5.43.16 PM.png

 

 

2. Don't enable pre-builds
Pre-builds consume storage, so it's important to be mindful of what pre-builds you have enabled. Unfortunately, it can be difficult to keep track of which pre-builds you have enabled, so it's best to avoid them entirely. 

  

Screenshot 2023-01-09 at 5.46.02 PM.png

 

3. Monitor usage closely

To keep track of your Codespaces use, use the Billing Settings to check your usage and ensure you're not wasting capacity. This might help you identify any unnecessary usage and taking steps to reduce it.

 

 

Screenshot 2023-01-09 at 5.47.10 PM.png

 

 

4. Use granular reporting

Finally, for granular reporting and debugging consumption on CPU, Storage, and Pre-builds, use the “Get usage report” button in the billing page next to the “Usage this month” section. This will generate a CSV report, which will be delivered to your account and will provide you with specific information on your usage as well as assist you in identifying areas for improvement.

 

 

Screenshot 2023-01-09 at 5.49.46 PM.png

 

 

Overall, quotas can be a tricky thing to navigate when it comes to Codespaces, but by following these tips and regularly monitoring your consumption, you'll be well on your way to avoiding free Codespace limits and keeping your costs low.

 

Want to learn more about Codespaces? Here are some useful resources:

 

Co-Authors
Version history
Last update:
‎Jan 17 2023 01:08 PM
Updated by: