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 optimize website/web application.

What is page Speed..?

Page speed is the first factor which hurt your site, 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 websites 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 very important 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, 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 save 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 definitely 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 pictures because they are better for your graphics)
Optimize your images before using them on your website/web application, you can get the third party services to optimize your images I mostly use the Tinypng to reduce the size of my files.


Remove the unnecessary joins

We use the joins when we get the data from the multiple tables from the database, normally we have left join and also the right join sometime we use the full join it totally depends on the condition if you have a complex query and 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 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 in multiple times i.e your search query in your application that means your user always use 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 be optimize your website for 100$ to  200$, I personally prefer Digital Swot



Page speed is the problem for every website, people always ignore this factor but according to Google, Google always 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.

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. Web design and development constantly developing every day with new trends, ideas, and innovations. That’s why nowadays you need to learn and keep yourself up-to-date with everything daily and that’s what I do and that is something that I love because I am so passionate about it! When I have spare time I use to give time to my web development community. Teaching kids, managing online programming groups, attending a conference and making blogs, I like keeping myself up-to-date and engaged in my field always. I have my expertise in (PHP, Codeigniter, Laravel, Bootstrap, WordPress, SQL, Query Optimization, Data Science and Design Patterns). Anyone who wants to learn and know anything about web development and design I am always available for that and would love to help out. I always love to be looking out for new things and that is why I spend a lot of my time learning new techniques and helping other people learn web development and design through various groups and web development tutorials as well as online courses.

Leave a Reply

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

WhatsApp chat