The Anywhere Cache recommender analyzes your data usage and storage to provide recommendations that help you identify bucket-zone pairs in which it might be beneficial to create a cache using Anywhere Cache. Anywhere Cache also provides insights to show evidence for the recommendations. This page provides an overview of the Anywhere Cache recommender and describes how to view recommendations and view insights.
Overview
Anywhere Cache provides an SSD-backed zonal read cache for Cloud Storage buckets. To help you decide where to set up a cache and what time to live (TTL) to use, the Anywhere Cache recommender provides recommendations for creating caches in bucket-zone pairs.
Reviewing and taking actions on cache recommendations can help you save on network data transfer fees, improve latencies, and avoid exceeding bandwidth quotas.
How it works
The Anywhere Cache recommender simulates the existence of a cache and analyzes the cacheability and cost of your data over the past seven days by using the following insights:
Cache hit rate: the percentage of bytes that would have been served from the simulated cache.
Peak cache throughput: the amount of throughput that the simulated cache would serve, which represents extra bandwidth over what would be allowed without the simulated cache.
Net cache cost: the cost of the simulated cache, which is the sum of the cache cost, Class B operations cost difference, network data transfer cost difference, and data retrieval cost difference. A negative value for net cache cost indicates that using caching would save money.
This value is calculated using the following data:
Cache cost: the cost of using the simulated cache, which includes cache ingestion fees, storage fees, data transfer out fees, and read operation fees.
Class B operation difference: the cost of performing Class B operations on objects within the cache, minus the cost of performing the same Class B operations without caching.
Network data transfer difference: the cost of transferring data out of a multi-region bucket with caching, minus the cost of performing the same data transfer out of a multi-region bucket without caching.
Data retrieval cost difference: the cost of retrieving data from the cache, minus the cost of retrieving the same data from a non-cached bucket.
The Anywhere Cache recommender recommends a zone-bucket pair when the maximum cache size exceeds 100 GiB and one or more of the following three criteria are met:
The cache hit rate exceeds 80%
Net savings on multi-region data transfer out fees exceed $700 per week, based on negotiated price
The peak cache throughput limit exceeds 800 Gbps
These criteria are set so you only get recommendations for creating caches that are likely to provide significant benefit. Workloads that don't meet these criteria might also have significant benefits from having a cache, so you might want to set your own criteria. You can set your own criteria by exporting the recommendations to BigQuery and then querying the data using the values you want.
Recommendations include the zone name and the recommended time to live (TTL) of the cache.
Pricing
Refer to recommender pricing.
Before you begin
Before you begin, complete the following steps.
Enable the Recommender API
Get required roles
To view recommendations and insights for Anywhere Cache, ask your
administrator to grant you the Storage Admin (roles/storage.admin
) role on the
bucket or project.
This role provides a set of permissions that let you view recommendations and insights for Anywhere Cache. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
recommender.cloudStorageAnywhereCacheRecommendations.get
recommender.cloudStorageAnywhereCacheRecommendations.list
recommender.storageBucketAnywhereCacheSimulationInsights.get
recommender.storageBucketAnywhereCacheSimulationInsights.list
For instructions on granting roles, see Use IAM with buckets or Managing access to projects.
View Anywhere Cache recommendations
You can view all cache recommendations for a project by using the Google Cloud console or the Recommender API. You can also export recommendations to BigQuery using the BigQuery Data Transfer Service. For more information, see Export recommendations to BigQuery.
Console
To view recommendations for a specific bucket, complete the following steps:
- In the Google Cloud console, go to the Cloud Storage Buckets page.
In the list of buckets that appear, available recommendations appear in the Cache column. If recommendations are available, a
Recommended button is displayed.If the Cache column doesn't appear by default, see Show columns for instructions on making the Cache column appear.
To view details about a recommendation, click
Recommended from the Cache column.A pane appears showing details about how enabling caching could affect performance and costs for the bucket, as well as the recommended cache settings for the bucket.
REST API
JSON API
Have gcloud CLI installed and initialized, which lets you generate an access token for the
Authorization
header.To list recommendations for the project where you've enabled the Recommender API, use
cURL
to call the Recommender API with arecommendations.list
request.
curl \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/\ recommenders/google.storage.bucket.AnywhereCacheRecommender/recommendations"
Replace the following:
PROJECT_ID
with your project ID. For information on how to find your project ID, see Identifying projects.LOCATION
with the location of your bucket. For example,us-east4
.
View Anywhere Cache insights
The Anywhere Cache recommender generates recommendations based on resource insights.
Console
To view insights for a specific bucket, complete the following steps:
- In the Google Cloud console, go to the Cloud Storage Buckets page.
Click the name of the bucket you want to view the insights of.
In the Bucket details page, click the Configuration tab.
In the Anywhere Cache section, the
View analysis button appears when there are insights available to view.To view insights for the bucket, click
View analysis.The Caching analysis pane appears and displays insights for the bucket.
Command line
Have gcloud CLI installed and initialized, which lets you generate an access token for the
Authorization
header.In your development environment, list Anywhere Cache insights by using the
gcloud recommender insights list
command:gcloud recommender insights list --project=PROJECT_ID \ --location=LOCATION --insight-type=INSIGHT_TYPE
Replace the following:
PROJECT_ID
with your project ID. For information on how to find your project ID, see Identifying projects.LOCATION
with the location of your bucket. For example,us-east4
.INSIGHT_TYPE
with the valuegoogle.storage.bucket.AnywhereCacheSimulationInsight
.
REST API
JSON API
Have gcloud CLI installed and initialized, which lets you generate an access token for the
Authorization
header.To list insights for the project where you've enabled the Recommender API, use
cURL
to call the Recommender API with aninsights.list
request.
curl \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/\ insightTypes/google.storage.bucket.AnywhereCacheSimulationInsight/insights"
Replace the following:
PROJECT_ID
with your project ID. For information on how to find your project ID, see Identifying projects.LOCATION
with the location of your bucket. For example,us-east4
.
What's next
Create caches using Anywhere Cache.