Created
January 31, 2016 17:31
-
-
Save lefthandedgoat/123aff8504981843ce25 to your computer and use it in GitHub Desktop.
Quick list of things to check for related to website performance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Off the top of my head, there are multiple parts of making your site faster. | |
1. Network related stuff | |
2. Server side time | |
3. Client side time | |
The tool that will give you the quickest high level insight into some things you may be wrong is: | |
http://yslow.org/ | |
It will lead you to some quick wins like, expiration headers, gzip compression, etc. | |
It gives you a nice score and with a few hours of work you can usually fix several of the issues. | |
After that, you use chrome dev tools and watch the network tab. It will give you a timeline of all your calls. | |
Generally the first request will be the initial page load, and then subsequent calls will for .js, .css, and image files. | |
Ajax calls will also show and it will give you a feel for all of that. | |
Fewer calls = better, faster calls = better. | |
Bundling and minification of .js and .css can help a lot. | |
For server side you use both a code profiler and a sql profiler. | |
If you are using C# or a .net language, I suggest https://www.jetbrains.com/profiler/ | |
It takes a little bit to getting used to how to read it, but there are a few important things it will tell you. | |
It will tell you were time is being spent, in what specific method or tool (entity framework, logging, etc). | |
It can also tell you the # of calls per method (with the slower and more invasive option for profiling) | |
This is really important, because sometimes you will find that you are making the same sql call 500 times, and thats an easy fix. | |
If you are using an ORM like Nhibernate or EF, its easy to do whats call an n+1 query where you get a customer, then 1 at a time you get all of his orders | |
Another common problem is fetching data, or doing something expensive, and not using it. | |
Write code that only does it in the necessary conditions. | |
The fastest code is code that never runs! | |
Knowing how to profile code is a very valuable skill and is challenging but also very rewarding. I once cut page load times in half with 1 line of code | |
You can use the SQL trace tool to see what queries are being fired off and how long they take and their cost. | |
Look for big nasty queries, or simple queries that get fired off a bunch of times. | |
Have a dba help you add missing indexes or add them yourself. | |
If you find yourself getting a list of the states in the US all the time, then cache it. | |
Cacheing can be great, but also it can be terrible. Be judicious about caching, under caching is better than over caching. | |
Caching can introduce subtle bugs and is hard to 'keep fresh'. The RAM you give SQL is a cache and your SQL server is the source of truth, so dont be affraid to throw some money at it. | |
Ram is really cheap, like $5k for 256 gigs cheap. | |
Last is client side performance. This harder for me and I have less knowledge here | |
You can use the 'Timeline' tab in chrome to look at this. Page reflows can be a problem because lots of dynamic content. | |
Loading js files is way slower than you think, css etc. | |
I have some stuff bookmarked on my laptop, if I remember I will dig it up and amend this gist. | |
Hope this helps! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment