Cookie Consent by Free Privacy Policy Generator SignalR Backplane for ASP.NET Core - NCache

SignalR Backplane for ASP.NET Core

Real-time ASP.NET Core SignalR applications rely on the distribution of messages across servers for high-frequency updates. Examples of such applications include online games or social media networks, as well as live dashboards and other similar platforms where real-time interaction is key. To ensure seamless scalability in a multi-server environment, SignalR relies on a backplane mechanism to distribute messages effectively. NCache offers a powerful and scalable SignalR Backplane for this purpose.

NCache is a distributed caching solution that works seamlessly with ASP.NET Core SignalR to support real-time web applications, running in load-balanced multi-server environments for effective scalability and performance boosts. NCache also provides advanced Pub/Sub messaging features to help SignalR distribute messages efficiently across multiple servers.

SignalR Backplane
 

Using NCache as SignalR Backplane

You can configure your ASP.NET Core application to utilize NCache as a SignalR Backplane for high scalability and smooth message distribution. The process of integrating NCache as a SignalR Backplane is simple. It involves just a few configuration steps as outlined below:

  1. Install the NCache SignalR NuGet Package

    Add the NCache SignalR NuGet Package to your project:

    Install-Package AspNetCore.SignalR.NCache
  2. Modify appsettings.json

    Modify your NCache configuration settings in the appsettings.json file:

    {
      "NCacheConfiguration": {
        "CacheName": "demoCache",
        "EventKey": "chat",
      }
    }
  3. Register NCache as a SignalR Backplane

    Modify Program.cs to configure SignalR to use NCache as a backplane:

    using Alachisoft.NCache.AspNetCore.SignalR;
    
    var builder = WebApplication.CreateBuilder(args);
    
    // Bind NCache configuration section
    builder.Services.Configure<NCacheConfiguration>(
        builder.Configuration.GetSection("NCacheConfiguration"));
    
    // Register SignalR with NCache backplane
    builder.Services.AddSignalR().AddNCache(ncacheOptions =>
    {
        ncacheOptions.CacheName = builder.Configuration["NCacheConfiguration:CacheName"];
        ncacheOptions. EventKey = builder.Configuration["NCacheConfiguration: EventKey"];
    });
    
    var app = builder.Build();
    
    // Map your SignalR hub endpoint directly 
    app.MapHub<YourSignalRHub>("/your-hub");
    
    app.Run();
 

Why Use NCache as SignalR Backplane?

If your ASP.NET Core application experiences high traffic and operates in a load-balanced multi-server web farm, then you should consider integrating NCache as your SignalR Backplane solution. NCache stands out as a powerful .NET Distributed Cache available and offers the following benefits:

  1. .NET Pub/Sub Messaging: NCache offers Publish/Subscribe (Pub/Sub) messaging capabilities, which are used by SignalR Backplane to distribute messages effectively across multiple web servers in a multi-node environment.
  2. Support for Groups and Users: NCache allows sending messages to SignalR groups, which are collections of related connections. It also gives you the ability to send targeted messages to all connections linked with a specific SignalR user.
  3. 100% .NET Native Cache: Unlike other caching solutions that were originally developed in C++ and later adapted for Windows, NCache is natively built for .NET. This ensures smooth compatibility and a fully integrated experience with ASP.NET Core applications.
  4. Extremely Fast & Scalable: Since NCache is an in-memory distributed cache, it significantly lowers latency and ensures linear scalability. This allows applications to handle a high volume of message throughput without any performance bottlenecks.
  5. High Availability and Data Reliability: NCache offers a self-healing peer-to-peer clustering architecture with no single point of failure. It also includes smart data replication to prevent data loss if a cache server goes down while keeping replication costs low.

What to Do Next?

Explore more about NCache and its benefits for ASP.NET Core SignalR applications:

By using NCache, your ASP.NET Core SignalR applications can scale effortlessly while maintaining real-time performance across multiple servers.

© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.