🎓 BookMCQ
← Back to 27. Network Management

📝 Performance management in networking (10 MCQs)

Measuring Network Efficiency and Service Quality

Performance management measures how effectively network resources deliver communication services. Administrators examine traffic rates, interface utilization, packet loss, response time, delay variation and device load to determine whether equipment meets operational requirements. Measurements reveal congestion, bottlenecks and capacity trends, allowing teams to adjust resources before users experience persistent service degradation. Results can be compared with service objectives and historical baselines.

Traffic Counters, Rates and Delay Indicators

Monitoring systems collect interface counters, traffic samples, CPU and memory use, and application response measurements. A baseline describes normal behavior over a representative period, while thresholds identify values that deserve investigation. Counters must be interpreted with their units and collection intervals because a raw byte total is not itself a throughput rate.

Collecting Baselines and Comparing Performance

A monitoring system samples interface counters at regular intervals and calculates the difference between successive readings. Dividing transferred bits by elapsed seconds gives an average bit rate for that interval. Operators compare this rate and other indicators with baselines, identify sustained deviations, and investigate the devices, links or applications contributing to the change.

Example: Identifying a Congested Network Link

A 100 Mb/s link carries 80 Mb during a one-second measurement interval, giving an average utilization of 80 percent. If utilization remains high while packet loss and response delay rise, the link may be congested. The operator checks traffic sources and neighboring links before deciding whether traffic shaping or additional capacity is appropriate.

Capacity Planning from Long-Term Measurements

Performance information supports service-level reporting, capacity planning and troubleshooting. Fault management uses it to detect deteriorating links, while configuration management may adjust queue settings or routes. Application performance also depends on server processing and transport behavior, so a slow user request should not automatically be blamed on the network path.

Separating Throughput, Delay and Packet Loss

'Bandwidth equals actual throughput' is incorrect because protocol overhead and congestion reduce delivered rate. 'Latency and jitter are identical' is false; latency is delay, while jitter describes variation in delay. 'High utilization always means failure' is mistaken because busy links may operate normally until loss, delay or service targets become unacceptable.

Performance Metrics and Interpretation in Exams

Be able to calculate average throughput from transferred bits and elapsed time, interpret utilization percentages, and distinguish packet loss, latency and jitter. Readings should be compared over consistent intervals and against an appropriate baseline. Scenario questions may ask whether evidence indicates congestion, a server bottleneck or a measurement problem. Calculations should retain units and use matching sampling intervals.

Network Performance Measurement Terms

  • Throughput - Successfully delivered data per unit time.
  • Utilization - The proportion of link capacity in use.
  • Latency - Time taken for data to travel.
  • Jitter - Variation in packet delay.
  • Packet loss - Packets that fail to reach destination.
  • Baseline - Reference values for normal performance.
3
Easy
4
Medium
3
Hard

📝 All Performance management in networking MCQs

Q1. In the echo server code, when the call to recv(s,ptr,maxLen,0)\text{recv}(s, ptr, maxLen, 0) returns 0, what is the most likely outcome for the current client connection?

A.A) The server will retry the receive operation indefinitely.
B.B) The server will immediately close the socket and exit the loop.
C.C) The while loop terminates, and the server proceeds to send the accumulated data back to the client. ✅
D.D) An error is raised and the program terminates.
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: When recv\text{recv} returns 0 it signals an orderly shutdown by the peer. The while condition (n=recv(...))>0(n = \text{recv}(...)) > 0 becomes false, so the loop ends. Control then reaches the send statement, which transmits whatever data has been collected, and finally the socket is closed. No error is generated, and the server does not retry.

Q2. If the pointer ptrptr is advanced by nn bytes after each successful recv, what would be the consequence of forgetting to also decrement maxLenmaxLen by nn?

A.A) Subsequent recv calls could write beyond the allocated buffer, causing memory corruption. ✅
B.B) The server would stop receiving data after the first packet.
C.C) The pointer would reset to the start of the buffer automatically.
D.D) The send operation would fail because len would be inaccurate.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: If ptrptr is advanced by nn bytes but maxLenmaxLen is not reduced, the subsequent call to recv\text{recv} will still think the full original buffer size is available. Consequently, data may be written past the end of the allocated memory region, corrupting adjacent variables or causing a segmentation fault. Properly decrementing maxLenmaxLen keeps the receive operation within safe bounds.

Q3. Suppose the server never resets the variable lenlen to zero before handling a new client connection. How would this affect performance over time?

A.A) Each client would receive only the data from the previous client.
B.B) The server would eventually run out of memory due to unbounded growth of len.
C.C) The send call would transmit an ever‑increasing amount of data, degrading throughput. ✅
D.D) No observable effect; len is only used locally.
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Leaving lenlen unchanged means each new client inherits the total byte count from previous sessions. The subsequent `send(s, buffer, len, 0)` will therefore transmit an ever‑growing payload, many of which are stale data. This unnecessary traffic consumes bandwidth, increases latency, and ultimately lowers overall throughput as the server spends more time sending irrelevant bytes.

Q4. Compare using an infinite for loop `for(;;)` versus `while(1)` for the server's main loop in terms of readability and maintainability.

