0
votes

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?

1

1 Answers

2
votes

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>