Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Labs

Optimize Websites Using Cloud CDN on Google Cloud

The Cloud CDN service is able to bring your websites much closer to the end user by caching content at their nearest Edge Point of Presence. This lab will show you how to use Cloud CDN to bring your website "closer" to your end users.

Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 02, 2025
Duration
45m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Deploy Your Environment
    • Open Cloud Shell

    • Copy and paste the below command to build out your HTTP load balanced environment:

      gsutil cp gs://acg-gcloud-course-resources/network-engineer/cdn/cdn-setup-script.sh . && source cdn-setup-script.sh
      
    • After the script completes, enter the listed frontend IP address in a new tab. It will take roughly 5 minutes after script completion for the load-balanced application to fully initialize. Periodically refresh the website until the correct site displays.

  2. Challenge

    View and Test Performance of Non-Cached Website

    Since our website server is very far away from us, let's see how long it takes to request data from it.

    • In a new web browser tab, enter the frontend IP address, if you have not already done so. Once the website loads, click on the link for Page 2.

    • Depending on your own location, it may load quickly or slowly. If you are in North or South America, the images should load very slowly, because you are very far away from the backend servers.

    • Let's measure the exact performance. Go to Compute Engine, and SSH into your testing-server instance.

    • Once in your instance, run the below commands to send a series of curl requests to both pages of our website and view how long it takes to come back. We will want to reduce these response times via caching.

      • Keep in mind your frontend IP address will be different. Substitute your IP address in the below commands as necessary.

        for i in {1..15};do curl -s -w "%{time_total}\n" -o /dev/null http://35.190.125.64/index.html; done
        
        for i in {1..15};do curl -s -w "%{time_total}\n" -o /dev/null http://35.190.125.64/page-2.html; done
        
  3. Challenge

    Enable Cloud CDN
    • Leave your SSH window up, and go back to the web console.
    • Go to the top left menu, and select Network Services, followed by Cloud CDN.
    • Select Add origin.
    • From the Load balancer dropdown menu, select http-lb.
    • Your http-backend backend service should be automatically selected. Click Add.
  4. Challenge

    Measure Cached Performance

    It will take a few minutes for your Cloud CDN settings to be fully initialized. Go back to your testing-instance and run the above curl commands again. If you do not get substantially quicker results, wait a few minutes and try again. A few minutes later, repeating the command will show substantially quicker results (about 0.001-0.003 seconds) response time, compared to the 0.19 second responses in the cached version. Repeat this for both your index.html and page-2.html pages.

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight