It is important that your Magento site is updated and optimized regularly to drive maximum traffic and improve performance. Below are certain steps that you can take. Make sure you perform them periodically.
Review contents:
Regularly adding fresh contents to your domain will draw interest to your site. So does removing or updating irrelevant and outdated ones. This will also help you to improve your site ranking. Regularly updating the existing contents will make sure that search engines do not categorize them as old. And also make sure that the external links are working correctly to remove those 404 errors.
Best SEO practice:
Search Engine Optimisation is required in ranking a website on a search engine thereby attracting relevant and valuable traffic to your website. You can follow general SEO practices from the below link to optimize the site.
https://magento.com/blog/small-business/7-seo-best-practices-setting-your-magento-store
Updating extensions and applying patches:
Outdated extensions like any other software create vulnerability to a website. You can expect attacks if you don’t update them. Also, Magento releases security patches regularly and you need to apply them to increase security. To install patches, you can follow the below steps or can contact respective hosting provider after uploading the patch file to your document root.
1. Disable the compiling of your site from System > Tools > Compilation. Do not forget to re-enable it after the installation.
2. SSH into your document root after uploading the patch file.
3. Run the command sh patch_file_name.sh or sh patch_file_name.patch according to the file type.
4. To verify patch has applied, you can use the command
cat app/etc/applied.patches.list
Alternatively, you can create and run a PHP script (patch.php in document root) from your browser (http://www.domain.com/patch.php) with the below content after disabling compilation and uploading the patch file.
<?php
print("<PRE>");
passthru("/bin/bash patch_file_name.sh");
print("</PRE>");
echo "Done";
?>
Clearing logs:
Logs are generated when events occur and are helpful and important to track something. Magento logs can grow in size affecting the database performance. Log clearing is a part of database maintenance. You can schedule logs to be cleared automatically using cron jobs. You can refer the below Magento reference for configuration.
https://docs.magento.com/m1/ce/user_guide/system-operations/system-log-cleaning.html
Flushing cache:
Magento has different varieties of caches. Cleaning them regularly helps to improve performance. If any recent changes made are not reflected, clearing the cache will help. Go to System > Cache Management to see the different cache clearing options. You can see the status of each cache there and will have the option to refresh it when marked as invalid. For that, select the cache and click submit with a refresh as action.
To clear the Magento product image cache, click the Flush Catalog Images Cache button under Additional Cache Management in the Cache Storage Management page. This will clear the directory media/catalog/product/cache.
Similarly, to clear the JS/CSS cache, click the Flush JavaScript/CSS Cache button under Additional Cache Management in the Cache Storage Management page.
By clicking Flush Magento Cache, the files in var/cache will be cleared. It will remove all the default Magento cache with associated Magento tags.
Flush Cache Storage will remove the cache regardless of Magento tag. This will help when an alternate cache location is used and any cache used by other applications will be removed.
Enable LiteMage cache:
It is recommended that you give LiteMage Cache a try when LiteSpeed is used.
You can refer the below links to set it up.
For Magento 1:
https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:litemage:installation
For Magento 2:
Use fewer extensions/modules:
There are many Magento extensions/modules which are very inefficient and will result in a serious slowdown to your store. When you are facing any slowdown, try disabling the extensions one by one and you may just find the culprit for your store’s slowdown!
It is usually recommended that you use fewer extensions and make sure your versions of the installation and extensions are all up to date for the most optimal performance. The more extensions, the more HTTP requests.
Magento Re-indexing:
In some cases, manual updates are required on every object-store. Indexes are used to speed up MySQL queries. You can see the option to re-index from System > Index management. Alternatively, from the SSH session, you can perform re-indexing by using the below commands from the domain document root.
Magento 1.x
php bin/magento indexer:reindexall
Magento 2.x
php shell/indexer.php –reindexall
Avoid Saving Sessions in Database:
It is not recommended saving session files in the database unless absolutely necessary as it will only add unnecessary stress to MySQL. Our servers run on the lightning-fast Solid State Drives (SSD) so saving sessions in your files will not cause slowdown and is considered as the best way to relieve any stress to MySQL. You need to edit the database configuration file, local.xml(Magento 1.x) or env.php (Magento 2.x) in app/etc directory in your domain document root.
If you set session files to be saved in the database, look for the following lines:-
<session_save><![CDATA[db]]></session_save>
Replace them with:-
<session_save><![CDATA[files]]></session_save>