Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMarston Gould
PHP Development Techdegree Student 17,314 PointsGreat, websites need to be fast...
but this video doesn't talk about three critical points: 1) what is fast enough. Do all pages need to be fast or just the common entry pages? and 2) what impacts speed of website. How much does coding impact #2? Can HTML, CSS, Javascript or other things impact and by how much? 3) what should you do if your website is not fast enough?
3 Answers
Jamil Velji
7,772 PointsFrom working in the startup realm as a marketer I can tell you nothing is ever really fast enough. For any business 1 second in load time can be the difference between a customer using your service/product or not.
I recommend the target of 3 seconds. Anything less is great, anything worse needs improvement.
All pages need to load at this speed, not just entry pages. If a page is too heavy, look at splitting it up in a way that won't dampen the UX too much.
Everything impacts the speed, images, code, delivery method, server resources, etc, etc, etc.
One persons bad code could add seconds to the load time of a simple site, similarly big images, too many elements to load or a bad server can all add up to a crazy slow site. I once dealt with a site that had the horrid mix of everything and it had 30 - 40 second load times in some countries.
To bring that load time down you need to employ a variety of things:
- A good parallel loading structure for elements like images, JS code and more. A well implemented CDN will solve this (try MaxCDN, its a good starting point).
- Optimize your code! This doesn't mean HTML but CSS, JS and other code files could be accumulating useless code. Try to keep your total code loading per page to under 400kb, especially the JS files.
- Compress your images. While a CDN can make them load faster, the images have to be reasonable size to not kill your load times. I recommend taking your images and outputting them through Photoshop's save for web feature. Then reduce the quality to around 60% and save it as a JPG. This can take hundreds of KBs off your file size. If you need a PNG use TinyPNG or something similar to compress it as best as you can.
- Make sure your servers aren't overloaded. Unless your a backend master, running a site that gets 50k uniques per month on a $5 DigitalOcean VPS is not realistic. I like to make sure my server resource usage never goes above 40%. That way I can always account for spikes in traffic if I have a good marketing day.
Employ the above pieces and it should start making some dents in that load time. Feel free to reach out if you would like any more help!
Caleb King
32,777 PointsMarston Gould These are all really good questions. Remember treehouse is suppose to help you get started with the world of web development and design and cannot cover all topics.
Unfortnately there is not one clear concise answer to question #1. Just consider the user experience and tools like browserstack.com and http://tools.pingdom.com/fpt/.
For question 2 start researching web servers online or even go through the php track on treehouse, which can help answer your question.
Marston Gould
PHP Development Techdegree Student 17,314 PointsCaleb, I completely agree that you can't cover everything. That being said, it doesn't help to have sections that bring up more questions than they address. For instance, one simple way to provide people answers on these questions might be to point them to SeoMoz, Matt Cutt's blog or a whole host of other resources. Just a suggestion.....