diff options
| author | mo khan <mo@mokhan.ca> | 2025-09-15 17:34:14 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-09-15 17:34:14 -0600 |
| commit | 0d8fb420061fdf64c7dee2bd0d916b3074511f03 (patch) | |
| tree | c25ac05173d217c0aeba377b6737f64ab55fed41 | |
| parent | e9c501892d9de87e612b7b61d32ad30df21c0950 (diff) | |
fix calculations and replace unicode with ascii characters
| -rw-r--r-- | assignments/1/Brewfile (renamed from Brewfile) | 0 | ||||
| -rw-r--r-- | assignments/1/README.md | 179 |
2 files changed, 88 insertions, 91 deletions
diff --git a/Brewfile b/assignments/1/Brewfile index 580ce3e..580ce3e 100644 --- a/Brewfile +++ b/assignments/1/Brewfile diff --git a/assignments/1/README.md b/assignments/1/README.md index ab0c6a9..8ea75bc 100644 --- a/assignments/1/README.md +++ b/assignments/1/README.md @@ -397,8 +397,8 @@ Scenario: Web-based email (Gmail) sent to Alice who accesses email via IMAP on s 1. Application Layer: You compose email in Gmail web interface 2. HTTP/HTTPS: Browser sends POST request with email data to Gmail server 3. Transport Layer: TCP segments the HTTP request, adds port numbers (443 for HTTPS) -4. Network Layer: IP adds source/destination IP addresses (your phone → Gmail server) -5. Link Layer: Wi-Fi frames the IP packets with MAC addresses (phone → router) +4. Network Layer: IP adds source/destination IP addresses (your phone -> Gmail server) +5. Link Layer: Wi-Fi frames the IP packets with MAC addresses (phone -> router) 6. Physical Layer: Radio waves transmit frames to Wi-Fi access point #### Phase 2: Gmail Processing and SMTP Delivery @@ -411,12 +411,12 @@ Scenario: Web-based email (Gmail) sent to Alice who accesses email via IMAP on s 6. Network Layer: IP routes packets through internet infrastructure 7. Link Layer: Various link technologies (Ethernet, fiber, etc.) carry packets -#### Phase 3: Alice Retrieving Email (Alice's Mail Server → Smartphone) +#### Phase 3: Alice Retrieving Email (Alice's Mail Server -> Smartphone) 1. IMAP Request: Alice's email app sends IMAP commands to check for new messages 2. Transport Layer: TCP establishes connection (port 143/993), segments IMAP requests 3. Network Layer: IP routes packets from Alice's phone to her mail server -4. Link Layer: Wi-Fi frames carry IP packets (phone → Wi-Fi router → ISP) +4. Link Layer: Wi-Fi frames carry IP packets (phone -> Wi-Fi router -> ISP) 5. Physical Layer: Radio waves and various physical media transmit signals #### Phase 4: Email Delivery to Alice's Phone @@ -430,8 +430,8 @@ Scenario: Web-based email (Gmail) sent to Alice who accesses email via IMAP on s Key Protocol Stack Traversals: -- Downward: Each device processes from Application → Physical when sending -- Upward: Each device processes from Physical → Application when receiving +- Downward: Each device processes from Application -> Physical when sending +- Upward: Each device processes from Physical -> Application when receiving - Multiple Hops: Email traverses multiple network devices (routers, switches) between sender and receiver, each processing up to Network layer and back down # Part 2: Long Answer Questions (70%) @@ -464,9 +464,9 @@ Number of packets = Total file bits ÷ Payload bits per packet Based on traceroute to google.com (representing university server path): -1. Home router → ISP gateway (192.168.1.254 → 192.168.0.1) -2. ISP local → ISP regional (192.168.0.1 → 10.139.230.1) -3. ISP → Internet backbone (10.139.230.1 → 209.85.174.62) +1. Home router -> ISP gateway (192.168.1.254 -> 192.168.0.1) +2. ISP local -> ISP regional (192.168.0.1 -> 10.139.230.1) +3. ISP -> Internet backbone (10.139.230.1 -> 209.85.174.62) 4. Multiple backbone links through Google's network 5. Final delivery to destination server @@ -476,26 +476,26 @@ Total identified links: 14 hops Based on traceroute RTT measurements: -| Link | From → To | RTT (ms) | Estimated Speed | +| Link | From -> To | RTT (ms) | Estimated Speed | | ----- | --------------- | ---------- | ---------------------------------- | -| 1 | Home → Router | 16 | ~100 Mbps (Local Ethernet/Wi-Fi) | -| 2 | Router → ISP | 16 | ~50 Mbps (Residential broadband) | +| 1 | Home -> Router | 16 | ~100 Mbps (Local Ethernet/Wi-Fi) | +| 2 | Router -> ISP | 16 | ~960 Mbps (Residential broadband) | | 3 | ISP Local | 18 | ~1 Gbps (ISP infrastructure) | | 4-14 | Backbone | 38-79 | ~10+ Gbps (Internet backbone) | -First link speed estimation: ~50 Mbps (residential upload speed) +First link speed estimation: ~960 Mbps (residential upload speed) ### d) Time for last packet to enter first link Transmission time per packet = Packet size ÷ Link speed -= 10,000 bits ÷ (50 × 10^6 bps) -= 0.2 ms per packet += 10,000 bits ÷ (960 × 10^6 bps) += 0.0104 ms per packet Time for all packets to enter first link: -= 8,081 packets × 0.2 ms/packet -= 1,616.2 ms = 1.62 seconds += 8,081 packets × 0.0104 ms/packet += 84.04 ms = 0.084 seconds -At t₀ + 1.62 seconds, the last packet will be pushed into the first link. +At t₀ + 0.084 seconds, the last packet will be pushed into the first link. ### e) Time for last packet to arrive at university server @@ -506,16 +506,16 @@ Total end-to-end delay consists of: - Queuing delays: Variable, estimated ~5 ms average per hop Calculation: -- Time for last packet to enter first link: 1.62 s -- Transmission time through all links: ~0.2 ms × 14 = 2.8 ms +- Time for last packet to enter first link: 0.084 s +- Transmission time through all links: ~0.0104 ms × 14 = 0.146 ms - Propagation delay: ~79 ms - Processing delays: 1 ms × 14 = 14 ms - Queuing delays: 5 ms × 14 = 70 ms -Total time = 1.62 s + 0.0028 s + 0.079 s + 0.014 s + 0.070 s -= 1.786 seconds +Total time = 0.084 s + 0.000146 s + 0.079 s + 0.014 s + 0.070 s += 0.247 seconds -The last packet will arrive at the university server at t₀ + 1.79 seconds. +The last packet will arrive at the university server at t₀ + 0.25 seconds. ## 2.2 Propagation Delay and Bandwidth-Delay Product (20%) @@ -531,15 +531,15 @@ Distance estimation using geographic locations: From traceroute analysis and typical routing: -1. Local network: Home → ISP (≈ 5 km) -2. Regional: ISP local → regional (≈ 50 km) -3. Long-haul: Regional → major city hub (≈ 200 km) +1. Local network: Home -> ISP (≈ 5 km) +2. Regional: ISP local -> regional (≈ 50 km) +3. Long-haul: Regional -> major city hub (≈ 200 km) 4. Backbone: Inter-city backbone links (≈ 1,500 km total) 5. University: Final delivery to campus (≈ 20 km) Estimated total distance = 5 + 50 + 200 + 1,500 + 20 = 1,775 km -Total distance ≈ 1,775,000 meters +Total distance ~ 1,775,000 meters ### b) Propagation delay calculation @@ -548,31 +548,39 @@ Given: - Propagation speed: 2 × 10^8 m/s - Total distance: 1,775,000 m +``` Propagation delay (T_prop): -T_prop = distance ÷ speed +T_prop = distance / speed = 1,775,000 m ÷ (2 × 10^8 m/s) = 0.008875 seconds = 8.875 ms +``` -### c) Bandwidth-delay product +### c) Bandwidth-delay -Assuming all links have the same speed R bps: +Assuming all links have the same speed `R` bps: -From our analysis, the bottleneck is likely the residential connection at ~50 Mbps. +From our analysis, the bottleneck is likely the residential connection at 960 Mbps. +``` Bandwidth-delay product: -R × T_prop = 50 × 10^6 bps × 8.875 × 10^-3 s -= 443,750 bits -= 443.75 Kbits +R × T_prop = 960 × 10^6 bps × 8.875 × 10^-3 s += 8,520,000 bits += 8.52 Mbits +``` ### d) Maximum bits in links (continuous transmission) -When sending a file continuously as one big stream, the maximum number of bits in the network links at any given time equals the bandwidth-delay product. +When sending a file continuously as one big stream, the maximum +number of bits in the network links at any given time equals the +bandwidth-delay product. -Maximum bits in links = R × T_prop = 443,750 bits +Maximum bits in links = `R × T_prop` = 8,520,000 bits -This represents the "capacity" of the network pipe - the total number of bits that can be "in flight" between sender and receiver at any moment. +This represents the "capacity" of the network pipe, the total number +of bits that can be "in flight" between sender and receiver at any +moment. ### e) Bandwidth-delay product implications @@ -580,9 +588,9 @@ The bandwidth-delay product represents the network pipe capacity and has several 1. Buffer Requirements: - Minimum buffer size needed for optimal performance - - TCP window size should be at least R × T_prop for maximum throughput + - TCP window size should be at least `R × T_prop` for maximum throughput 2. Network Utilization: - - To fully utilize the available bandwidth, the sender must keep at least R × T_prop bits in the network + - To fully utilize the available bandwidth, the sender must keep at least `R × T_prop` bits in the network - Smaller send windows result in underutilized links 3. Protocol Design: - Determines minimum window size for sliding window protocols @@ -606,32 +614,14 @@ The bandwidth-delay product represents the network pipe capacity and has several ### Apache Proxy Server Implementation -Implementation Steps (Theoretical): - -1. Download and Install Apache HTTP Server - - Download from apache.org - - Configure as reverse proxy using mod_proxy module - - Enable `mod_cache` and `mod_disk_cache` for caching functionality -2. Configuration Setup: - ```apache - LoadModule proxy_module modules/mod_proxy.so - LoadModule proxy_http_module modules/mod_proxy_http.so - LoadModule cache_module modules/mod_cache.so - LoadModule disk_cache_module modules/mod_disk_cache.so - - <VirtualHost :8080> - ProxyPreserveHost On - ProxyRequests Off - CacheRoot /var/cache/apache2/proxy - CacheEnable disk / - CacheDirLevels 2 - CacheDirLength 1 - </VirtualHost> - ``` -3. Device Configuration: - - Configure all home network devices to use proxy (192.168.1.x:8080) - - Set proxy settings in browsers, mobile devices, smart TVs - - Router-level configuration for transparent proxying +I implemented an Apache HTTP proxy server with disk caching capabilities on the home network: + +- Installation: `brew bundle` to install Apache HTTP Server +- Configuration: Forward proxy with disk caching (see `etc/apache/apache.conf`) +- Management: Server startup/shutdown scripts in `bin/server` and `bin/client` +- Network Setup: Server runs on port 8081, family devices configured to use proxy at `192.168.x.x:8081` + +The proxy server enables all family video requests to flow through the cache, providing the foundation for the performance analysis below. ### Performance Analysis @@ -641,21 +631,21 @@ Given parameters: - Average object size: 100 MB = 800 Mb per video - Average request rate: 3 requests/minute = 0.05 requests/second - ISP response time: 5 seconds average -- Home internet connection: ~50 Mbps (from previous analysis) +- Home internet connection: 960 Mbps ### a) Average time (α) for home router to receive video object Transmission time calculation: - Video size: 100 MB = 800 Mb -- Link speed: 50 Mbps (download) -- Transmission time = 800 Mb ÷ 50 Mbps = 16 seconds +- Link speed: 960 Mbps (download) +- Transmission time = 800 Mb ÷ 960 Mbps = 0.833 seconds ``` Total time (α): α = ISP processing time + transmission time -α = 5 seconds + 16 seconds = 21 seconds +α = 5 seconds + 0.833 seconds = 5.833 seconds ``` ### b) Traffic intensity (μ) without caching @@ -663,13 +653,13 @@ Total time (α): Traffic calculation: - Request rate (λ): 6 members × 0.05 req/sec = 0.3 requests/second -- Service time per request: 21 seconds (from part a) -- Service rate (μ): 1/21 = 0.0476 requests/second +- Service time per request: 5.833 seconds (from part a) +- Service rate (μ): 1/5.833 = 0.171 requests/second ``` Traffic intensity (ρ): -ρ = λ/μ = 0.3 ÷ 0.0476 = 6.3 +ρ = λ/μ = 0.3 ÷ 0.171 = 1.75 Note: ρ > 1 indicates system overload - requests arrive faster than they can be served. ``` @@ -677,19 +667,19 @@ Note: ρ > 1 indicates system overload - requests arrive faster than they can be ### c) Average access delay (β) ``` -Given formula: β = α/(μ-1) +Given formula: β = α/(μ-λ) -Since μ = 0.0476 and λ = 0.3: -μ - λ = 0.0476 - 0.3 = -0.2524 +Since μ = 0.171 and λ = 0.3: +μ - λ = 0.171 - 0.3 = -0.129 System is unstable (ρ > 1), so the traditional queuing formula doesn't apply directly. For stable analysis, let's assume the system can buffer requests: -β = 21/(0.0476 - 0.3) = 21/(-0.2524) +β = 5.833/(0.171 - 0.3) = 5.833/(-0.129) = -45.2 seconds Since the result is negative, this indicates queue buildup and system instability. -Corrected interpretation: With ρ = 6.3, average delay approaches infinity due to queue buildup. +Corrected interpretation: With ρ = 1.75, average delay approaches infinity due to queue buildup. ``` ### d) Total average response time with proxy caching @@ -706,32 +696,39 @@ Cache hit scenario: Cache miss scenario: -- Same as no caching: 5 + 16 = 21 seconds +- Same as no caching: 5.833 seconds ``` Average response time: Total response time = (Hit rate × Hit time) + (Miss rate × Miss time) -= (0.5 × 0.1) + (0.5 × 21) -= 0.05 + 10.5 -= 10.55 seconds += (0.5 × 0.1) + (0.5 × 5.833) += 0.05 + 2.917 += 2.967 seconds ``` -With proxy caching, total average response time = 10.55 seconds +With proxy caching, total average response time = 2.97 seconds + +### Summary of Results + +**Assignment Question Answers:** -### Benefits Analysis +- **a) Average time (α)**: 5.833 seconds for home router to receive video object +- **b) Traffic intensity (ρ)**: 1.75 (system overload - requests arrive faster than service) +- **c) Access delay (β)**: System unstable with infinite delays due to ρ > 1 +- **d) Total response time with caching**: 2.97 seconds (50% cache hit rate) -* Without cache: System unstable, infinite delays -* With 50% cache hit rate: 10.55 seconds average response time +**Web Cache Performance Benefits:** -Performance improvement: +The analysis demonstrates the critical importance of web caching in home networks: -- 50% reduction in external bandwidth usage -- Eliminates system instability -- Significant improvement in user experience -- Reduces ISP bandwidth costs +1. **System Stability**: Without caching, the traffic intensity of 1.75 creates an unstable system where requests queue indefinitely +2. **Performance Transformation**: A 50% cache hit rate reduces average response time from infinite to 2.97 seconds +3. **Bandwidth Efficiency**: Caching reduces external bandwidth usage by 50%, alleviating the bottleneck +4. **User Experience**: Family members experience predictable, reasonable response times instead of system overload +5. **Modern Internet Reality**: Even with gigabit internet (960 Mbps), the system is still overloaded due to ISP processing delays and request patterns -Key insight: Even a modest 50% cache hit rate transforms an unstable system into a functional one with reasonable response times. +**Key Insight**: Web caching remains essential even with high-speed internet connections. The bottleneck shifts from pure bandwidth to service capacity and ISP processing time, demonstrating that caching benefits extend beyond just bandwidth limitations. ## 2.4 File Distribution Comparison (10%) |
