0

In our application we have implemented signalr scaleout with sql server. The backplane is configured but seems like it fails to send messages to all the servers that are connected to it. Is there an event or any other way to log the requests that are coming to the backpalne and to which servers it then send these messages so we can identify where is the issue. We can enabled signalr trace logs in each server and following is the trace from it. But the information here is too little for us to find the issue.

2017-02-02 04:05:11.7642 TRACE  SignalR.SqlMessageBus  Stream 0 : No records received (System.Diagnostics.TraceSourceExtensions.Trace) 
2017-02-02 04:05:11.7798 TRACE  SignalR.SqlMessageBus  Stream 0 : Waiting 3000ms before checking for messages again (System.Diagnostics.TraceSourceExtensions.Trace) 
2017-02-02 04:05:14.8111 TRACE  SignalR.SqlMessageBus  Created DbCommand: CommandType=Text, CommandText=SELECT [PayloadId], [Payload], [InsertedOn] FROM [SignalR].[Messages_0] WHERE [PayloadId] > @PayloadId, Parameters= [Name=PayloadId, Value=51373] (System.Diagnostics.TraceSourceExtensions.Trace) 
2017-02-02 04:05:14.8111 TRACE  SignalR.SqlMessageBus  Stream 0 : No records received (System.Diagnostics.TraceSourceExtensions.Trace) 
2017-02-02 04:05:14.8267 TRACE  SignalR.SqlMessageBus  Stream 0 : Setting up SQL notification (System.Diagnostics.TraceSourceExtensions.Trace) 
2017-02-02 04:05:14.8267 TRACE  SignalR.SqlMessageBus  Created DbCommand: CommandType=Text, CommandText=SELECT [PayloadId], [Payload], [InsertedOn] FROM [SignalR].[Messages_0] WHERE [PayloadId] > @PayloadId, Parameters= [Name=PayloadId, Value=51373] (System.Diagnostics.TraceSourceExtensions.Trace)

How can I know whether the sql backplane is already working, and if not?

Janitha Tennakoon
  • 856
  • 11
  • 40

1 Answers1

2

The short answer: to verify if the backplace is working the following conditions must be met and you should be able to see

  1. the related messages in the underlying database tables
  2. log messages from SignalR.SqlMessageBus in the trace logs (when enabled)

Further information:

We also use SignalR with a SQL scaelout and we get the following trace log when a new message is persisted to the database table:

SignalR.SqlMessageBus Verbose: 0 : Stream 0 : Saving payload with 1 messages(s) to SQL server

After this we can identify the message in the respective SignalR table (depending on your configuration there could be more than one):

enter image description here

In your logs I only see messages from SignalR.SqlMessageBus. To get more details you should also set the scaleout related trace sources to Verbose,ActivityTracing like this (see the last two lines which show the SignalR.ScaleoutMessageBus log messages):

SignalR.SqlMessageBus Verbose: 0 : Stream 0 : SqlReceiver last payload ID=8390, new payload ID=8391
SignalR.SqlMessageBus Verbose: 0 : Stream 0 : SqlReceiver last payload ID=8390, new payload ID=8391
SignalR.SqlMessageBus Verbose: 0 : Stream 0 : Updated receive reader initial payload ID parameter=8391
SignalR.SqlMessageBus Verbose: 0 : Stream 0 : Updated receive reader initial payload ID parameter=8391
SignalR.SqlMessageBus Verbose: 0 : Stream 0 : Payload 8391 containing 1 message(s) received
SignalR.SqlMessageBus Verbose: 0 : Stream 0 : Payload 8391 containing 1 message(s) received
SignalR.ScaleoutMessageBus Information: 0 : OnReceived(0, 8391, 1)
SignalR.ScaleoutMessageBus Information: 0 : OnReceived(0, 8391, 1)

Configuring the SignalR.ScaleoutMessageBus trace source can be done like this:

  <source name="SignalR.ScaleoutMessageBus" switchName="SignalRSwitch" >
    <listeners>
      <add name="SignalR-Bus" />
    </listeners>
  </source>
Ronald Rink 'd-fens'
  • 1,289
  • 1
  • 10
  • 27
  • Thanks for the reply. Since we have multiple servers connected is there a way to find the payload id of the message that a specific server is saving. There is not much information can be gained by "Saving payload with 1 messages(s) to SQL server" because multiple servers are saving at the same time. – Janitha Tennakoon Mar 21 '17 at 07:33
  • actually yes. when you look at the more complete log file at the end of my answer, you see several messages from `SqlMessageBus` and `ScaleoutMessageBus` where the `PayloadId` is shown. And from this you can check the DB table to see if the message has been persisted. – Ronald Rink 'd-fens' Mar 21 '17 at 07:35