The World Wide Web is an application of the client-server model over a network. The client is a web browser, the server is a web application server and the network is the Internet.
Web browsing is a series of actions and reactions. The action is done by sending a request by a web browser and the reaction is done by sending a response by a web server to answer the request.
To speed up a web application, you should work on three main levels:
- The server
- The network
- The client
The following map summarizes what should be done at every level:
1. THE SERVER
At the server level, we have:
- Hardware:
- Increase CPU, RAM and Hard disk. Use SSD hard disks if affordable.
- Software
- Operating System: Defend against viruses and worms.
- HTTP Web Service: Enable compression and caching;
- The Application
- The code:
- Pure code: Use software engineering performance rules; decrease loops, conditions and variables; avoid bugs by performing adequate tests before releasing.
- HTML: Use external scripts and styles; Style using <div’s> with CSS and not <table’s> or white spaces; compress HTML; remove comments and unnecessary texts.
- The resources:
- Scripts: Minify and combine
- Styles: Minify and combine
- Multimedia:
- Text: Remove white spaces
- Images: Compress and provide scaled images
- Animated images: decrease animated images
- Videos: Use external videos
- Third party API’s:
- Avoid or decrease third party API’s; implement third party functionalities locally to avoid iframes; download third party resources to local server to decrease number of calls.
- The Database:
- Normalize the DB.
- Eliminate redundant data;
- Avoid more than 3 to 5 table joins.
- Avoid data conversion in SQL calls; decrease conditions.
- Index the DB
- Do not backup during high traffic hours.
- Cache queries
- The code:
2. THE NETWORK
- Host
- Hosting option: Dedicated is faster than VPS which is faster than shared hosting.
- Server location: Make it closer to your target market.
- Bandwidth: Increase it based on page size and page views.
- Clouding: Use clouding to split the load over multiple application servers.
- Content Delivery Network (CDN): Use CDN for static resources.
3. THE CLIENT
- Mobile first web design: Responsive web design
- Lazy loading content
- use AJAX calls
- Decrease page size
CONCLUSION
A fast web application is not a coincidence. Related team-members should be performance-driven at every level, otherwise, bottlenecks will exist in many places along the road from the server to the client and the cost of enhancing performance issues at later stages will be very high and hard to detect and fix.
What are the fixes that would make the biggest impact, from your position or point of view?