How to improve Signalr performance

indradaman sharma
indrada...
Participant
116 Points
14 Posts

How do we improve signalr performance if we use it to show data at the refresh rate of per second.

Also, I am facing the problem of memory out of bound due to which my signalr connection loss several time

and Reconnection failed.

Views: 16729
Total Answered: 2
Total Marked As Answer: 1
Posted On: 15-Jan-2016 12:21

Share:   fb twitter linkedin
Answers
indradaman sharma
indrada...
Participant
116 Points
14 Posts
         

Hello friends I found one solution of my problem.

Tuning your SignalR server for performance

The following configuration settings can be used to tune your server for better performance in a SignalR application. For general information on how to improve performance in an ASP.NET application, see Improving ASP.NET Performance.

SignalR configuration settings

  • DefaultMessageBufferSize: By default, SignalR retains 1000 messages in memory per hub per connection. If large messages are being used, this may create memory issues which can be alleviated by reducing this value. This setting can be set in the Application_Start event handler in an ASP.NET application, or in the Configuration method of an OWIN startup class in a self-hosted application. The following sample demonstrates how to reduce this value in order to reduce the memory footprint of your application in order to reduce the amount of server memory used:

    .NET server code in Startup.cs for decreasing default message buffer size

    public class Startup {
      public void Configuration(IAppBuilder app)
      {
         // Any connection or hub wire up and configuration should go here
         GlobalHost.Configuration.DefaultMessageBufferSize = 500; app.MapSignalR();
      }
    }

IIS configuration settings

  • Max concurrent requests per application: Increasing the number of concurrent IIS requests will increase server resources available for serving requests. The default value is 5000; to increase this setting, execute the following commands in an elevated command prompt:

     
    cd %windir%\System32\inetsrv\ appcmd.exe set config 
    /section:system.webserver/serverRuntime /appConcurrentRequestLimit:10000
     
  • ApplicationPool QueueLength: This is the maximum number of requests that Http.sys queues for the application pool. When the queue is full, new requests receive a 503 “Service Unavailable” response. The default value is 1000.

    Shortening the queue length for the worker process in the application pool hosting your application will conserve memory resources. For more information, see Managing, Tuning, and Configuring Application Pools.

ASP.NET configuration settings

This section includes configuration settings that can be set in the aspnet.config file. This file is found in one of two locations, depending on platform:

  • %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet.config
  • %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet.config

ASP.NET settings that may improve SignalR performance include the following:

  • Maximum concurrent requests per CPU: Increasing this setting may alleviate performance bottlenecks. To increase this setting, add the following configuration setting to the aspnet.config file:

     
    <configuration>  
      <system.web>  
        <applicationPool  
            maxConcurrentRequestsPerCPU="5000"  
            maxConcurrentThreadsPerCPU="0"  
            requestQueueLimit="5000" />  
      </system.web>  
    </configuration>
     
     
  • Request Queue Limit: When the total number of connections exceeds the maxConcurrentRequestsPerCPU setting, ASP.NET will start throttling requests using a queue. To increase the size of the queue, you can increase the requestQueueLimit setting. To do this, add the following configuration setting to the processModel node in config/machine.config (rather than aspnet.config):

    <processModel autoConfig="false" requestQueueLimit="250000" />

If Some one find batter solution then please Reply.

Thanks

Posted On: 15-Jan-2016 12:29
helped a lot! thanks.
 - Rashmi  17-Apr-2024 03:51
Rahul Maurya
Rahul M...
Teacher
4822 Points
23 Posts
         

hi Indradaman,

Thanks for sharing solution.

Posted On: 15-Jan-2016 20:23
 Log In to Chat