0

I have completely different two SignalR application, but the hub names are the same. Each application was deployed into same two servers(with load balancing). My architecture is like below

Cache Application: netscaler1 --> server1,server2 Hub Name: SignalRHub

Trade Application: netscaler2 --> server1,server2 Hub Name: SignalRHub

Cache

namespace SignalR.Server.Cache
{
    class Program
    {
        static void Main(string[] args)
        {
            var url = ConfigurationManager.AppSettings["cacheurl"];
            using (WebApp.Start(url))
            {
                Console.ReadLine();
            }
        }
    }

    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            HubConfiguration conf = new HubConfiguration();
            GlobalHost.DependencyResolver.UseRedis("sameIp", 6379, "*******", "Cache");
            app.UseCors(CorsOptions.AllowAll);
            app.MapSignalR(conf);
        }
    }
} 

namespace SignalR.Server.Cache
{
    public class SignalRHub : Hub
    {
        public void SendCache(string cache)
        {
            Clients.All.OnMessage(cache);
        }
    }
}

Trade

namespace SignalR.Server.Trade
{
    class Program
    {
        static void Main(string[] args)
        {
            var url = ConfigurationManager.AppSettings["tradeurl"];
            using (WebApp.Start(url))
            {
                Console.ReadLine();
            }
        }
    }

    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            HubConfiguration conf = new HubConfiguration();
            GlobalHost.DependencyResolver.UseRedis("sameIp", 6379, "*******", "Trade");
            app.UseCors(CorsOptions.AllowAll);
            app.MapSignalR(conf);
        }
    }
} 

namespace SignalR.Server.Trade
{
    public class SignalRHub : Hub
    {
        public void SendMessage(string message)
        {
            Clients.All.OnMessage(message);
        }
    }
}

My Questions :)

  • Does the same redis server cause a problem? Does the redis event key parameter handle this?
  • How redis stores this connections? I connected to redis with redis
    desktop manager and I couldn't see any database.
  • I also storing data in same redis server for different purpose, Does this cause a problem?
  • Do two hubs with the same name on the same server cause problems? should I change hub names
Erhan Urun
  • 228
  • 3
  • 9
  • You are fine using the same Redis server, the last parameter to UseRedis is the pubsub channel, which is different between the two configurations. You need a Redis server that is running Redis, the connections are established by the first three parameters to UseRedis (server, port, password). It doesn't cause an issue to store data in the same redis server for different purposes. [additional info](https://learn.microsoft.com/en-us/aspnet/signalr/overview/performance/scaleout-with-redis) – C. Mitchell Oct 23 '18 at 03:49
  • @C.Mitchell I've already reviewed the documentation you've shared. could not find information about redis configuration. Thanks for answer – Erhan Urun Oct 23 '18 at 08:39

0 Answers0