Software engineering is not about particular technology like Java or Dot Net but it is all about the kind of standard practices we need to follow for production quality software. Recently I come across one of the practice during the performance testing of a web application. It would be helpful for other software developer, tester or devops.
Problem Definition: We have developed Asp.Net MVC 4 web application and we want to release it in production prior to that we need to find out how much load it can take means how many concurrent users can access the web application and what is response time for each request during heavy load. We have agreed upon the response time should not be more than 3 seconds. This is common use case for all web application.
Solution: To solve it we have started with load testing, for that purpose we used the JMeter one of the open source load testing framework. We recorded the JMeter script. JMeter provided the user manual please refer it for more detail. We also want to monitor the server CPU and memory utilization for that purpose JMeter is having performance collection plugin and a server agent utility which captures the server parameters and sends it to the JMeter Plugin. JMeter has various listeners in which summary report gives the required statistics.
If the statistics are not satisfactory then it triggers the need to do profiling of a web application. By profiling we come to know various hot spots in the web application which very clearly state the resource utilization of every method and class. We have used the dotTrace from Jetbrains it provides the 10 days trial edition. Every language is having the profiling support so you choose which ever fit for you but objective is the same.
Now we have profiling result which triggers the need of re factoring of code. The re-factoring is common practice in agile which help to evolve the design and architecture of software. This activity triggers to implement particular task in more efficient way. This is totally depends on your business logic, design and architecture of software.
We need to repeat this cycle Load Test –> Profiling –> Re factoring until you will not be satisfactory with result. But one thing is very sure that you will have performance efficient software with good design and architecture.
Remaining performance tuning can be done at web server level like increase number of worker and IO threads per process, increase the request queue length and if required add the load balancers etc.
Once you got the required result you can not hide smile on your face 🙂 i.e. “AANAND”
Step 1: Custom Error page IIS 6. it helps for page not found (404) at http://www.example.com/someNotExistPage.html
<customErrors mode=”On” defaultRedirect=”~/GenericErrorPage.html”/>
Step 2: Custom Error page IIS 7.5 it helps for page not found (404) at http://www.example.com/pathOne/pathTwo/someNotExistPage.html
<httpErrors errorMode=”Custom” >
<remove statusCode=”404″ subStatusCode=’-1′ />
<remove statusCode=”500″ subStatusCode=’-1′ />
<error statusCode=”404″ path=”/GenericErrorPage.html” prefixLanguageFilePath=”” responseMode=”ExecuteURL” />
<error statusCode=”500″ path=”/GenericErrorPage.html” prefixLanguageFilePath=”” responseMode=”ExecuteURL” />
Step 3: Inside the Global.asax for catching all exception in web application
protected void Application_Error(object sender, EventArgs e)
var httpApp = (HttpApplication)sender;
Exception exception = Server.GetLastError();
// log the exception
In the ASP.NET MVC 4 case must provide page at /Views/Shared/Error.cshtml
Inside App_Start …
public class FilterConfig
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
And from Global.asax register it
protected void Application_Start()
If needed create CustomHandleErrorAttribute by extending HandleErrorAttribute and override OnException
and register it at global.aspx filter or manage like any other controller level attribute
public class AccountController: Controller
Step 5: If needed override controller OnException method at controller level
protected override void OnException(ExceptionContext filterContext)
If anything is missing please let me know.
Thanks & Regards,
I am trying to deploy web application in tomcat 7.0.42 remotely and also want to debug remote deployed web application from Netbeans 7.4. During this faced some issue also resolved it from reference but want to consolidate all this steps at one place. It would be helpful to someone who is trying this first time and also for my reference.
Tomcat maven plug-in for remote deployment:
Step 1: Add tomcat plug in build section
Step 2: Inside tomcat-users.xml which is located at catalina_home/conf add following
<user password=”passoword” roles=”manager-gui,manager-script,admin” username=”admin”/>
Step 3: Add following setting in your maven settings. File location is user home/.m2/settings.xml
Step 4: from maven project run command tomcat7:deploy
Enable remote debugging in netbeans 7.4:
Step1: Go to tomcat/Catalina home directory. Open the startup.bat file.
Set parameters at first empty line :
And last line should be replaced
call “%EXECUTABLE%” start %CMD_LINE_ARGS%
call “%EXECUTABLE%” jpda start %CMD_LINE_ARGS%
Step 2: Start the tomcat using startup.bat from command line.
Step 3: From netbeans attach debugger with following setting and debug the code.
Debugger : Java Debugger (JPDA)
Connector: Socket Attach