Launch a custom site

When you are ready to launch your site to external traffic, there are many tasks you will need to perform, including:

Improve database performance

We recommend that you use a caching layer to improve the performance of your database. We recommend Google Cloud Redis Memorystore, a fully managed solution, which will boost the performance of both natural-language searches and regular database lookups in your site. Redis Memorystore runs as a standalone instance in a Google-managed virtual private cloud (VPC), and connects to your VPC network (“default” or otherwise) via direct peering. Your Cloud Run service connects to the instance using a VPC connector.

In the following procedures, we show you how to create a Redis instance that connects to your project’s “default” VPC network.

Step 1: Create the Redis instance

The following is a sample configuration that you can tune as needed. For additional information, see Create and manage Redis instances.

  1. Go to for your project.
  2. Select the Redis tab and click Create Instance.
  3. If prompted to enable the Redis API server, accept.
  4. Name your instance.
  5. Under Tier Selection, select Basic.
  6. Set the Capacity field to 2 GB.
  7. Under Region and zonal availability, set the region to be the same as your Cloud SQL database.
  8. Under Set up connection > Network, select default as the network.
  9. Click Create.

Step 2: Set the environment variable

  1. When the Redis instance is created above, go to the Instances > Redis tab, look up your instance and note the Primary Endpoint IP address.
  2. In custom_dc/cloudsql_env.list, set the value of the REDIS_HOST option to the IP address.

Step 3: Create the VPC connector

  1. Go to for your instance.
  2. If you are prompted to enable the VPC Access API, accept.
  3. In the Serverless VPC Access screen, click Create Connector.
  4. Name the connector.
  5. Under Region, select the region you specified for Redis instance in the first step.
  6. In the Network field, select default.
  7. Under Subnet, select Custom IP Range.
  8. In the IP Range field, enter a valid IP range; for example,
  9. Click Create.

For additional information, see Serverless VPC Access.

Step 4: Configure your Cloud Run service to connect to the VPC

  1. In the Cloud Console, go to the Cloud Run service from which you are serving your app.
  2. Click Edit & Deploy New Revision.
  3. Click the Networking tab and enable Connect to a VPC for outbound traffic.
  4. Enable Use Serverless VPC Access connectors.
  5. From the Network field, select the connector you created in step 3.
  6. Click Deploy.

Step 5: Verify that everything is working

To verify that your Cloud Run service is using the connector:

  1. Go to the Service details page for your service
  2. Click the Networking tab. Under VPC, you should see your connector listed.

To verify that traffic is hitting the cache:

  1. Run some queries against your running Cloud Run service.
  2. In the Cloud Console, go to the Memorystore page and select Redis instance.
  3. Under Instance Functions, click Monitoring.
  4. Scroll to the Cache Hit Ratio graph. You should see a significant percentage of your traffic hitting the cache.