Pan!cKk
Multi-Instance Application with SignalR and Redis as backplane
Hello :)
I have an application that I want to have multi-instances of. The application communicates with the frontend via SignalR for various use-cases, but when I launch another instance of the application, the client often fails to connect to the SignalR Hub.
This is how I set Redis as the backplane:
With a single instance it works perfectly fine, but when another instance is introduced, it fails to connect (not always, but quite often).
This is the error I get on the client side:
I also tried using stateful-set for the deployment, but still no luck.
Is there some specific configuration that needs to be set?
NOTE: Redis is a single instance
2 replies
Scaling Background Services !
I have a background service that uses Redis as it's main operating database. What this background service do is that on user input (start button event), I store that entity on Redis and the background service keeps fetching these entities and process them (or not) based on different conditions.
What I store on Redis is a list of those entities, so when a new process is requested, a new item is added to that list, and then I fetch that list and process the items within a foreach loop.
It works fine with a single instance, but I am trying to figure out a way on how to make it work with multiple instances.
What I tried so far was adding an new property to that entity, "IsLocked" so when it is fetched, I set that property to "true" so the other one does not process it, and finally I set it to "false". In theory it sounded possible, but the background service is executed every 100ms, what I am assuming that the other instance fetches that list before the other one updates the "IsLocked" property.
I hope I am being clear with my request, but this is my first time trying to working with multiple instances, so be gentle !
Could someone provide me with some helpful resources and tips of what could be a good solution for my case? Or even if I should use a completely different approach !
Thank you in advance :)
1 replies
Enum Capabilities
Hello there!
I was wondering if there is a way to return the string value (either description or name) rather than the enumeration value of an enum.
Take this enum for example:
public enum SourceType
{ SourceLink = 1, Channel = 2, Video = 3 }.
When I return this model:
public class Source
{ string Title; SourceType Type; },
I wonder if the value of the property Type can be string, the name of the enum (SourceLink, Channel or Video) or the description, rather than the integer value (1, 2, 3).
Has anyone done something similar? Is that even possible?
31 replies