IIS Application Pool
Can You Limit RAM Per Domain in IIS Using Virtual Memory Recycling?
If you're managing multiple websites hosted on IIS (Internet Information Services) and you're wondering whether you can control the RAM usage per domain, you've landed on the right post. Let's break this down in a way that's easy to understand and implement.
The Question
"Can I limit RAM for different domains using virtual memory recycling in IIS?"
The Short Answer
Not directly per domain, but you can achieve this per Application Pool—and since each website (domain) can be assigned its own App Pool, you can effectively control memory usage per site.
How It Works
IIS doesn’t provide a built-in option to limit memory on a per-domain basis. However:
Each Application Pool runs its own worker process (
w3wp.exe
).You can assign one domain per App Pool.
Then, configure memory limits on each pool to restrict RAM usage.
This gives you process-level isolation between your sites—if one misbehaves, it won’t affect the others.
Steps to Limit RAM Per Domain
Here’s how to set it up:
1. Create Separate App Pools
For each website (domain), create a dedicated Application Pool.
2. Assign Sites to App Pools
Link each website to its own App Pool using the IIS Manager.
3. Set Memory Limits
Go to:
Then set:
Private Memory Limit (KB) – for limiting non-shared RAM usage
Virtual Memory Limit (KB) – for limiting total virtual memory, including RAM + page file
Example values:
500 MB →
512000
1 GB →
1024000
750 MB →
768000
What Is Non-Shared RAM Usage (aka Private Memory)?
Non-shared RAM usage, or private memory, refers to the portion of RAM that is used exclusively by a single process—in this case, the IIS worker process (w3wp.exe
).
This memory:
Cannot be shared with other processes
Is allocated only for that specific app pool
Is where your application stores its data, state, and code execution that isn't part of shared system libraries or memory-mapped files
Example Scenario
You’re hosting these websites:
siteA.com
→ needs up to 500 MBsiteB.com
→ needs up to 1 GBsiteC.com
→ needs up to 750 MB
Here’s how you configure:
siteA.com
AppPool_SiteA
512000 KB
siteB.com
AppPool_SiteB
1024000 KB
siteC.com
AppPool_SiteC
768000 KB
Pro Tip: Monitor Before You Limit
Before setting arbitrary values:
Monitor each app’s real-world memory usage using Performance Monitor (perfmon.exe) or Resource Monitor.
Base your thresholds on actual patterns to avoid unnecessary app pool recycling, which can affect performance.
Bonus: Automate with PowerShell
Managing dozens of sites? Here's a quick PowerShell snippet to set a memory limit:
You can loop this across all your app pools for automation. Let me know if you'd like a full script template.
Final Thoughts
While IIS doesn't allow per-domain memory limits directly, assigning each domain its own Application Pool and applying memory recycling thresholds is a robust, scalable solution. It enhances performance, improves fault isolation, and ensures each site plays nice with system resources.
Want help tuning these settings for your own environment or automating across your web farm? Drop a comment or reach out—we’re happy to help!
Last updated
Was this helpful?