
- Views: 4.2K
- Category: Web Development
- Published at: 10 Sep, 2019
- Updated at: 12 Aug, 2023
How to improve your website performance OR speed
How to improve your website performance OR speed?
Many factors are involved if you talk about the website's performance; we will discuss the Factors and the solutions to check them and solve the optimized website/web application.
What is Page Speed..?
Page speed is the first factor that hurts your site, and We can describe the page speed as 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 receives your information of the first byte).
You can check your website's speed from Google's tools named PageSped insights, and we also have another tool to check your website or web page speed, the GTmetrix.
Page speed is essential if you talk about the user experience; page speed for a long time may increase your bounce rate, and it also impacts the negative effect on your website.
Compress your files
You can reduce the CSS, HTML, and Javascript using the Gzip software and application software for file compression.
Minify CSS, javascript and HTML
You can also optimize your code to remove unnecessary code (spaces, commas, and 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 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 receive affects your response time because each page uses the resources for your user. You can optimize your database queries and check your slow routing 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 correct file format 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 third-party services to optimize your pictures. I mostly use 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 in the database; we usually have the left join and the right join sometime; we use the full join depending on the condition if you have a complex query. You are joining 4+ tables, and you have millions of records; it takes time to fetch the results from the database. And if you are using multiple joints with a like query, it takes too much time to fetch the data from the database.
This is a 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
The query took 0.0651 seconds; as shown in the above example, we use 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) );
The 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
Suppose your application/website uses the same query multiple times, i.e., your search query in your application. That means your user always uses your search bar to save time, so you must use the database cache for your search query.
You can also hire an agency that can optimize your website for 100$ to 200$, and I prefer Digital Swot.
Conclusion
Page speed is a problem for every website; people ignore this factor, but according to Google, Google consistently ranks those websites with a better page load speed. Many factors are involved in the page load time, compressing the files, image optimization, Leveraging 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 rank your website on Google's first page.
0 Comment(s)