Ehsan Ghanbari

Experience, DotNet, Solutions

The combination of Stackify and Netling are doing a great job!

There are lots of tools and libraries out there for monitoring the Dot Net web applications. I personally use several tools based on my need. One of the tools I've always liked is Netling. It's great for fetching some overall results about the load time and resource usages of the application on heavy requests.  Rather than that, I usually use another code monitoring tool to see what's going exactly in my code. Get the latest version of Stackify and Netling. Firstly, run the Netling client and test your application load via different Threads, I'm testing the app on my website source code:

 

 

You can see the result in the picture above for 16 threads. Note that I'm running the app on my local computer machine and running on the web server would appear different result:

 

 

Anyway, you can see about the details of each parameter of Netling over here. Netling gives us overall result about the load and performance but it doesn't give us which section or which method causes the load issue. As I told, Stackify is a great tool for code monitoring; After installing and enabling the application via the mentioned link at the beginning of the post, run your application and see the result in the local address that Stackify gives you:

 

 

It's obviously shown that which action takes more time than others. And by selecting the action on the left side you can see the details on the right side. You can detect the heavy queries and modify them. needless to say that, Stackify code monitoring and you can only use it in your local machine on your source code.



Using glimps in asp.net mvc

I've always loved and used Glimpse at least for my basic performance and load test in my asp.net MVC projects. It's really straightforward and easy to use web debugging and diagnostics tool. Get the latest version of the library from nuget and get started. After installing the suitable version based on your MVC version, go to the yourApplicationUrl/Glimpse.axd and enable it.

 

 

Then you will see the Glimpse layout at the bottom of every page of your application:

 

 

After redirecting to the different page, you can easily see the details of your request such as Execution, Metadata, Model Binding, Routes, and even SQL queries:

 

 

Glimpse just inform you about your application, You can use this tool in your application I recommend you to close it in final production:

 

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");  

 

 



Note about the Deferred Execution in LINQ component

Maybe you know about the deferred execution unconsciously. This sexy phrase refers to the point of LINQ queries when it executed. Although executing the LINQ query should be considered and after doing join, group, let and every LINQ instructions, finally, it should be executed; because it will be executed in every call if you don't execute it! Take a look at the following example:

  public IEnumerable<Blog> GetAllPosts()

        {

            var executedQuery =_siteContext.Blogs.

                Where(p => p.IsDeleted == false && p.IsPublished)

                .OrderByDescending(c => c.CreationDate)

                .Include(c => c.Tags)

                .ToList();

           var count = executedQuery .Count();

           var average= executedQuery.Contains("d");

           return executedQuery ;

        }

As you can see the executed Query has been executed by .ToList() and the Count() and Contains("d") will be queried in memory and If you don't call .ToList() it will be executed in each of the mentioned LINQ methods.



About Me

Ehsan Ghanbari

Hi! my name is Ehsan. I'm a developer, passionate technologist, and fan of clean code. I'm interested in enterprise and large-scale applications architecture and design patterns and I'm spending a lot of my time on architecture subject. Since 2008, I've been as a developer for companies and organizations and I've been focusing on Microsoft ecosystem all the time. During the&nb Read More

Post Tags
Pending Blog Posts
Strategic design
Factory Pattern
time out pattern in ajax
Selectors in Jquery
using Log4net in asp.net MVC4
How to use PagedList In asp.net MVC
Redis as a cache server
Domain driven design VS model driven architecture
What's the DDD-lite?
Multiple submit buttons in asp.net MVC