Boost Large-Scale Website Performance: Key Paths, Caching, and Metrics Explained

This article examines website performance by breaking down the user request journey into three paths—client, network, and server—offering practical optimization techniques such as DNS prefetch, caching strategies, CDN deployment, and outlining essential metrics like response time, concurrency, and throughput.

21CTO
21CTO
21CTO
Boost Large-Scale Website Performance: Key Paths, Caching, and Metrics Explained

This article discusses performance as a crucial factor for large websites.

What is performance

Performance is the speed of page load from the moment a user enters a URL to when the page is displayed, reflecting the user's real experience.

The full user access flow: the user inputs the domain, DNS resolves it to an IP, the request travels over the Internet to the target server, the server processes the request (executing programs, accessing databases or files), and the response is sent back through the Internet to the browser, which renders it for the user.

The first segment is on the client and browser side, handling the request issuance and rendering of the response.

The second segment is the network, responsible for transmitting request and response data.

The third segment is on the server side, processing the request and returning results.

First Path

This path includes the time spent entering the domain, sending the request, and the browser’s rendering time.

Steps:

User types the website domain in the browser.

Local DNS queries the authoritative DNS server, obtains the IP address, and caches it.

The request is sent to the target IP address.

Optimization focuses on reducing DNS lookups; browsers often cache DNS results, and modern browsers enable DNS prefetch by default. You can explicitly enable it with:

<meta http-equiv="x-dns-prefetch-control" content="on" />

Browser rendering steps:

Parse the response data.

Create the DOM tree.

Download CSS, apply it to the DOM, and render.

Download JavaScript files, parse and execute them.

Display the final result to the user.

Optimization suggestions include minimizing page size, merging and compressing CSS/JS files, placing CSS before JS so the page renders quickly, and enabling browser caching:

<meta http-equiv="Cache-Control" content="max-age=5" />

Example JD Mall HTML layout:

CSS is placed before the HTML and merged.

Most JavaScript files are placed at the page footer.

Second Path

This path covers network transmission time, which depends on bandwidth. Bandwidth (e.g., 20 M) defines upload and download speeds; 20 M translates to about 2.5 MB/s download. Users typically have faster download than upload speeds, while servers often have symmetric speeds.

The flow is: user uploads request data, server downloads it, server uploads the response, and the user downloads the response. Because request data is small and response data is large, server upload speed can become a bottleneck.

Improving network performance can involve:

Deploying servers in Internet Data Centers (IDCs) near major ISP backbones.

Purchasing proxy services to shorten routing paths.

Using CDN services to cache content close to users.

Third Path

This path involves server‑side processing such as program execution, file access, and database queries.

Key optimization areas:

Use caching (local or distributed).

Employ asynchronous operations.

Optimize code.

Optimize storage.

Cache

For small caches, OSCache can provide local caching:

For larger caches, Memcached offers distributed caching:

Memcached servers are independent, allowing easy scaling by adding more nodes.

Asynchronous Operations

Synchronous requests can overload databases under high concurrency, while asynchronous requests quickly acknowledge users and defer database work to a message queue, as seen in ticketing systems where ticket issuance is processed asynchronously.

Code Optimization

Further details are covered in another article about writing high‑quality Java code.

Storage Optimization

Massive read/write workloads stress disks; consider RAID or distributed storage solutions to improve I/O performance.

Performance Metrics and Testing

Key metrics include:

Response time : time from request issuance to receiving the response.

Concurrency : number of simultaneous requests the system can handle.

Throughput : number of requests processed per unit time.

An analogy using a toll station helps illustrate these concepts.

Performance testing revolves around these metrics; the diagram below shows the testing process:

The left chart plots response time against concurrent users, showing three regions: normal operation, peak load, and overload where response time spikes dramatically. The right chart plots throughput versus concurrency, illustrating increasing throughput up to a saturation point, after which throughput declines as the system becomes overloaded.

Conclusion

The article analyzes the three paths of a user’s website visit, proposes optimization techniques for each, introduces performance metrics, and briefly outlines performance testing.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Backendperformancemetricsnetworkcaching
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.