How to improve your website performance OR speed

How to Optimize your website

Many factors involved if you talk about the performance of the website, We will discuss the Factors and also the solutions on how to check them, and we also discuss how to solve the optimized website/web application.

What is page Speed..?

Page speed is the first factor which hurt your site, and We can describe the pages speed either the page load time(The time it takes to display the full content of your website or the specific page) or “first byte” (that means how long your browser receive your information of the first byte).
You can check your website’s speed from Google’s tools named PageSped insights, and we also another tool to check your website or web page speed, which is the GTmetrix.
Page speed is essential if you talk about the user experience, Page speed with a long time may increase your bounce rate, and it also impacts the negative effect for your website.

 

Compress your files

You can reduce the size of the CSS, HTML, and also Javascript using the Gzip software and it’s application software for file compression.
Minify CSS,javascript and HTML
You can also optimize your code that means remove the unnecessary code (spaces, commas, and also other unused code).

 

Use the Leverage browser cache.

You can save your information like CSS files, images, Javascript files, and other resources, once you keep this kind of information in your cache, so the browser doesn’t have to reload your whole page.
You have to improve your server response time
How much traffic you received affect your response time because each page uses the resources for your user. You can optimize your database queries, check your slow routing if you want to improve your server response time.

 

Use the CDN (Content Delivery Network)

CDN stands for the Content delivery network; basically, it is the networks of the servers that distribute your loading, in simple words, you have multiple copies of your website and copies stored in different regions so your user can access your website fastly.

 

Image optimization

Ignore the larger image sizes, and also you have to select the right file formate for your pictures(png and jpg are better for your photos because they are better for your graphics)
Optimize your images before using them on your website/web application, and you can get the third party services to optimize your pictures I mostly use the Tinypng to reduce the size of my files.

 

Remove the unnecessary joins in Codeigniter

We use the joins when we get the data from the multiple tables from the database, we usually have left join and also the right join sometime we use the full join it depends on the condition if you have a complex query. You are joining 4+ tables, and you have millions of records; then definitely it takes time to fetch the results from the database. And if you are using the multiple joins with a like query then definitely it takes too much time to fetch the data from the database.

This is the complex query example

SELECT DISTINCT `productListing`.`prod_id`, `productListing`.`mac_purpose`, `productListing`.`mac_machine_name`, `productListing`.`mac_description`, `productListing`.`mac_slug`, `productListing`.`mac_date`, `productListing`.`mac_manufacturer`, `productListing`.`user_id`, `productListing`.`mac_location`, `productListing`.`mac_currency`, `productListing`.`mac_price`, `productListing`.`mac_condition`, `users`.`u_company_name`, `users`.`u_person_name`, `users`.`u_email` FROM `productListing` JOIN `users` ON `users`.`u_id` = `productListing`.`user_id` WHERE `users`.`u_status` = 1 AND `productListing`.`mac_status` = 1 AND ( `mac_machine_name` LIKE ‘%a%’ ESCAPE ‘!’ OR `sku` = ‘a’ OR productListing.category_id IN(SELECT c_id from categories where c_title like ‘a%’ and `c_status` = 1) OR productListing.user_id IN (SELECT u_id from users where u_company_name like ‘a%’ and `u_status` = 1) OR productListing.sub_category_id IN (SELECT sub_id from sub_categories where sub_title like ‘a%’ and `sub_status` = 1) OR productListing.mac_manufacturer IN (SELECT man_id from manufacturers where man_title like ‘a%’ and `man_status` = 1) ) LIMIT 20

Query took 0.0651 seconds; as you can see in the above example, we use the multiple joins to fetch the data with like.

 

This is the same query without joins.

SELECT DISTINCT `productListing`.`prod_id` FROM `productListing` JOIN `users` ON `users`.`u_id` = `productListing`.`user_id` WHERE `productListing`.`mac_status` = 1 AND ( `mac_machine_name` LIKE ‘%a%’ ESCAPE ‘!’ OR `mac_sku` = ‘a’ OR productListing.category_id IN(SELECT c_id from categories where c_title like ‘a%’ and `c_status` = 1) OR productListing.user_id IN (SELECT u_id from users where u_company_name like ‘a%’ and `u_status` = 1) OR productListing.sub_category_id IN (SELECT sub_id from sub_categories where sub_title like ‘a%’ and `sub_status` = 1) OR productListing.manufacturer IN (SELECT man_id from manufacturers where man_title like ‘a%’ and `man_status` = 1) );

Query took 0.0071 seconds, so as you can see, we have the same query without joins.

So you have to check each query execution time and optimize the query as we did above.

 

Database Cache

If your application/website using the same query multiple times, i.e., your search query in your application, that means your user always uses your search bar to save their time, so you have to use the database cache for your search query.

You can also hire an agency which can optimize your website for 100$ to  200$, and I prefer Digital Swot

 

Conclusion

Page speed is the problem for every website, people always ignore this factor, but according to Google, Google consistently ranks those websites which has a better page load speed, many factors involved in the page load time, compressing the files, image optimization, Leverage browser cache, CDN, Database Cache, and Query Optimization. You can get the first rank on google if you solve these problems, make sure many other factors also involve to rank your website on google first page.

shakzee
administrator
My Name is Shehzad Ahmed and I am a full-time developer with over 7+ years of experience. In that time, I’ve worked as a developer with many big and small firms and was teaching web design and development skills to many keen learners and by the time passes I’ve found a great passion and potential on myself as a teacher on this particular field and now I am a full-time teacher and working as a freelancer.

Leave a Reply

Your email address will not be published. Required fields are marked *

Featured Courses

Learn Web Development and web designing in few months from shakzee with real-world experience. Get up to 80% discount!