惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
B
Blog
Jina AI
Jina AI
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
美团技术团队
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
The Cloudflare Blog
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
小众软件
小众软件
罗磊的独立博客
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
I
InfoQ
GbyAI
GbyAI
腾讯CDC
MongoDB | Blog
MongoDB | Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Legacy .NET 4.8.1 on AWS: When Fargate Abstractions Meet ...
Aleh Karachu · 2026-05-13 · via DEV Community

"Premature optimization is the root of all evil." However, in cloud migrations, the abstraction of resources often hides the physical limitations of the underlying hardware. For latency-sensitive legacy runtimes, these abstractions can become a performance bottleneck.

This post analyzes a migration of a legacy .NET Framework 4.8.1 monolith from standalone EC2 instances to Windows Containers on AWS ECS, where the choice of Fargate led to a 10x performance degradation.


1. The Context: Infrastructure Modernization

The primary goal was to achieve centralized deployment and orchestration using AWS ECS.

  • The Constraints: A migration to .NET 6+ was rejected due to cost and time constraints. The mandate was to containerize the existing .NET 4.8.1 codebase "as-is."
  • The Path: Migration from legacy EC2 setups to Windows Containers on ECS Fargate.
  • The Stack: .NET 4.8.1, Razor Pages, Windows Server Core images.

2. The Symptom: Consistent 20-Second Latency

Post-migration, page rendering latency spiked to 20 seconds. This was not a cold-start issue; the delay remained constant across all requests in a steady state.

The Metrics Trap:
CloudWatch (Monitoring Details) showed a stable CPU Utilization plateau at ~30%. Increasing the task size to 4 vCPUs provided zero improvement. The response time remained static, while the total CPU Utilization metric dropped proportionally, creating a false impression of idle capacity.

This is a classic case where average is the enemy of understanding. The aggregate metric created a false impression of idle capacity, masking the reality of the execution thread.


3. Investigation: Eliminating Secondary Bottlenecks

Before attributing the latency to CPU frequency, we ruled out other infrastructure constraints:

  • Storage I/O: Legacy Razor engines read a large number of .cshtml files during execution. We verified storage throughput and ephemeral disk metrics to ensure we weren't hitting limits on ephemeral storage, which could cause "stuttering" during file access.
  • Network Latency: Using netstat and monitoring Time to First Byte (TTFB) for backend calls, we confirmed that the 20s delay was happening strictly during the internal rendering phase, not during database communication or network negotiation.
  • Thread Saturation: Per-process performance counters showed one worker thread pinned at 100% CPU while the total container utilization remained low.

4. Root Cause: Abstraction Mismatch

The bottleneck resulted from an architectural mismatch between a legacy runtime and a fully abstracted compute layer.

Single-Threaded Rendering Path
The rendering path of our legacy Razor views was effectively CPU-bound and largely single-threaded. In a 4-vCPU environment, the request pipeline exhibited limited parallelism during view rendering, meaning the entire request was gated by the throughput of a single core.

The Abstraction Deficit
The issue was not that "Fargate is slow," but rather that Fargate abstracts away CPU characteristics that were critical for this specific workload.

  • Per-core Variability: Fargate provides abstract compute units. For modern asynchronous workloads, this is ideal. For legacy synchronous tasks, the inability to control the CPU class or guarantee a high base clock speed introduces unacceptable latency.
  • Scheduling Overhead: Windows Container overhead, combined with the lack of control over the underlying hardware, meant we couldn't guarantee the raw single-core throughput required for the monolith’s rendering engine.

5. The Solution: c7a.xlarge (EC2 Launch Type)

To resolve the latency without refactoring the code, we moved the workload to ECS on EC2 using c7a.xlarge instances.

Why c7a (AMD EPYC Genoa):

  • High Frequency: High sustained single-core throughput.
  • Single-Core Performance: The 4th Gen AMD EPYC architecture provided significantly stronger per-core throughput for this workload.

Outcome:
Rendering latency dropped from 20 seconds to 1.5 seconds. We achieved our goal of centralized ECS deployment without sacrificing performance.


Conclusion

  • Cloud abstractions work exceptionally well for horizontally scalable workloads.
  • But many legacy runtimes still encode assumptions about single-core throughput, scheduling behavior, and hardware consistency.
  • When migrating these systems, infrastructure selection becomes part of application performance engineering - not just operations.