AWS: Where the f**k am I going wrong?

[ad_1]

I’ve reached a point of rebuilding from scratch, making different changes and tweaks in attempts to identify bottlenecks and am now just utterly ready to slam my head through a concrete wall because getting wordpress setup in a scaleable configuration while not running at the f**king speed of a snail is proving either me an idiot or the task far less simple than it seems.

Initially I’d been building things up as a multisite following the standard technical outline provided by AWS as well as the numerous guides available in line with this. That is:
– decent EC2 instances running behind an ELB
– separate Aurora database (have gone serverless and stuck to a ~4gb cap in development
– EFS to hold all/part of the Web directory (AWS guides the whole apache Web directory, others to stick to wp-content or even just uploads folder due to NFS constraints)
– ElastiCache as well as W3 Total Cache to cover a majority of available caching methods

Now, I’d put the initial poor performance down to the the multisite having over 15 subsites with some 200+ plugins installed. As much as using a multisite network covered a fair few bits of the centralisation we wanted and meant there was less cross-site integration work to be done with some aspects such as GamiPress. So I reached a point where in time and future budget, running everyone off one system appeared to be slamming too many use-cases together. So wipe it all out, rebuild the infrastructure, run the sites individually and settle on external/third-party software and services for sign-on etc.

I am however right back where I began and am none the wiser on what or where things are going wrong. So here’s a bit of a summary of the infrastructure setup and then brain dump of where I’ve thought of issues/what has been tried.

// General Setup //
– Decent EC2 instance(s)
– RDS instance (Aurora Serverless ~5gb cap)
– EFS (mounted to wp-content)
– ELB

//// EC2 ////
The servers themselves are one of the only things I’m pretty confident are not affecting performance. All the same I’ve changed the between T2, T3, C4, C5, R5 instance classes and tiers within them. On the whole the server has typically had at least 2 vCPUs and 16GB RAM

//// EFS ////
I’m aware of the throughout being related to total capacity on the drive when using General mode and have ensured there’s at least 260GB of data.

I’ve tried provisioned throughput of 10-15Mibs (is this just not enough?) and have not really had any better look with the new elastic mode, I get the feeling it’s not quite responsive enough in a web server use case, by the time the throughput has spiked for long enough for it to increase the request is timing out (but am really just guessing on this as there’s not a lot of indication within the console as to when and how it triggers and scales.

While AWS documentation advises to mount the entire web directory on the NFS, which I have also tried, in the numerous rebuilds I’ve generally stuck to either just the uploads folder or the wp-content folder to keep a majority of core files running of the local EBS volume.

//// HTTPS and the ELB ////
So I did follow the AWS guide for enabling HTTPS using an amazon issued certificate. On one setup i did get this a little wrong and created a redirect loop so am including details here in case I’ve bodged anything up in respect of forwarding/redirecting. The ELB has two listeners HTTP:80 and HTTPS:443 and both forward to the target group as is. The webserver then has the following in wp-config and the .htaccess

WP-CONFIG
define(‘WP_HOME’,’https://domain.tld’);
define(‘WP_SITEURL’,’https://domain.tld’);
define( ‘FORCE_SSL_ADMIN’, true );
if (strpos($_SERVER[‘HTTP_X_FORWARDED_PROTO’], ‘https’) !== false)
$_SERVER[‘HTTPS’]=’on’;

require_once ABSPATH . ‘wp-settings.php’;

.HTACCESS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase /
RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] </IfModule>

So as far as I can tell the ELB should pass traffic to the webservers as is in whatever protocol, wordpress is clear on the updated URL of https not HTTP and that the server will sufficiently rewrite URLS to stick to HTTPS and ensure a trailing slash.

//// PHP ////
For further reference I’ve also made varying increases to:
Max Input Vars
Max Input Time
Memory Limit
Post Max Size

/// Caching ///
So on the initial multisite setups, I’d implemented a fair few caching methods, and while they weren’t top production spec, there was very little improvement on speed. I don’t currently have any caching running on this individual site build, and frankly, I am not bothered about it right now. It made little difference on the multisite setup, and I have been the only user – imo caching should be improving relatively okay speeds. It is not going to shave 12+ second waits (for 1 visitor) down to 1 second for 50 concurrent visitors for example.

_________________________________________
Please discuss, help and advise. On the way home from a 10 hour shift so good chance I’ve missed some details so please do ask away.

[ad_2]
1 Comment
  1. If you are able to share more details e.g. what are you trying to achieve with using AWS, it’ll be easier to suggest ideas/recommendations. It isn’t absolutely clear from the technical issues you are facing. For example, do you have availability requirements that only AWS can deliver, what exactly needs to be scalable and so on.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer