IIS Application Pool

Can You Limit RAM Per Domain in IIS Using Virtual Memory Recycling?

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:

IIS Manager > Application Pools > [Your App Pool] > Advanced Settings

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)?


Example Scenario

You’re hosting these websites:

  • siteA.com → needs up to 500 MB

  • siteB.com → needs up to 1 GB

  • siteC.com → needs up to 750 MB

Here’s how you configure:

Domain
App Pool
Memory Limit (Virtual)

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:

# Example: Set virtual memory limit for AppPool_SiteA to 512 MB
Set-ItemProperty IIS:\AppPools\AppPool_SiteA -Name recycling.periodicRestart.privateMemory -Value 512000

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?