Course contentsShow
← Software Engineering
Lesson 1206 of 1,93336. Performance EngineeringFree lesson

Measuring Response Time

Techniques for accurately measuring response time, including client-side, server-side, and end-to-end timing.

Measuring Response Time

You'll learn how to accurately capture response time from different vantage points in your system.

Why Measurement Location Matters

Response time isn't a single number—it depends on where you measure. Think of ordering food delivery: the restaurant's clock shows when they handed the order to the driver, but your clock shows when it arrived at your door. Both measurements are valid, but they capture different parts of the journey.

Client-Side Timing

Measuring from the client captures the complete user experience, including network round-trip, server processing, and rendering. In web applications, this means using browser APIs to measure from when the request leaves the browser until the response is fully received. This is what your users actually experience.

const startTime = performance.now();
// make request
fetch('/api/data').then(response => {
  const endTime = performance.now();
  const responseTime = endTime - startTime;
});

Server-Side Timing

Server-side measurements capture only the processing time within your application—how long your code takes to generate a response. This excludes network latency but gives you precise control over what you're measuring. Useful for identifying performance issues in your business logic.

End-to-End Timing

End-to-end timing measures the full journey across distributed systems—from initial request through multiple services back to the origin. This often requires trace IDs to correlate requests across service boundaries, letting you see the complete picture including database calls, external API requests, and inter-service communication.

Choose Your Perspective

Each measurement point reveals different insights. Client-side shows user impact, server-side isolates your code's performance, and end-to-end exposes systemic bottlenecks. Measure from multiple points to understand where latency actually occurs.

Key Takeaway: Accurate response time measurement requires choosing the right measurement point—client-side for user experience, server-side for application performance, and end-to-end for distributed system visibility.