Passer au contenu principal

 Subscribe

Slow page load times can impact your target user audience and discourage them from visiting your website again. A lot of search engines consider page load times as well when ranking results and can impact the visibility of your website on their search engine results.  Before we discuss what steps to take to speed up your web application , lets understand some key design elements in App service that may contribute to latency. Here are two key design elements in App service that can add some latency to a page request:

  • Web Apps uses remote storage disk 
  • If you are not using MySQL in-app feature , then any other MySQL solution used with Web Apps is not living on the same machine that processes the incoming reuqest 

As a result of these architecture design configurations you get the flexibility of all the various features of App Service but if you code makes too many calls to the storage and/or MySQL database per request it can add latency to the page response time.

Consider implementing these quick and easy steps mentioned below to speed up your application.

1. Web site and Database must be in the same data center

When running your WordPress site on Azure Websites, make sure your database and website are in the same data center. Network latency can increase the page load time for your site if the website needs to go around the world to make a call to the database. Keeping the site and database components in the same data center will reduce the network latency and improve the page load time for your website.

2.Do not use ClearDB FREE MySQL database for production web app

If you are developing the site, you can use the Free MYSQL database that comes with WordPress install from the Websites Application Gallery. But this is not ideal for a production level site. The FREE database has:

  • Max 20MB storage for Database
  • Allows up to 4 connections ( max_connections)
  • Low performance

We recommend to use to a database that can handle your estimated user traffic from the various other options supported by ClearDB as seen here. If you are looking for database with no additional cost  you may want to consider MySQL in-app but it has it limitations

3. Use right MySQL database solution for your web app needs 

Investigate with one of these solutions is right for your database. Investigate and test out your application with these solutions to see the best fit which gives better performance.

  • MySQL in-app which provides you Local MySQL database on the same machine instance hosting your application 
  • MySQL solution offered by ClearDB which is a third-party service
  • MySQL on virtual machines which is an IaaS solution for hosting your own MySQL server.

4. Optimize your database

WordPress auto-saves everything but the disadvantage with this is that your database gets filled with a lot of post revisions, trackbacks, pingback, comments and trash items quickly which needs to be cleaned up manually on a regular basis. With the database plan you are using with your Website there will be limitation to the storage size allocated to your database and you may hit this limit as well if the database is not cleaned up regularly. WP-Optimize is a great plugin which allows you to routinely clean up your database making the database more efficient and filled only with what needs to be kept. It saves you a lot of time without doing manual queries to optimize and clean up your database.

5. Compress Images

If your WordPress site heavy with images, then images can take up most of bandwidth for your site. A couple of things you can do in this case:

  • Store all your media content in an Azure Storage Blob: Use Azure Storage Plugin which allows your website to store any new content to Azure storage instead of uploads directory of your WordPress site. If your site is media content heavy, it can significantly help to use an Azure CDN with the Azure Storage to reduce bandwidth.
  • Compress the images: WP Smush.it is a great plugin that automatically compresses images as you upload them to the media library. There is no data loss during compression and you won’t see any difference in the quality of images. If you have thousands of images are saved in your media library, you can run them all through the plugin, compressing them to a manageable size.

6. Reduce HTTP requests

Every website make multiple dependent requests either to JS, CSS files or third party services or libraries. Putting all JavaScript into one JavaScript file and all CSS in one CSS file is considerably more efficient and reducing the dependent requests wherever possible can help. For CSS/JS scripts you can run a minify plugin like Better WordPress Minify which will combine all of your style sheets and JavaScript files into one hence reducing the number of requests that the browser needs to make. If your site uses third party libraries, it’s better to copy them locally them to make a call to the service that offers the library to reduce bandwidth.

7. Use Azure CDN

If the slowness can be diagnoesd as a result of static content taking a long time to load , then use IIS Static content caching or Azure CDN .  

8. Diagnose if your theme is slowing down your site

Some themes just like plugins can be poorly written and can slow down your site. Test if your theme is responsible for the long page load times. To do this revert to the default WordPress template TwentyFourteen and check if the page load time is much better. If yes, then the Theme could be the culprit. To resolve this pick another theme. If there is no difference in the page load time after reverting the Theme to an older version, the try some of the tips listed in this blog.

9. Diagnose if any plugin is slowing down your site

Some plugins can be the culprit in slowing down your site especially if they are poorly written or configured. Use a plugin like P3 to understand how much all the plugins used by the application do impact your page load time in order to take necessary actions to speed up your site If there are unused plugins, this can add to you page load time as WordPress tries to load all the activated plugins. Clean up or remove all the plugins that are not being used. Used only the plugins that can improve your website and not drag out the performance of your site.

We have seen atleast two plugins being slow Captcha and Visual composer on the App service platform. Find appropriate replacements of these plugins. 

10. Turn off Pingbacks and Trackbacks if you don't use it

WordPress uses Pingbacks and trackbacks methods to alert other blogs that your posts link to.

  • A pingback is a type of comment that’s created when you link to another blog post where pingbacks are enabled.
  • Trackbacks are a way to notify legacy blog systems that you’ve linked to them.

They can be a drain the page speed and are usually better turned off if you don’t really need them. To learn more about Pingbacks and Trackbacks, click here.

11. Specify Image dimension

Before the content is displayed to the end user, the browser had to identify the layout of the content around the images. Not knowing the size of the images, the browser has more work to do figure this out and take longer. It a best practice to specify image dimensions which saves the browser from having to go through this step, speeding things up.

12. Caching

If you start seeing a surge of user traffic hitting your site, you should consider adding some form of caching for your site to handle the spike of traffic. You can use IIS output caching or WP-SuperCache plugin where both methods will cache static files.

  • IIS output caching :It’s easy to configure and setup. It significantly improves site throughput but may prevent confirmation messages from showing up when submitting comments. To learn more about IIS output caching, click here.
  • WP Super cache :It significantly improves site throughput and correctly handles comments submissions and other visitors’ actions. It slightly more complex to setup and configure than compared to IIS output caching. To learn more about Super cache configuration on IIS click here.
  • Wincache : Create a .user.ini under wwwroot of your web application to add additional PHP settings.  Enable wincache settings in a .user.ini wincache.fcenabled = 1 and wincache.reroute_enabled =1
  • Redis cache : Azure redis cache can also be integrated with WordPress with the help of WP redis plugin to get better performance. 

All these optimizations are just a few minutes of work and help you see drastic improvement in the performance of your website.

  • Explore

     

    Let us know what you think of Azure and what you would like to see in the future.

     

    Provide feedback

  • Build your cloud computing and Azure skills with free courses by Microsoft Learn.

     

    Explore Azure learning


Join the conversation