Load Testing SignalR using CRANK - Step by Step

Rajnilari2015
Posted by in SignalR category on for Intermediate level | Points: 250 | Views : 516 red flag

SignalR is the technology by which we can add real time web functionality to applications. That means, the server pushes the content/data to the connected clients instantaneously without the server waiting for the client for making a new data request. In the earlier article, we have seen how to use SignalR for sending periodic response from the server. In this article, we will perform Load Testing for the Server Broadcasting messages to a large number of connected clients by using CRANK using the same code base.


 Download source code for Load Testing SignalR using CRANK - Step by Step

Introduction

SignalR is the technology by which we can add real time web functionality to applications. That means, the server pushes the content/data to the connected clients instantaneously without the server waiting for the client for making a new data request.

In the previous article, we have seen how to use SignalR for sending periodic response from the server. In this article, we will perform Load Testing for the Server Broadcasting messages to a large number of connected clients by using CRANK which is command line based utility from the SignalR team for providing support for simulating load for testing of Persistent connections of SignalR applications.

CRANK can be downloaded from the The SignalR codebase.We can also download a Zip archive of the Dev branch of the SignalR codebase.

N.B.~We are using the same code base as what we have seen in the previous article.

Technology Stack

Platform Windows 8.1 Enterprise
Framework Net 4.5
Communication technologies SignalR 2.0
Web Technologies Asp.net MVC 5
ORM EF 6
DB backbone Sql Server 2014
Load Testing Tool Crank
Auxillary Tools Microsoft ASP.NET SignalR Utilities 2.2.1
Health Monitoring Tool Performance Monitor 6.3.9600
Browser Google Crome 51.0.2704.103 / FireFix 47.0

Step 1: Environment Setup

First install Microsoft ASP.NET SignalR Utilities 2.2.1. Command line utilities for ASP.NET SignalR, including performance counter installation.

Install-Package Microsoft.AspNet.SignalR.Utils

After installing the Microsoft.AspNet.SignalR.Hosting.Utils NuGet package, we will find a SignalR executable in the package folder(In our case it was under C:\Users\niladri.biswas\Desktop\dotnetfunda\2016 Articles\July2016\ExperimentForCrank\Experiment\SignalRExp\packages\Microsoft.AspNet.SignalR.Utils.2.2.1\tools)

We need to open VS command prompt in the elevated mode and issue

C:\Users\niladri.biswas\Desktop\dotnetfunda\2016 Articles\July2016\ExperimentForCrank\Experiment\SignalRExp\packages\Microsoft.AspNet.SignalR.Utils.2.2.1\tools>signalr ipc

Go to Performance monitor to check if all the SignalR releated performance counters are present.

Download CRANK from here

Build the solution and we will find

\src\Microsoft.AspNet.SignalR.Crank\bin\Debug\crank.exe

Step 2: Add Counters for SignalR

Open Performance monitor in Elevated Mode and choose all the instances of SignalR of the application (which is webapplication1).

Step 3: Execute Crank

Crank is a command line tool. Open VS Command Prompt in Administrative Mode and execute the below command

crank /Connections:1000 /Url:http://localhost:52578/Home/Index /ConnectTimeout:300000

Step 4: Run the Application and play with it for sometime

Run the application and open it in multiple browsers and keep inserting the records for say 5 minutes. The result in our system is as under.

We hit the application for around 400 requests in a minute. We can figure out that, the CPU consumption is around 65%.

References

SignalR Connection Density Testing with Crank

Conclusion

Hope this will be helpful for perfomring the Load Testing of SignalR Messaging using CRANK. Thanks for reading.

Recommendation
Read Let's Explore ASP.NET Core 1.0 briefly after this article.
Page copy protected against web site content infringement by Copyscape

About the Author

Rajnilari2015
Full Name: Niladri Biswas (RNA Team)
Member Level: Platinum
Member Status: Member,Microsoft_MVP,MVP
Member Since: 3/17/2015 2:41:06 AM
Country: India
-- Thanks & Regards, RNA Team


Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)