Recitation 11: Computer Networks
Preparation
First, complete Unit 4’s Lab 1: Computer Networks. The discussion and written activities are optional, but recommended. The lab focuses on the software involved in running the internet.
Next, watch this video: How Does the Internet Work?. The video focuses on the internet’s hardware.
After reviewing these materials, you should have a basic understanding of how the internet works.
Finally, in preparation for recitation, if you don’t already have Google Chrome installed on your device, please install it.
At Recitation
You can complete this activity either individually or with a partner.
Activity 1: Loading data over the network
This activity will demonstrate Snap’s ability to load data over the network.
First, open the HTML Demo project.
Next, click the laptop. The program will load and display the HTML code for the snap.berkeley.edu website.
Click “Stop” to end the program, and click “Minimize” to view the Snap program’s code. The Snap program’s code is quite simple: the HTML code is loaded over the network, then each line is printed using the for each
loop. Right-click on the url
block, then select “Help.” As described in the “Help” window, technical limitations prevent the url
block from loading data from other websites (i.e., websites other than snap.berkeley.edu). This makes it difficult to use the url
block for interesting programs, so we won’t use it further in this course.
Finally, perform a simple experiment. Click the clear screen
block to reset the program. Next, turn off your laptop’s WiFi. Then, click the laptop sprite. What happens? Hopefully this convinces you that the url
block can indeed load data over the network!
Activity 2: Timing popular websites
As you saw in the previous activity, the physical network connection of your device (i.e., WiFi) affects your ability to load data over the network. In this activity, you will see how the speed of your network connection and the complexity of webpages affects your ability to use them.
For this activity, we will use a network testing feature built into Google Chrome. Follow these steps:
- Open a new browser window
- Right-click on the page, then select “Inspect”
- Click on the “Network” tab
- Select “Disable cache” and change “No throttling” to “Slow 3G”
When you have finished, your settings should look like this:
With these settings enabled, your browser will behave as if you were using a slow 3G cellular connection.
Next, load a website. For example, the snap.berkeley.edu website:
The network traffic inspector shows which resources were loaded as part of loading the page, the size of each resource, and how long each resource took to load. An important takeaway is that a single webpage is usually made up of multiple resources. For example, loading the webpage for snap.berkeley.edu required loading the page’s HTML code, image files, and more!
At the bottom of the window, a summary of the network requests is displayed. In particular, pay attention to:
- Total number of requests (e.g., 70 requests)
- The amount of data transferred over the network (e.g., 3.6 MB transferred)
- The amount of time it took to finish loading the webpage (e.g., 1.3 min)
Next, you should measure these statistics for five different websites. Test a variety of websites, so you can look for patterns in what makes a website load faster or slower. Fill in the template shown below.
Finally, after completing the activity remember to re-enable caching and turn off throttling, so webpages will loading fast again.
Submit
Ensure that all teammates submit to Moodle. You should both upload a PDF containing:
- Your name(s)
- A filled-in version of the template shown below
- Thoughts on how this activity could be improved in the future
Template
- Activity 1:
- What happened when you clicked the laptop sprite when your WiFi was off?
- Activity 2:
Webpage URL | Total Number of Requests | Data Transferred | Time Taken |
---|---|---|---|
https://snap.berkeley.edu/ | 70 | 3.6 MB | 1.3 min |
- Reflections:
- Did you notice any patterns about which pages loaded faster?
- Imagine that you only had access to a slow cellular connection. Based on your experiences today, what online activities would you still be able to do, and what wouldn’t be possible?