diff options
| -rw-r--r-- | assignments/1/README.md | 87 | ||||
| -rw-r--r-- | assignments/1/etc/apache/apache.conf | 4 |
2 files changed, 85 insertions, 6 deletions
diff --git a/assignments/1/README.md b/assignments/1/README.md index 6b924cd..a152d29 100644 --- a/assignments/1/README.md +++ b/assignments/1/README.md @@ -383,11 +383,89 @@ It helps keep the pipe full. > (20%) You have learned that a Web cache can be useful in some cases. In this problem, you will investigate how useful a Web cache can be at a home. First, you need to download Apache server and install and run it as a proxy server on a computer on your home network. Then, write a brief report on what you did to make it work and how you are using it on all your devices on your home network. > Assume your family has six members. Each member likes to download short videos from the Internet to watch on their personal devices. All these devices are connected to the Internet through Wi-Fi. Further assume the average object size of each short video is 100 MB and the average request rate from all devices to servers on the Internet is three requests per minute. Five seconds is the average amount of time it takes for the router on the ISP side of your Internet link to forward an HTTP request to a server on the Internet and receive a response. + +1. I installed the apache web server. +1. I created a configuration file in `etc/apache/apache.conf` +1. I started the server with `httpd -D FOREGROUND -d . -f etc/apache/apache.conf` +1. I configured my proxy settings to point to localhost:8081 + +```bash +ServerRoot "${PWD}" +Listen 8081 +PidFile var/httpd.pid +ErrorLog var/error.log + +LoadModule mpm_prefork_module /usr/local/Cellar/httpd/2.4.65/lib/httpd/modules/mod_mpm_prefork.so +LoadModule authz_core_module /usr/local/Cellar/httpd/2.4.65/lib/httpd/modules/mod_authz_core.so +LoadModule unixd_module /usr/local/Cellar/httpd/2.4.65/lib/httpd/modules/mod_unixd.so +LoadModule log_config_module /usr/local/Cellar/httpd/2.4.65/lib/httpd/modules/mod_log_config.so +LoadModule proxy_module /usr/local/Cellar/httpd/2.4.65/lib/httpd/modules/mod_proxy.so +LoadModule proxy_http_module /usr/local/Cellar/httpd/2.4.65/lib/httpd/modules/mod_proxy_http.so +LoadModule proxy_connect_module /usr/local/Cellar/httpd/2.4.65/lib/httpd/modules/mod_proxy_connect.so +LoadModule cache_module /usr/local/Cellar/httpd/2.4.65/lib/httpd/modules/mod_cache.so +LoadModule cache_disk_module /usr/local/Cellar/httpd/2.4.65/lib/httpd/modules/mod_cache_disk.so + +CacheRoot "${PWD}/var/cache/apache2" +CacheEnable disk / +CacheDirLevels 2 +CacheDirLength 1 +CacheMaxFileSize 100000000 + +<VirtualHost *:8081> + ProxyRequests On + ProxyVia On + AllowCONNECT 443 80 + + <Proxy *> + Require all granted + </Proxy> + + CacheHeader on + CacheDetailHeader on +</VirtualHost> +``` + > a) What is the average time alpha for your home router to receive a video object from your ISP router? + +It takes approximately ≈ 5.83 s to receive a video object. + +- Family members: 6. +- Average object size (video) L = 100 MB = 100 × 10^6 bytes = 800 × 10^6 bits (i.e. 800,000,000 bits) +- Average request rate (all devices) a = 3 requests/min = 0.05 requests/s +- ISP router round-trip for request/response: 5 seconds (given) +- ISP link capacity R = 960 Mbps + +Transmission time for object across ISP link = 800,000,000 / 960,000,000 ~ 0.83333 s + 5 seconds += 5 + 0.83333 ~ 5.8333 seconds. + > b) What is the traffic intensity mu on the Internet link to your home router if none of the requested videos is cached on the proxy server? + +The traffic intensity is approximately 4.17% utilization. + +Traffic intensity `mu = (L * a) / R` +`L * a` = 800,000,000 bits × 0.05 req/s = 40,000,000 bits/s. +mu = 40,000,000 / 960,000,000 ~ 0.0416667. + > c) If average access delay beta is defined as alpha/(mu-1), what is the average access delay your family members will experience when watching the short videos? + +The average access delay is ~6 s. + +Compute: beta = 5.8333 / (1 − 0.0416667) = 5.8333 / 0.9583333 ≈ 6.0869 s. + +As utilization grows, expected access delay increases approximately as a/(1−mu) in simple queueing approximations. + > d) If the total average response time is defined as 5+beta, and the miss rate of your proxy server is 0.5, what will be the total average response time? +The average response time is ~5s + +The total average response time (for a cache miss) is 5 + beta. + +If cache miss rate = 0.5 and hits are served locally quickly, the expected total average response time across all requests: + +Average = hit_rate * (fast local time ~ 0) + miss_rate * (5 + beta) = 0.5 × (5 + 6.0869) ~ 0.5 × 11.0869 ~ 5.54345 s. + +Half the requests miss and incur the full remote fetch, the other half are served from cache almost instantly. + ## 2.4 File Distribution: Client-Server vs P2P (10%) > (10%) You have learned that a file can be distributed to peers in either @@ -402,10 +480,11 @@ and P2P distribution and the differences between the two. Given: -- F = 21 GB = 168 Gb -- Us = 1 Gbps; Di = 20 Mbps; U ∈ {0.3, 7, 2} Mbps; N ∈ {10, 100, 1000} - -Formulas (Kurose & Ross 8e Sec. 2.6): +- File: F = 21 GB = 168 Gb +- upload rate: Us = 1 Gbps +- download rate: Di = 20 Mbps +- U = {0.3, 7, 2} Mbps; +- N = {10, 100, 1000} - Client–server: D_cs = max{ N·F/Us, F/Di }. - P2P: D_p2p = max{ F/Us, F/Di, N·F/(Us + N·U) }. diff --git a/assignments/1/etc/apache/apache.conf b/assignments/1/etc/apache/apache.conf index 8e98c48..a782955 100644 --- a/assignments/1/etc/apache/apache.conf +++ b/assignments/1/etc/apache/apache.conf @@ -23,11 +23,11 @@ CacheMaxFileSize 100000000 ProxyRequests On ProxyVia On AllowCONNECT 443 80 - + <Proxy *> Require all granted </Proxy> - + CacheHeader on CacheDetailHeader on </VirtualHost> |
