locked
Temporary holding data in SignalR when scaling out. RRS feed

  • Question

  • User-1134857695 posted

    My SignalR logic is about to grow a little bit more. I've been using Dictionaries to store temporary data and they've been working wonderfully well: they're fast, and they can be eliminated with ease. Also, no I/O tasks mean that I can leave the server for more space in case it needs to do a database roundtrip. 

    I wanted to know, though. If I ever use a backplane and scale out SignalR, how bad will it be to persist data in-memory? I know that synchronizing in-memory objects is also considered bad practice, which will lead me to the database. 

    In the hypothetical case of a server failure, if the user is disconnected and all the temporary data is lost, it does not matter, because the user will be asked to reload the page and the temporary data will be recreated again without too much trouble. 

    In that case, should I fall into a Database-only scenario to maintain persistence? Or is it possible to create a single server that could serve as a single unit which would hold all the data in-memory and then distribute it to the other signalR servers?  (I don't know if that is possible using Azure Service Bus)

    http://www.asp.net/signalr/overview/performance/scaleout-in-signalr

    http://www.asp.net/signalr/overview/performance/scaleout-with-windows-azure-service-bus

    Sunday, June 26, 2016 3:36 PM

Answers

  • User61956409 posted

    Hi superjose,

    We usually do not persist data in memory, if it is more than one server. According to your description, I think storing data in database is a good and easy approach, each server could access same data from your database.

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 27, 2016 8:21 AM

All replies

  • User61956409 posted

    Hi superjose,

    We usually do not persist data in memory, if it is more than one server. According to your description, I think storing data in database is a good and easy approach, each server could access same data from your database.

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 27, 2016 8:21 AM
  • User-1134857695 posted

    Thanks! :D. Will do unit of work with the in-memory solution for now. So in case it scales, we just swap the Dictionary for the in-database solution. 

    Monday, June 27, 2016 5:47 PM
  • User-792121656 posted

    I am new in signalR development. In my current signalR application, i am using data-tables to hold the data in memory. 

    Saturday, July 2, 2016 1:38 AM
  • User-1134857695 posted

    Thanks for the update :)

    Wednesday, July 6, 2016 5:18 PM