This is an index of things which needs to be checked, for performance optimization of a simple ASP.Net + Angular application. The simple application refers to application which read and write to SQL Server. If the application uses some other data store, still the points about other aspects are valid.
The details of each item would be either a link to posts in this blog or link to other resources. If someone is struggling to find where to start or struck on an optimization exercise,hope these questions will light a bulb in their brain. Sorry to say that it is very difficult to find an algorithm which applies every performance optimizations.
Browser side
- Do we need to support desktop and mobile browsers?
- Any possibility to avoid Internet Explorer and support only modern browsers:)
- Do we have separate mobile site with URL or same site is controlled via bootstrap or similar display technique
- Static assets
- Are those cached? If not can we cache?
- If those are cached what is the cache expiry?
- If those are cached how its done? cache-control or Expires header? Is the cache really working?
- Is the server properly returning http 304?
- Are they minified and bundled?
- Are the images optimized to have small foot print?
- Are they served from CDN?
- Angular best practices applied?
- If it is AngularJS, what is the feasibility to upgrade to Angular
The network
DNS and routing
- Hows the DNS resolved to IP?
- Is the application available public or accessed only via enterprise intranet?
- What is the network connection band width between clients and server? also between web servers and database server(s)
Network devices
- CDN
- Any option for warming up cache?
- Security / Application Gateways which open packets and scan for attacks.
- What is the time needed for security inspections? Is it fast, if we bye pass gateway for testing?
- Network load-balancer
- Do we have load balancer? Are we reached the height of optimization and need scale out or scale up? In Azure, the best practice is to use LB as the machines gets patches and restarts periodically. Also follow the best practices to group machines so that all of those will not be restarted same time.
- What is the algorithm used for load balancing?
- Do we have sticky session need?
- Common
- Do we have logs available from these devices?
- Are the logs enough to confirm that the backing web server is taking time to respond?
Web Server machine
- Does the requirement of project is practical to the server? eg: One quad core, 8GB VM may never support 100,000 concurrent users even if its a simple company static web site
- Is the machine / hosting infrastructure in Azure or any cloud? If so do all the best practices followed and coded by considering cloud principles such as retry pattern?
- What is the status of CPU, Memory, Network etc.. during load test or busy hour?
IIS
- Logging
- Does the logging (time-taken field) says requests are taking high time? Please note that that time includes server processing + data transfer
- Are we logging any custom field which are big in size?
- Are the extra logging such as failed request tracking enabled?
- During a load test of busy session
- If we go to IIS worker process screen are we able to see many requests pending?
- What is the http queue length performance counter shows ?
- Are we able to identify one or sub set of requests taking high chunk of processing time other than rest of requests? This can be done by analyzing IIS logs.
- Static assets - Kind of repetition from previous section.
- Are they cached properly?
- Are we using ASP.Net Bundling or compile time bundled? Are they served in minimized form
- Can we increase cache expiry?
- Protocols
- Any possibility to leverage http/2, if not done?
- Is it using web sockets?
- Authentication
- Is it using windows authentication? If so NTML or Kerberos? Kerberos is recommended for better performance
- AppPool Recycling
- What is the AppPool recycling settings?
- Is the recycling causing delay?
- Any ways to run mock requests so that the cache is populated before real user hit application?
- Throttling / Limiting
- What is the MaxConnection Setting and other IIS level throttling?
- Are there any performance counter showing connections getting queued and rejected?
- Timeouts
- Is there any manual test and load test attempted by reducing the timeouts to lowest possible settings? Some times high timeouts cause some requests to occupy entire system resources
- Payload
- Does the http compression enabled
ASP.Net Application
ASP.Net pipeline till our code
- What are the throttling settings at different level?
- Are there any custom HttpModules which may reduce performance? Any unwanted modules?
Our code
- Are there anything which can be cached instead of going every time to database? eg: any reference tables which change only by deployment.
- Are there any retries happening and succeeding after lot of attempts? Try reducing retry count to 3.
- Are there static variable usage and any potential for lock contention and memory leaks?
- Are the locks applied to lowest possible code section?
- JSON optimization
- Can the property names be shortened?
- Are the default values serialized into JSON?
- Are we doing any HTML rendering at server and returning as JSON property? Any possibility to make application as pure client rendered SPA?
- Do we have high amount of reflection?
.Net General
- Are there high amount of GC collections? This can be found from analyzing performance counters?
- What is the fragmentation level in LOH?
- Can we do NGEN?
- Any memory leaks in the application? eg: open connections, unwanted static things which may hold objects?
Database
- Does the applications logs showing that the queries are taking time?
- Does the SQL setup with possible best practices? eg: temp db, flags, connection limiting etc...
- Are there any subset of SPs always slow?
Mind map
Finally, there is a mind map created using PlantUML for easy reference. Since this is kept textual in GitHub and rendered on demand, this would be living document than the post.
Details on how to get PlantUML working is available in different post including a YouTube video tutorial.
Other similar links
This is not the first and last link on optimizing ASP.Net and Angular applications.
No comments:
Post a Comment