Skip to main content

Server-Side LCP Optimization: Tuning HTTP Early Hints, Brotli, and Asset Delivery on Linux VPS

Largest Contentful Paint (LCP) depends on fast server asset delivery. Learn how to configure HTTP 103 Early Hints, Brotli compression, and Nginx preloading on Linux VPS.

Cover image for Server-Side LCP Optimization: Tuning HTTP Early Hints, Brotli, and Asset Delivery on Linux VPS

Largest Contentful Paint (LCP) measures when the main page text or art loads. A slow server adds lag before the browser draws one pixel.

Google uses LCP to rank web sites. The goal is two and a half seconds or less. On cell phones in India, slow network hops add lag. If your host waits to send key files, your site rank drops.

You can fix this lag on a Linux VPS. You do not need bloated code. You need fast headers, small files, and close hosts. This guide shows how to tune your server for top speed.

The four parts of Largest Contentful Paint

An LCP score has four clear parts. Each part adds time to the total wait:

  1. Time to First Byte (TTFB): The wait time for the first byte of HTML.
  2. Resource load delay: The wait time before the browser starts to pull key files.
  3. Resource load duration: The time spent pulling the main file or font.
  4. Element render delay: The time the browser spends to paint the art on screen.

Most teams look only at the fourth part. They shrink art or cut script files. But server lag makes up more than half of the total time.

Request stage Far host (Gzip only) Tuned Indian VPS (Early Hints, Brotli) Time saved
First byte wait 280 ms 45 ms -235 ms
File load delay 220 ms 15 ms -205 ms
File download time 340 ms 110 ms -230 ms
Screen render time 90 ms 60 ms -30 ms
Total LCP score 930 ms 230 ms -700 ms (75% faster)

The tuned stack cuts 700 milliseconds. This jump lifts your site into the top tier.

What is a good LCP score for search rank?

Short answer: Under 2.5 seconds is good, between 2.5 and 4.0 seconds needs work, and over 4.0 seconds is poor.

Google tests real web visits through the Chrome User Experience Report (CrUX). Google looks at the top 75 percent of visits. If one in four phone users waits too long, your site fails.

A slow site hurts your search rank. Fast sites win more clicks and keep users glad.

Real-time AI search bots also test site speed. Bots like OAI-SearchBot and PerplexityBot work on tight clock caps. When a server takes too long to reply, the bot skips to a rival site. A fast host helps AI bots cite your text.

How HTTP 103 Early Hints cuts file wait

Short answer: Early hints tell the browser to pull files while the server builds the page.

Under standard HTTP, a browser waits for the full page header. While your backend runs database queries, the link sits idle.

The RFC 8297 rule gives us a new code: 103 Early Hints.

When a call comes in, Nginx sends a 103 code right away. This quick pack holds Link headers with rel=preload.

Client                          Nginx Server                    PHP / Node Backend
  |                                  |                                  |
  |--- GET /page.html -------------->|                                  |
  |                                  |--- Pass request to backend ----->|
  |<-- 103 Early Hints (preload) ---|                                  |
  |    (Client downloads CSS & font) |                                  |
  |                                  |                                  |
  |                                  |<-- 200 OK + full HTML -----------|
  |<-- 200 OK + full HTML -----------|                                  |

The browser pulls your main CSS sheet and font while the backend works. By the time the HTML code shows up, the styles are on disk. This step cuts file wait down to near zero.

Nginx setup for HTTP 103 Early Hints

You can turn on early hints in Nginx. Add preload headers inside your main site block.

Open your site conf file:

# /etc/nginx/conf.d/webhost24.conf

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name example.com;

    # SSL certificates and parameters
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;

    # Root web path
    root /var/www/html;
    index index.html index.php;

    # Send 103 Early Hints with critical assets
    location / {
        # Preload critical layout stylesheet
        add_header Link "</assets/css/main.min.css>; rel=preload; as=style" always;

        # Preload main heading font
        add_header Link "</assets/fonts/inter-bold.woff2>; rel=preload; as=font; crossorigin" always;

        # Forward dynamic requests to upstream backend
        try_files $uri $uri/ /index.php?$args;
    }

    # Cache static assets on disk with long TTL
    location ~* .(css|js|woff2|webp|avif)$ {
        expires 365d;
        add_header Cache-Control "public, no-transform, immutable";
        access_log off;
    }
}

This block tells the client to pull the style sheet and font right away.

Brotli compression: tiny files on cell networks

File size shapes the pull time. Most hosts still use old Gzip tools. Brotli (RFC 7932) packs text files down much tighter.

For web text files, Brotli brings big gains:

  • CSS files are 15% to 20% smaller than with Gzip.
  • JavaScript files are 12% to 18% smaller than with Gzip.
  • HTML pages are 18% to 25% smaller than with Gzip.

