Advertisement
  1. Code
  2. WordPress
Code

How to Use WordPress Plugins Without Hurting Performance

by
Difficulty:BeginnerLength:MediumLanguages:

WordPress has the superpower of extensibility that helped it become the most commonly used content management system in the world. The concept of themes and plugins made WordPress an extremely popular framework to work with, and working with WordPress caused it to have tens of thousands of themes and plugins to use.

But with great power comes great responsibility, according to Uncle Ben. You can't use more than one theme (for most of the time), but you can use an unlimited number of plugins in a single WordPress installation. And that can decrease the performance—but not necessarily every time. In this tutorial, I'm going to help you make use of WordPress plugins without giving up on performance.

Why WordPress Is Awesome

Let's go into a bit more detail about the extensibility of WordPress.

WordPress was first created in 2003, as a fork from another blogging software called "b2 Cafelog". A year later, in version 1.2 released on 22 May 2004, the feature "plugin" was introduced. About a year later, on 17 February 2005, version 1.5 came out with a theme system. (You can check out the full history here, if you like.)

In my opinion, these two versions were the biggest improvements in the history of WordPress. That's because until these versions, the community of WordPress had consisted of users, and with these versions, developers joined the community (and some of the users became developers). If you want to create software that people use (and develop) all around the world, you'll need a large developer community.

And WordPress has one of the largest developer communities in the open-source ecosystem. The numbers are hard to determine so I can't give out an exact number, but it's probably in tens of thousands. And these developers created more than a hundred thousand plugins and themes (combined). 

Because of the large number of plugins and themes, more and more people are using and developing for WordPress, which leads to more and more people joining the community... And this virtuous cycle is the reason that one in every four websites are powered by WordPress.

Are Plugins Bad for Performance?

Short answer: Yes and no. As with most short answers, it doesn't make much sense, though.

You can't measure how much resources plugins use by counting the plugins. The thing is, some plugins take up more system resources, and some don't. I can install over a thousand plugins that don't slow down a website, or install just one plugin to completely take down another.

It depends on a few factors:

  • Purpose: The purpose of the plugin determines how much it will cost in terms of performance. A contact form shortcode plugin uses way less system resources than a plugin that helps you with SEO, for example.
  • Codebase: It's no surprise that poorly coded plugins do worse than well coded plugins. That's why it's smart to make use of frameworks like WordPress Plugin Boilerplate.
  • Environment: Unused system resources aren't necessarily good. I mean, it's good in traffic spikes, but you won't limit your speed to 10km/h if you have a Tesla Model S. If a plugin needs a bit of system resources to function, and you're hosting your project on a powerful server, you don't have to give up on the plugin as you might if you were on a shared server.

How to Choose & Use Plugins Wisely

Now that we've covered why plugins may (or may not) slow down your website, it's time to see how to prevent it from happening. I'm going to write a few things that come to my mind, but feel free to contribute to this part by shooting ideas in the Comments section.

Make Use of the Plugin Performance Profiler

The Plugin Performance Profiler plugin (or P3 for short) is right up your alley for seeing how much your plugins slow down your website by measuring them one by one.

Using the plugin is pretty straightforward if you just want to get a quick summary of your plugins' resource usage. After installing the plugin, simple head over to the P3 Plugin Profiler page under the Tools menu, and hit Start Scan. If you choose Auto Scan, P3 will perform a quick scan by randomly visiting a couple of pages and monitoring how plugins affect page load.

It's a great way to see which plugins are hogging the system resource and which ones don't have much effect.

Choose Your Plugins Wisely

As I said before, poorly coded plugins perform worse than well coded plugins. And in our gigantic WordPress plugin ecosystem, most of the time, you'll have more than one option to choose a plugin that does the same work. If you have an understanding of what a good codebase looks like, you should check out the code of the plugin you choose to use. (You can also benefit from P3's report for this.)

Remember: A popular plugin isn't necessarily the best plugin out there.

Move to a Better Server

Why do people get angry about how Google Chrome hogs the RAM so much? I mean, having more free RAM doesn't mean your computer will work faster. If your computer has eight gigabytes of RAM and Google Chrome is using one gigabyte, it's because Google Chrome needs one gigabyte to perform better.

Same thing goes for servers. If you have more system resources, you can use them for more things. If you don't need to use a powerful server, there's no point in using one. If you need a more powerful server to use more plugins, there's no point in trying to achieve speed on a shared server.

If you have the system resources, or if you have the resources to have the system resources, don't be shy about using the plugins you need.

Conclusion

You shouldn't be all "I shouldn't use more than (X) plugins" or "using an SEO plugin will slow down my website, so I shouldn't use it even though I need to". You can use as many plugins as you need (or want), providing that you choose your plugins and your server wisely.

What's your take on this? Feel free to share your thoughts in the Comments section below. And if you liked this tutorial, don't forget to share it with your friends!

Advertisement
Advertisement
Looking for something to help kick start your next project?

Envato Market has a range of items for sale to help get you started.