Contents (18)
- [Blog Intro] Global Blog Performance Optimization — Network & App Layer
- What Makes Global Performance Optimization Different?
- Problem Definition & Solutions
- Diagnosing & Fixing the Network Layer
- Issue 1. Overseas DNS Lookups
- Issue 2. Short Cache Expiration Time
- Issue 3. Next.js Proxy Matcher & Dynamic Handling of Static Files
- Issue 4. Separating the Image CDN & Migrating GCS -> Cloudflare R2
- Diagnosing & Fixing the Application Layer
- Issue 1. Client-Side Mermaid Rendering in Posts
- Issue 2. Responsive Images Inside Posts
- Issue 3. Duplicate Inline CSS in HTML & RSC
- Issue 4. Heavy Initial JS Dependencies (Radix, Recharts, Sentry, GA)
- Issue 5. Prefetch Flood Matching Every Link on the Page
- Final Before & After Comparison
- Real-World Limitations Encountered
- Final Network & Caching Architecture (Before / After)
- Closing Thoughts
[Blog Intro] Global Blog Performance Optimization — Network & App Layer
This post was written 30% by AI and 70% by a human.
In my previous post, I added multi-language support for Korean, English (en), Japanese (ja), and Simplified Chinese (zh-CN). This time, I want to share how I optimized web performance for a truly global audience.
My first performance optimization attempt (over a year ago) | After this global performance optimization |
|---|---|
![]() | ![]() |
It has been over a year since I first wrote about performance optimization. Back then, the blog was Korean-only, yet I insisted on benchmarking it on overseas low-end mobile environments to see how much it improved (left image).
Honestly, for a Korea-only site, measuring overseas performance without a real reason was pretty silly—I was basically shadowboxing a problem that didn't exist.
And if you asked whether I actually did overseas optimization well back then, the answer is no—I was tunnel-visioned on FCP and LCP and missed the bigger picture. Now that the blog is genuinely open to global readers, I had clear goals and concrete bottlenecks to solve (right image). If you have ever benchmarked overseas mobile performance on debugbear.com, you know how hard it is to get numbers like that! Nice!
What Makes Global Performance Optimization Different?
When you only serve users in Korea, performance metrics usually look great out of the box. Most infrastructure lives in Korean regions, so network latency is tiny and everything else looks good by extension.
Global services are a completely different story. You need to understand the entire path that static assets and server responses travel to reach users around the world before you can optimize effectively.
So I split this optimization clearly into two layers:
Network layer: Redesign the routing path so responses are served as close to the user as possible from anywhere in the world.
App layer: Accept that overseas users often have slower networks (
3G) and lower-end devices than Korea, and make the app send less and execute less even under heavy CPU throttling.
In this post, I document how I cross-measured desktop, mobile, and global performance using Globalping (US, Germany, Japan, South Korea), PageSpeed Insights, and DebugBear (7 global regions, mobile & desktop) to push performance up across the board.
Problem Definition & Solutions
First, here is a summary of what the problems were, how I solved them, and what impact they had.
Built around domestic servers, causing both network latency and browser main-thread overhead on lower-end devices.
Network / Infrastructure
Slow overseas DNS queries (over 1s)
High TTFB (2–6s+)
Overseas users hitting a Seoul Nginx CDN
Application Code
Duplicate
inlineCsspayload deliveryShipping a heavy client-side Mermaid renderer
Shipping
framer-motionLarge initial JS bundle
Excessive Next.js link prefetches
Stop making data travel around the globe.
Move work to static/SSR rendering wherever possible.
Keep the browser's main thread light.
Shrink every resource as much as possible.
Network / Infrastructure
Migrated Gabia DNS => Cloudflare DNS
Migrated GCS => Cloudflare R2
Separated static asset domain from backend
api.yooncarrot.com/static =>
cdn.yooncarrot.com/
Application Code
Moved Mermaid rendering to SSR
Removed
framer-motionReplaced Radix on home with lightweight components
Deferred loading of Sentry, GA, etc.
Disabled unnecessary prefetches
Reduced global network latency, browser main-thread load, and infrastructure costs.
Network / Infrastructure
Global edge-cached images via R2
Code Optimization
Home HTML
66KB → 26~28KB(-58%)Initial JS
890KB → 264KB(-70%)Initial
_rscprefetches0
Let's walk through each of these improvements one by one.
Diagnosing & Fixing the Network Layer
First, I measured how fast—or slow—the blog actually felt from overseas regions.
Metric | Before Optimization | Bottleneck Layer |
|---|---|---|
Overseas DNS lookup ( |
| Network (domestic-only DNS) |
Home HTML TTFB ( | US | Network (short ISR expiration) |
Image Cold | DE | Network (single Seoul VM hop) |
Issue 1. Overseas DNS Lookups
Because I was still using my Korean domain registrar's (Gabia) nameservers, just resolving the domain from overseas took 200~480ms (and occasionally up to 1,072ms). Simply moving nameservers to Cloudflare Free DNS stabilized DNS lookups across all four countries to 9~115ms. I honestly never imagined DNS alone could slow things down that much.
Issue 2. Short Cache Expiration Time
Region (Vercel Edge) |
| Response / Target | Cold TTFB (Before) | Cold TTFB (After) |
|---|---|---|---|---|
US ( |
|
|
|
|
Germany ( |
|
|
|
|
Japan ( |
|
|
|
|
South Korea ( |
|
|
|
|
The cache expire time was set to 3,600 seconds—the same as revalidate. If nobody visited for an hour, the cache expired completely, forcing the next overseas visitor to stare at a blank screen until the Vercel → Seoul Spring API round trip finished. Extending expire to 7 days fixed this dramatically.
Issue 3. Next.js Proxy Matcher & Dynamic Handling of Static Files
In Tokyo (hnd1), static JS under /_next/static took only 15~19ms, yet /favicon.ico took 607ms (and 1,015ms in Singapore). The reason was that proxy.ts's matcher intercepted root static files too and only passed them through inside the function.
By excluding [^/]+\.[^/]+$ and \.well-known directly in the matcher regex, files like /favicon.ico, /sw.js, /robots.txt, and /sitemap.xml completely bypass the middleware. Tokyo's /favicon.ico HIT latency dropped from 607ms → 32ms (19x faster).
Without middleware, the request only travels [User -> Vercel CDN Edge]. With middleware, it goes through [User -> Vercel Edge -> Proxy Middleware -> Static File Resolution], adding massive overhead.
Issue 4. Separating the Image CDN & Migrating GCS -> Cloudflare R2
Domain separation (
cdn.yooncarrot.com)I separated the file server domain from api.yooncarrot.com/static to cdn.yooncarrot.com so static assets hit Cloudflare CDN directly without routing through the Seoul backend server.
Migrating GCS → Cloudflare R2 (
yooncarrot-storage)I copied existing GCS objects into R2 using Cloudflare Super Slurper and connected
cdn.yooncarrot.comdirectly as an R2 Custom Domain, unlocking Cloudflare's global CDN edge.
Country | Pre-R2 Cold | Post-R2 | Cold | Post-R2 Edge |
|---|---|---|---|---|
Germany ( |
|
| -77.2% (4.4x faster) |
|
US ( |
|
| -63.1% (LA -70.2%) |
|
Japan ( |
|
| -69.4% |
|
South Korea ( |
|
| +54ms (first request only) |
|
Diagnosing & Fixing the Application Layer
No matter how much you trim network latency, the site still feels sluggish if HTML is bloated or the browser's main thread is tied up running JS and forced reflows. In the app layer, I focused on moving server-capable work to the server and stripping out duplication, waste, forced reflows, and unnecessary client dependencies.
Metric | Before Optimization | Bottleneck Layer |
|---|---|---|
Home HTML / Initial JS transfer | HTML | App ( |
Post runtime / Image waste | Forced Reflow | App ( |
Issue 1. Client-Side Mermaid Rendering in Posts
Previously, the user's browser converted Mermaid code into diagrams on the client. That caused layout reflows, hurt CLS, and forced the browser to download a hefty client-side Mermaid bundle.
So I moved Mermaid rendering to SSR using the beautiful-mermaid library so diagrams are pre-rendered and cached on the server. Users no longer need to render Mermaid in the browser, and eliminating the DOM mutation eliminated the reflow too.
Issue 2. Responsive Images Inside Posts
Blog posts contain user-uploaded images rather than static images hardcoded in VS Code, so I hadn't originally thought to make them responsive (even though the home page already used responsive images). That dragged down Lighthouse performance scores.
Then I realized I could inject srcset (640/828/1080/1200) and sizes onto every <img> tag during SSR so Next.js serves properly sized images. After applying this, image transfer size dropped from 618 KiB → 13 KiB (-98%).
Issue 3. Duplicate Inline CSS in HTML & RSC
Earlier, I had turned on experimental.inlineCss: true thinking it would reduce CSS requests.
When I inspected the deployed HTML, however, over 175KB of global CSS was being embedded twice—once inside <style> and again inside Next.js's RSC stream (__next_f). Worse, because it was inlined into HTML, browsers couldn't cache it and re-downloaded it on every page visit.
Switching to inlineCss: false restored external CSS caching, and excluding unused component paths in globals.css trimmed 31.7KB of CSS itself.
As a result, home HTML shrank by more than half: 66KB → 26~28KB (-58%, -64% uncompressed).
Issue 4. Heavy Initial JS Dependencies (Radix, Recharts, Sentry, GA)
Even though the home page is basically a simple post list, it was shipping 890KB of initial JS. Inspecting the production chunks showed that the bottom-of-page statistics chart (Recharts), theme modal, and Sentry/GA were all loading upfront—and even the Avatar menu was pulling in @radix-ui/react-dropdown-menu, adding 39KB compressed on its own.
So I deferred everything not immediately needed: Recharts loads via IntersectionObserver when scrolled into view, the theme modal loads on click, and Sentry and GA/GTM wait until the first user interaction.
The home page now ships 0 Radix chunks, and initial JS dropped from 890KB → 263.8KB (-70%).
Issue 5. Prefetch Flood Matching Every Link on the Page
Next.js's <Link> defaults to prefetching any linked route that enters the viewport. Simply landing on the home page or an article triggered 5 _rsc requests on home and over 30 on article pages for links the user hadn't even hovered.
Adding prefetch={false} to header, list, category, footer, and tag links brought initial _rsc prefetches down to 0 everywhere.
Some might ask, "Why give up one of Next.js's perks? At least prefetch on hover!"—and that is certainly a fair follow-up option.
Payload Metric | Before | Final (Stage 10) | Change |
|---|---|---|---|
Home HTML size (transferred / uncompressed) |
|
| -58% / -64% |
Home initial JS / Total transfer (desktop) |
|
| -70% / -65% |
Initial | 5 on home · 30+ on post / 3 Radix chunks |
| Completely eliminated |
Article page ( |
|
| -55~58% |
Final Before & After Comparison
Here are the results across all 4 Lighthouse categories (Performance, Accessibility, Best Practices, SEO), measured over 2 pages (home, post) × 2 locales (ko, en) × 2 devices (mobile, desktop) × 3 runs each.
Target Page [Device] | Before | After | FCP / LCP (median) | TBT / CLS | Total / JS |
|---|---|---|---|---|---|
| 85 (TBT |
|
|
|
|
| 79 (CLS |
|
|
|
|
| 79 (TBT |
|
|
|
|
| 68 (LCP |
|
|
|
|
| 78 (TBT |
|
|
|
|
| 67 (TBT |
|
|
|
|
| 73 (TBT |
|
|
|
|
| 67 (TBT |
|
|
|
|
And below is a summary of the debugbear.com global results shown at the top.
Test Region | Mobile (P / A / BP / SEO) | Desktop (P / A / BP / SEO) |
|---|---|---|
Germany |
|
|
Japan |
|
|
South Africa |
|
|
South Korea |
|
|
Brazil |
|
|
Taiwan |
|
|
US East |
|
|
Overall Average (14 runs) | Perf | All regions |
Real-World Limitations Encountered
Previously, both the GCP VM and GCS lived in the Seoul region, so Korean visitors actually had a slightly snappier first-hit experience.
With Cloudflare R2, APAC storage typically sits near Tokyo or Singapore, and under heavy traffic on the free plan requests can even route via Tokyo or LA edges—meaning Korea can occasionally be slower (taking a detour around the globe instead of right next door!).
Google PSI Mobile hit 100, and DebugBear scored 90+ across Germany (95), Japan (94), South Africa (94), South Korea (93), and Brazil (90).
However, on DebugBear US-East Mobile—which has the harshest CPU throttling—even maximum optimization topped out at 76. Pushing ultra-low-end mobile devices any further likely isn't feasible without dropping React/Next.js altogether.
Setting inlineCss: false shrank all HTML by 58% and enabled 0ms cached CSS on repeat visits, at the cost of 1 extra RTT for the external stylesheet on a cold first visit.
Also, synthetic scores (PSI and DebugBear) are simulations and can differ from what real overseas visitors experience.
That's why collecting Real User Monitoring (RUM) data via GA4 Web Vitals and Vercel Speed Insights is crucial to spot real bottlenecks.
Final Network & Caching Architecture (Before / After)
flowchart LR
User["Global User (US / DE / JP)"] -->|"77-1072ms"| DNS["Gabia DNS"]
DNS -->|"yooncarrot.com"| Vercel["Vercel Edge (ISR 1h / inlineCss)"]
Vercel -->|"REVALIDATED 2.2-6.1s"| Origin["Seoul GCP VM (Spring + Caddy)"]
DNS -->|"api.yooncarrot.com/static (DE MISS 1.5s)"| Origin
Origin --> GCS[("GCS Seoul")]
Vercel -->|"66KB HTML + 890KB JS"| ClientJS["Heavy JS (mermaid + framer + Radix)"]Network and app rendering bottlenecks before optimization
flowchart LR
User["Global User (US / DE / JP)"] -->|"9-115ms"| DNS["Cloudflare DNS"]
DNS -->|"yooncarrot.com"| Vercel["Vercel Edge (ISR 1h/7d / Static Bypass)"]
Vercel -->|"28KB HTML + SSR + srcset"| ClientJS["Slim JS (264KB / Zero Radix / Reflow<br/>0ms)"]
DNS -->|"cdn.yooncarrot.com (HIT 37-146ms)"| CF["Cloudflare Edge (31d Cache)"]
CF -->|"Cold MISS (DE 346ms / US 246ms)"| R2[("Cloudflare R2")]Global edge, direct R2 delivery, and slimmed app architecture after optimization
Closing Thoughts
This was actually my first time doing full-scale performance optimization for a global environment. I learned that delivering a great web experience requires understanding everything end-to-end, from frontend code to networking.
I also realized how important it is to be clear about why you are optimizing. Chasing high scores for their own sake isn't the point—you optimize because there is a real need (which I think is an essential mindset for any developer, not just for performance work).
In short, meaningful performance improvement requires optimizing both layers together:
Network / infrastructure layer: keep user requests from traveling halfway around the planet, and
App layer: properly optimize APIs and client resources.
Of course, digging deeper on the frontend brings even more topics like parallel processing, avoiding main-thread blocking, and optimizing React's lifecycle.
Today I focused on the changes that mattered most for a global audience. Even with AI helping, writing this post took ages because there was so much to trim down. 🥲
Wishing everyone the best in this great era of AI!


