How do I add indexes to WordPress Database?

The WordPress database is already indexed. See this codex article for a detailed list of indexes per table: http://codex.wordpress.org/Database_Description And even if it weren’t, you’d need to know what queries are being run in order to effectively add indexes. Meaning, there would be no quick fix–you’d have to learn how indexing works, figure out what … Read more

Using Global Variables Expensive for PHP

Here is a basic class which you can create once: if ( ! class_exists(‘my_class’) ) : class my_class { public $my_var; // This variable is for a single instance static $instance; function __construct () { // Call other methods like this $this->initialize(); } function initialize () { // Populate your variables here $this->my_var=”any value you … Read more

What are best practices for configuring a server for WordPress sites?

It’s a very loaded question, I’ll try my best here, keep in mind it’s 4am, so I’m just giving you highlights, not detailed explanations. Linux I’m assuming you’re using a recent version of Ubuntu Change the default SSH port from 22, to something else (/etc/ssh/sshd_config). Either enable AllowGroups or AllowUser in the sshd_config, Install fail2ban … Read more

What is the expected limit for acceptable performance of WordPress without any adjustments?

A lot of this is very subjective and hard to answer because of different server environments, themes, size of database etc. In your experience, when is the time one needs to start thinking about scaling up? If you are concerned with your users experience you should already be practicing sound front end performance techniques. When … Read more

Are there server performance benefits to fetching only specific fields when querying the REST API?

I understand that having less data being downloaded improves the experience to the end user, but my question is related to the actual server performance, would the response be faster? Would adding _fields[]=id&_fields[]=title, etc… to the above url improve server performance? No it would not, and for several reasons. When you ask for a post … Read more

How to implement a ‘fail whale’ to graciously limit server load (Solutions for system capacity governing)

Twitter and other high-volume sites probably do this one layer ahead of the servers. Probably with a load balancer that can detect the server load over all servers and if the load is too high (when machines stop replying) they redirect traffic to a server that returns only the “fail whale” page. This answer on … Read more