Why Is My Blazor Server App Recycling? (Private Memory Limit Reached) Print

  • Memory, ram, signalr, recycle, blazor, application pool, recycle pool, private bytes memory limit
  • 0

Applies To: Customers hosting Blazor Server apps on Windows Server with IIS 10, using the Plesk control panel
Platforms: .NET 6, 7, 8, 9 | Blazor Server | Signal R | Windows Server 2022 | Plesk Hosting Plans


❗ Problem Summary

If your Blazor Server app restarts unexpectedly or users are suddenly disconnected, and logs or your hosting provider show this message:

"Application pool has requested a recycle because it reached its private bytes memory limit."

…it means the app pool for your website has reached the configured memory threshold, and IIS is recycling it to avoid overuse.

This is a server-level memory safeguard, even if your website doesn't appear to be using all available RAM.


Why This Happens

Blazor Server apps are built to keep real-time, persistent connections open between the browser and server using SignalR. Each user session:

  • Holds memory on the server (called a circuit)

  • Tracks UI state, component data, and events

  • Uses memory for the entire time the user is connected

As concurrent users increase — or if individual sessions use more data — your memory usage grows until it eventually hits the app pool limit.

This threshold is controlled by our hosting environment for performance and stability and cannot be changed manually from within Plesk.


What You Can Do to Prevent App Recycling

Even without access to IIS or server settings, there are several effective steps you can take within your app code or configuration to reduce memory usage and keep your app pool stable.


✅ 1. Purchase Additional RAM for Your Hosting Plan

If your app is growing in usage or user base, you may need more memory to support concurrent sessions. We offer RAM upgrades that raise your app pool's memory allocation.

To request a RAM upgrade,  check your customer portal to purchase RAM Memory addon.


✅ 2. Optimize Your Blazor App to Use Less Memory

While you can’t change IIS memory limits directly, you can reduce how much memory your app uses through code and design.

a. Clean Up Component Resources

Ensure your Blazor components release memory when users disconnect:

 
public void Dispose() { MyService.SomeEvent -= HandleEvent; }

This prevents memory leaks caused by event handlers or services still running in the background.


b. Avoid Holding Large Data in Memory

  • Use paging instead of loading entire data sets into memory.

  • Do not store large lists or user files directly in components or scoped services.


c. Limit SignalR Usage and Connection Lifetime

SignalR keeps a connection open per user. To reduce memory pressure:

  • Use shorter disconnect timeouts

  • Avoid broadcasting unnecessary updates to all users

While exact settings are managed server-side, designing your app to disconnect idle users faster (or to avoid always-on updates) helps reduce memory use.


d. Use Circuit Pruning Logic in Your App

You can add server-side settings in your Blazor app startup to help prune unused user sessions faster:

 
services.AddServerSideBlazor() .AddCircuitOptions(options => { options.MaxRetainedDisconnectedCircuits = 50; options.DisconnectedCircuitRetentionPeriod = TimeSpan.FromMinutes(2); });

This helps your app free up memory more quickly after a user disconnects.


✅ 3. Switch to Blazor WebAssembly (If Suitable)

Blazor WebAssembly apps run mostly in the user’s browser and do not require a persistent server connection for every user.

  • Ideal for public-facing or read-heavy apps

  • Reduces server memory usage drastically

  • Your app still communicates with the backend via API calls

If your app does not rely heavily on live server-side state, this is a powerful optimization strategy.


What You Cannot Do in Plesk

Due to the nature of shared or semi-dedicated hosting with Plesk:

  • You cannot change IIS application pool memory limits directly.

  • You cannot access app pool recycle settings or advanced IIS memory tuning.

  • You cannot modify the server's performance configuration.


Optional: Diagnose with Logs

If your app is still recycling unexpectedly:

  • Review your application logs via Plesk File Manager or FTP

  • Use try/catch blocks to handle disconnects gracefully in your app

  • Use ILogger<T> or third-party tools like Serilog to track memory-intensive operations

If needed, support can assist with a log review.


 Need More Memory?

If you suspect your app is hitting memory limits due to user load, large data, or long session times:

Contact our support team to request:

  • A review of your memory usage

  • A RAM upgrade recommendation

  • Hosting plan upgrade options if needed


✅ Summary

What You Can Do Benefit
Purchase RAM upgrade Increases your app pool's memory allocation
Optimize Blazor component memory Reduces per-user memory footprint
Dispose of services and event handlers Prevents memory leaks
Use Blazor WebAssembly (if applicable) Offloads work to the client
Implement paging and lazy loading Avoids large memory loads

Still have questions? Open a ticket from your account dashboard, and we'll be happy to assist with performance optimization advice.


Was this answer helpful?

« Back