Testing out Elastic Search and Redis

I was interested in how much Elasticsearch and/or Redis cache would help to speed up a site, so I got to work testing it. I created a vanilla WordPress install with WooCommerce installed, I then populated this install with 20,000 posts that each contained a couple of paragraphs of “Lorem ipsum“. I chose to install the Storefront theme in order to have a functional WooCommerce site as well as adding a little overhead outside of the default TwentyX theme.

When running the test I simply went to the blog page and did a search for “Lorem ipsum” which all of the 20,000 posts contained, the numbers shown are the times/queries/etc after the search was completed which I obtained from the Query Monitor WordPress plugin.

Searching for “Lorem ipsum” with both Elasticsearch and Redis enabled

Page Generation Time: 0.39s
Peak Memory Usage: 12,445kB
Database Query time: 0.0002s
Database Queries: 2

Searching for “Lorem ipsum” with only Redis enabled

Page Generation Time: 0.37s
Peak Memory Usage: 11,377kB
Database Query time: 0.0018s
Database Queries: 21

Searching for “Lorem ipsum” with only Elasticsearch enabled

Page Generation Time: 0.51s
Peak Memory Usage: 13,224kB
Database Query time: 0.0499s
Database Queries: 83

Searching for “Lorem ipsum” with neither Elasticsearch nor Redis enabled

Page Generation Time: 0.83s
Peak Memory Usage: 11,513kB
Database Query time: 0.04612s
Database Queries: 27

As you can see from the results while there seems to be a bit more memory used when enabling both, the overall results are much better. Of course, depending on additional plugins that are installed or even the theme the results could vary from site to site.

In the future I would like to run this test again but utilizing a theme like GeneratePress which is known for its minimalism and performance.

Information

Note: Kinsta no longer provides the Elasticsearch add-on due to the license change.