Skip to main content

How to improve Application Stability in .Net Core Applications

How to improve Application Stability in .Net Core Applications

Application stability becomes an important factor for an application to succeed in the long run. If an application is stable, it means there are fewer production issues or if any issue arises they are resolved quickly. But, what should be done to keep an application stable apart from writing new code for new features in the application. Here are a few things that you can do,


  1. Write Unit tests and improve code coverage (> 80%)
  2. Write more automation tests using testing tools like selenium, protractor
  3. Perform Performance, load and stress testing to identify the threshold volume the app can handle and can auto-scale as per needs (Tools: JMeter)
  4. Its also important that we maintain a tech debt epic and add stories that need changes to the application like refactoring the code, or fixing some performance lags in a hot spot in code which we might not be able to do as part of the normal sprint work. And, allocate 20% of every sprint to work on MLO(maintenance lights on) items
  5. Find ways to improve logging (Create middlewares to log incoming requests, to log global exceptions, remove duplicate logging, log body and header of the request and remove any sensitive data(tokens), Log wherever possible for better troubleshooting purposes
  6. Find ways to improve monitoring of the App. Use Splunk forwarder to forward all the logs to Splunk and create different kinds of dashboards for various apps to monitor the current and historical performance of the app. We can also enable AppDynamics to monitor both application and business performance of the application
  7. Enable AutoScaling of the application if the traffic increases ( PCF Autoscaler service which scales based on a number of parameters like CPU, throughput, memory)



Comments

Popular posts from this blog

How to clear Visual Studio Cache

How to clear visual studio cache Many times, during development you would face situations where project references are not loaded properly or you get missing/error DLL's. This is because the Component cache gets corrupted randomly and without any warnings. The first option that needs to be done is to clear component cache and restart Visual Studio since the Cache might be holding onto previous DLL versions. Here are the steps on how to clear Visual Studio Cache, Clearing Component Cache: Close all Visual Studio Instances running in your machine. Also, make sure devenv.exe is not running in the Task Manager Delete the Component cache directory - %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\1x.0\ComponentModelCache Restart Visual Studio The above steps should fix the cache issue most of the times, but some times that is not enough and you need to perform the below steps as well. Clearing User's Temp Folder: Open the temp folder in this locatio n -  %USERPROFILE%\AppData\Loc...

How to dependency inject to static class

.Net core supports dependency injection. There are many ways that you can inject services like constructor injection, action method injection, property injection. But there will be scenarios where you need to inject dependency services to static classes. For example, injecting services to extension methods. First, create a static class with a one property IServiceProvider type public void ConfigureServices(IServiceCollection services) { services.AddScoped<ILoggerEntry, LoggerEntry>(); services.AddTransient<IMongoRepository, MongoRepository>(); } Second, configure your services in ConfigureServices() method in Startup.cs and define the lifetime of the service instance using either Transient, Scoped or Singleton types. public void ConfigureServices(IServiceCollection services) { services.AddScoped<ILoggerEntry, LoggerEntry>(); services.AddTransient<IMongoRepository, MongoRepository>(); } For the next step to configure the Static class provider proper...

Error NU1605 - Detected package downgrade. Reference the package directly from the project to select a different version.

Error NU1605 - Detected package downgrade This error occurs when a dependency package has a version higher than an existing package version in the project solution. Solution: Add the following in .csproj file < PackageReference > < NoWarn >$( NoWarn ); NU1605 </ NoWarn > </ PackageReference > Another way to do this is to right-click on the solution and  click  Properties . Click  Build  and under  Errors and warnings  add 1605 to the  SuppressWarnings  text box. You can also add multiple error codes that you want to suppress by adding each separated by a comma. P.S. The below screenshot is in VS2019 Mac Version