To get the basic idea please go through Part – 1.
- On Page
- Image Optimization
As a general rule of thumb, larger files take longer to download than smaller files. Web page download time, also known as the Page Load Time depends on the total size of content assets being downloaded from hosting servers to the requesting browser.The following image optimization best-practices go a long way in reducing the negative impact of images on website speed:- Proper Format Selection
- Proper Sizing and provide dimension on page
- Compression
- Fewer Images
- Optimize CSS Code and DeliveryOptimization isn’t all about minifying file size. The following best practices ensure a speed-optimized CSS delivery:
- Shorthand Coding
- Remove Browser Specific CSS Hacks
- Minify CSS
- Code Positioning
- Prioritize above-the-fold content
- CSS Delivery Best Practices
- Use only one external CSS style sheet.
- Do not use @import call.
- Remove unused CSS.
- Do not use CSS in HTML such as H1 and DIV tags.
- Use Inline small CSS or remove most inline css.
- Minify all CSS
- Minification – JavaScript, CSS, HTML
Minification of CSS, JavaScript and HTML share common benefits: reduced network latency, fewer HTML requests, enhanced compression, faster browser downloading and execution, ultimately boosting page speed and yielding higher scores on website speed measuring tools.
- Minimize HTTP Requests : Web page’s load time is spent downloading the different pieces-parts of the page: images, stylesheets, scripts, Flash, etc. An HTTP request is made for each one of these elements, so the more on-page components, the longer it takes for the page to render.
- Enable compression : Compression reduces the bandwidth of your pages, thereby reducing HTTP response. Most web servers can compress files in Gzip format before sending them for download, either by calling a third-party module or using built-in routines.
To enable compression:- Apache: Use mod_deflate
Add few lines of code in your.htaccess file to accomplish this:
#Begin gzip and deflate
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css application/x-javascript text/plain text/xml image/x-icon
</IfModule> - IIS: Use Configure HTTP Compression
- Nginx: Use HttpGzipModule
- Apache: Use mod_deflate
- Enable leverage browser caching: With browser caching, we’re explicitly instructing browsers to hang onto particular files for a specified period of time. When the file is needed again, the browser is to pull from its local cache instead of requesting it from the server again.
- Enable Expire Headers :
The ExpiresByType directive is used to tell browsers which files to cache and how long to hang onto them
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/html M3600
ExpiresByType text/css M3600
ExpiresByType application/x-javascript M3600
ExpiresByType image/bmp M3600
ExpiresByType image/gif M3600
ExpiresByType image/x-icon M3600
ExpiresByType image/jpeg M3600
</IfModule>
- Image Optimization
- Off Page
- Use of CDN server : CDN is an extension of cache optimization designed to supercharge website performance aimed specifically at globally dispersed Web traffic. Following are some of popular CDN networks.
- Maxcdn
- Cloudflare
- Microsoft Azure CDN
- Amazon Cloudfront
- BootstrapCDN
- CDNetworks
- Use of Cache
- Use of caching & DB caching in PHP
- OpcacheOPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.To install Opcache please go through following link:http://php.net/manual/en/opcache.installation.php
- MemCacheMemcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.Please go through following link:http://memcached.org/
- phpFastCachephpFastCache is a high-performance, distributed object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. To know more how to use please use following link:http://www.phpfastcache.com/
- Use of caching & DB caching in PHP
- Use of proper hosting server : It is recommended to use proper hosting services to boost site speed. Dedicated hosting server is more preferable over shared hosting.
- Use of CDN server : CDN is an extension of cache optimization designed to supercharge website performance aimed specifically at globally dispersed Web traffic. Following are some of popular CDN networks.
Reference links :
- http://blog.crazyegg.com/2013/12/11/speed-up-your-website/
- http://singlegrain.com/conversions-2/how-to-dramatically-improve-page-load-times/
- http://diythemes.com/thesis/improve-website-pagespeed/
- https://blog.kissmetrics.com/speed-is-a-killer/
- https://moz.com/blog/15-tips-to-speed-up-your-website
- https://kinsta.com/learn/page-speed/
- http://conversionxl.com/11-low-hanging-fruits-for-increasing-website-speed-and-conversions/