Tiny files load fast over mobile cell masts. This cuts the third part of your LCP score.

Turn on Brotli in Nginx

On an Ubuntu or Debian Linux VPS, install the Brotli tool:

sudo apt update
sudo apt install -y libnginx-mod-http-brotli

Next, add these lines in your /etc/nginx/nginx.conf file:

# Enable Brotli compression inside the http block
brotli on;
brotli_comp_level 6;
brotli_static on;
brotli_types
    text/plain
    text/css
    text/xml
    application/javascript
    application/json
    application/xml
    image/svg+xml;

We set the level to 6. This level brings the best blend of small size and low CPU use. Levels above 7 burn too much chip power on live calls.

The static line sends pre-packed files with a .br tag straight off the disk. This saves chip work on busy servers.

Linux kernel socket tuning for fast file transit

The Linux kernel networking stack sets how packs leave the card. Stock rules pick low RAM use over top speed.

You can tune socket buffers to flush large web files in fewer round trips.

Add these lines to /etc/sysctl.d/99-web-tuning.conf:

# Do not drop TCP window size after idle connections
net.ipv4.tcp_slow_start_after_idle = 0

# Enable TCP Fast Open for client connections
net.ipv4.tcp_fastopen = 3

# Enlarge network socket read and write buffers
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216

# Increase network backlog queue for burst traffic
net.core.netdev_max_backlog = 10000
net.core.somaxconn = 8192

Load the new rules without a reboot:

sudo sysctl --system

Turning off slow start stops the server from dropping speed after short stops. This keeps data flow high when pulling linked files.

Step-by-step test guide

After you save your files, run tests to check each tool. Use stock shell tools.

1. Test Early Hints and HTTP headers

Run curl on your domain:

curl -I -X HEAD https://example.com/

Look at the shell output. You will see Link lines with rel=preload tags:

HTTP/2 200
server: nginx
content-type: text/html; charset=UTF-8
link: </assets/css/main.min.css>; rel=preload; as=style
link: </assets/fonts/inter-bold.woff2>; rel=preload; as=font; crossorigin
cache-control: max-age=3600, public

2. Check Brotli output

Pull your main style sheet with Brotli turned on:

curl -s -I -H "Accept-Encoding: br" https://example.com/assets/css/main.min.css

Look for the encoding line:

content-encoding: br

If you see br, Brotli works fine.

3. Check TCP Fast Open status

Check that your Linux kernel took the socket rule:

sysctl net.ipv4.tcp_fastopen

The shell will print net.ipv4.tcp_fastopen = 3.

Common questions

Does a CDN replace server tuning?

Short answer: No, a CDN only caches static hits, while the origin handles dynamic content.

When an edge node misses, the call hits your origin server. If your server is slow, the guest waits. Search bots and signed-in users also bypass edge caches. A fast origin server shields your site in all cases.

Can I preload art with 103 Early Hints?

Short answer: Yes, you can preload the main hero image using a Link header.

Add this line inside your Nginx block:

add_header Link "</images/hero.webp>; rel=preload; as=image" always;

Preload only the single main hero art piece above the fold. Preloading too many files eats phone data and slows down your page.

Why pick Brotli over Gzip for web fonts?

Short answer: Web fonts use built-in packing, but text files gain big size drops.

Files like WOFF2 have built-in packing. But your CSS style files and HTML text files gain a 20% size cut with Brotli. Smaller files reach the phone fast.

How does a host in India lift LCP for Indian users?

Short answer: A host near your guests cuts line lag.

Light through glass takes time. A server in the west adds 150 milliseconds of lag to each round trip. A local host in India cuts this wait to under 25 milliseconds. This drop lifts LCP on cell phones across India.

Does LCP sway ranks in AI search engines?

Short answer: Yes, AI search bots reward low latency with higher citation rates.

AI bots pull web text in real time. If a page takes three seconds to load, the bot times out. A fast host makes sure bots read and cite your text.

Next steps for your setup

Fast web speed starts with smart server rules. When you pair 103 Early Hints with Brotli and kernel tuning, you cut lag from each visit.

To learn more about response speed, read our guide on server-side TTFB optimization. For dynamic web apps, read our tips on server-side INP optimization. You can also learn how fast NVMe storage avoids disk wait times.

If you want fast web hosts in India, check our VPS hosting plans. We offer month-to-month terms with a 30 days money-back guarantee and 7-day backup retention. You can text our team on WhatsApp or visit our contact page to chat today.

Written by

Renish Mithani

Hosted in India, written in English

  • 10 min read

Share this post

Need help?

Talk to sales on WhatsApp

Our team replies during Indian business hours. Tell us which plan you're looking at and we'll match you with the right setup.

Cookie Preferences