A.A) `while(1)` is more explicit about looping forever, while `for(;;)` is cryptic. ✅
B.B) `for(;;)` allows easy insertion of initialization and increment expressions, making it more flexible.
C.C) Both constructs are functionally identical; the choice does not affect performance.
D.D) `while(1)` consumes more CPU cycles than `for(;;)`.
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: `for(;;)` and `while(1)` both create an infinite loop with identical compiled code, so performance is unchanged. However, `while(1)` explicitly states the intention to loop forever, making the logic clearer to readers unfamiliar with the C idiom. Clearer code reduces maintenance errors and speeds up onboarding of new developers.

Q5. Evaluate the impact of using non‑blocking sockets versus blocking sockets on server throughput.

A.A) Non‑blocking sockets always increase throughput because they avoid waiting.
B.B) Blocking sockets simplify code but can cause the server to idle while waiting for data, reducing throughput under high concurrency. ✅
C.C) Non‑blocking sockets guarantee order of message delivery, improving performance.
D.D) Blocking sockets use less CPU cycles but increase latency, which always improves throughput.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Blocking sockets cause the thread to pause until data arrives, which can lead to idle CPU time when many connections are waiting, reducing aggregate throughput under load. Non‑blocking sockets allow the server to continue processing other tasks or connections while a particular socket has no data, improving concurrency and overall data‑transfer rates, though they add complexity.

Q6. Differentiate between handling each client sequentially in the same process versus spawning a new thread per client, focusing on CPU utilization and scalability.

A.A) Thread‑per‑client scales linearly with number of clients but incurs context‑switch overhead; sequential handling limits concurrency but uses minimal resources. ✅
B.B) Sequential handling provides better scalability because it avoids thread creation costs.
C.C) Thread‑per‑client always results in lower CPU usage than sequential handling.
D.D) Both approaches have identical performance characteristics on modern OSes.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: A sequential design handles one client at a time, limiting concurrency but using minimal memory and avoiding context switches. Spawning a thread per client enables true parallel handling, improving responsiveness as multiple clients can be served simultaneously; however, each thread incurs scheduling and stack overhead, and excessive threads may degrade performance due to contention. The trade‑off hinges on expected client count and system resources.

Q7. Apply the principle of resource cleanup: why must the server call `close(s)` after sending the echo?

A.A) To flush the output buffer so the client receives data immediately.
B.B) To release the underlying file descriptor, preventing descriptor leaks that could exhaust system resources. ✅
C.C) To reset the pointer `ptr` for the next client.
D.D) To signal the operating system to terminate the process.
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Calling `close(s)` releases the file descriptor associated with the client socket back to the operating system. If descriptors are not closed, the process eventually exhausts the limited descriptor table, leading to failure in accepting new connections. Proper cleanup also signals the kernel to reclaim associated buffers, preventing memory leaks and ensuring stable long‑term operation.

Q8. Explain the relationship between the variable `maxLen` and the allocated buffer size; how could an incorrect update to `maxLen` lead to a buffer overflow?

A.A) `maxLen` represents the total bytes already received, so decreasing it reduces risk of overflow.
B.B) `maxLen` tracks remaining space; if it is not decreased after each recv, subsequent recv may write past the buffer boundary, corrupting memory. ✅
C.C) `maxLen` is unrelated to buffer size; it only affects the send length.
D.D) Updating `maxLen` incorrectly has no impact because recv always checks actual buffer size.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: `maxLen` is intended to represent the remaining capacity of the receive buffer. After each successful `recv`, the code should subtract the number of bytes received (`n`) from `maxLen`. Failing to do so leaves `maxLen` larger than the actual free space, so a subsequent `recv` may write beyond the allocated buffer, corrupting memory and potentially causing crashes.

Q9. Synthesize an improvement to the given echo server that would allow it to handle multiple clients concurrently while preserving high performance. Which combination best achieves this goal?

A.A) Replace the infinite loop with an event‑driven architecture using `select`/`poll` and make the socket non‑blocking, allowing a single thread to manage many connections efficiently.
B.B) Insert a `fork()` call after accepting each client, letting the child process handle the echo while the parent returns to accept new connections.
C.C) Use a thread pool where each accepted socket is handed to a worker thread, reducing thread‑creation overhead and keeping latency low. ✅
D.D) All of the above approaches are equally effective for concurrent handling.
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Using a thread pool provides a balanced solution: a limited number of pre‑created worker threads receive accepted sockets and process the echo logic, avoiding the overhead of creating a thread for every connection while still allowing concurrent handling. This approach keeps latency low, maximizes CPU utilization, and simplifies resource management compared to creating a new thread per client or managing a fully event‑driven loop.

Q10. According to the code excerpt, which line number creates the listening socket with the `socket()` system call?

A.A) Line 18
B.B) Line 23 ✅
C.C) Line 27
D.D) Line 42
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The excerpt states that lines 23 to 27 are responsible for creating the listen socket. In typical socket code, the `socket()` system call appears early in that block, usually on line 23, establishing the file descriptor that will later be bound and set to listen. Therefore, line 23 is the line that creates the listening socket.

🔗 Related Topics (MCQs)