I’ve been looking at AWS docs all day and I still feel like I’m missing a variable or two in my upgrade formula. I’m hoping that someone with far more EC2 experience than me has an answer, for which I’d be eternally (or at least till the end of next week) grateful.
I inherited a Wordpress site run by a medium-sized nonprofit back in 2017. It’s hosted on EC2 and running on an m4.large (8G RAM, 2vCPUs, 100G EBS storage). It’s currently using an old and deprecated version of Ubuntu (18.04). I rebuilt and reskinned Wordpress a couple of years ago when I also made a request to upgrade the OS and expand the size of the instance to meet growing demand. I finally got a response this week: go for it.
The technical requirements are fairly simple. I have to keep the current structure of the site: Ubuntu, full CLI server access, MySQL running on the instance (so no RDS), no CloudFront (the site uses BunnyCDN).
So if you were going to upgrade from an m4.large, what instance type would make sense? We will aggregate a Laravel-based site on this same server so it definitely needs a memory boost, perhaps to 32G to give room for future service expansion.
You haven’t given any indication what performance constraints you have, or are expecting. What’s the load like right now on the existing instance? Look at some perf metrics and decide if the system is using all the resources available to it. If it is, or using enough that a bump in traffic would cause it to run at >90% sure consider upgrading. But it’s not clear that’s the case from your post.
As for what instance type you would upgrade to, that again depends on your proposed needs. If you need more memory, rather than more CPU, consider an R-type instance. If it’s the inverse and you need more CPU than memory, go for a C-type instance. If you just need a decent combination of both stick with an M-type.
You didn’t mention if you’re on-demand or purchasing RIs. If you are on-demand, just bump the instance type to whatever you want and try it out. You can just change it whenever you decide it isn’t the right fit. If you need to buy an RI for the new instance type, you need to go off and do some analysis before making this choice to ensure you have the requirements nailed.
In the cloud world single instances are kinda dangerous. I’d use an elb, shared storage and load balance multiple smaller auto scaled instances that map to the wp storage.
Ec2 instances have a family and then a size. In yours it’s the m family which is a general type instance. There’s a family for memory heavy applications, cpu heavy applications, GPU heavy, etc.
It’s hard to recommend what you should go to without knowing how your existing instance is holding up from a performance perspective.
If you are fine as is and just want to modernize, I’d just go with an m6a.
This is ultimately a good answer, but for smaller services it’s hard to justify the added complexity, let alone costs. I was going to mention that this sounds like it’s exposed to the internet directly and that makes me cry inside, but if OP isn’t interested in doing better then maybe they have their reasons for doing it this way.
If inplace upgrade, the m4 type is not Nitro-based, so it will need ENA and NVMe driver updates before switching to m/r/c5 and upwards (Nitro-based). There is an SSM document that does this for you.
m/r/c6a is still the cheapest per hour as of now for x86_64, but consider m/r/c6g ARM-based for an even lower price per hour.
Also don’t rule out t3a and t4g burstable types for an even lower price per hour, e.g. t4g.large gets 2 vCPU with baseline 30% utilization. Check CloudWatch metrics to assess your CPU requirement.
When I started at AWS back in 2016 they had just started an onboarding program where you needed to go through meetings and architecture information gathering and finally build a cloud enabled poc of an architecture. My project was making Wordpress cloud ready with shared storage shard/redundant dbs (both self managed and rds), auto scaling, load balancing, CDN, scalable reverse proxy with caching and then I built a cloudformation based load testing platform.
I really should have written a blog about it. Actually should have kept the code because even to this day it was pretty slick. Hindsight is always 20/20.
Have you considered moving to a managed wordpress? Having to manage the OS, DB, security, patching, etc, is a lot of work, and usually, as it seems in your case, ends up with all those task relegated.
AWS is excellent for a lot of use cases, but for this one, I would choose a good provider that solves all the infra stuff for me, specially the security aspect.
That wordpress as you describe it is a time bomb, and I’m not worried about the wordpress itself, my biggest concern would be someone getting access to the underlying EC2 instance and then to your AWS account, believe me, sh*t escalates really fast from there and end up being really expensive.
Good callout. I got the impression that OP was considering a new build and not just a direct instance type change, but you’re absolutely right that this will be required if they do the latter.
I don’t understand why it seems like you think you need to guess at this. Determine your resource requirements and pick an instance type that meets those, within the constraints of your budget. That should be fairly straightforward for you but impossible for a random person on reddit to figure out just from your post.
Correct. This would be a new build because I also have to upgrade the OS to Ubuntu 24.04 LTS.
CPU performance rests @~15% with some (<3) peaks at 100% during the day.
I know I need more memory because Apache2 gripes about MaxRequestWorkers being set too low. However it was calculated based on available memory when I set it up.
We’re on reserved instances which is why I’m doing this instance research. I’ve sort of narrowed the candidates down to m5.xlarge, c5.2xlarge and t3.2xlarge. Any comments?
Do not use a T-type instance for a Production workload unless you really know what you’re doing, and what the limitations of the platform involve. I’m speaking specifically of CPU credits - the “burstable” nature of the T instance types lends itself to low cost but only on a predictable curve where you know precisely how your workload performs and how your service responds to that load. When your CPU credits are exhausted on a T instance, you get baseline performance only which catches a lot of people out; this is because for most workloads the burst performance is consumed in a way that is invisible to them, and their testing never reveals the limitation. Make sure you understand what a T instance type will cost you if you run out of CPU credits. More info here: https://aws.amazon.com/ec2/instance-types/#Burstable_Performance_Instances
You need to figure out where your 100% CPU usage is coming from and resolve that. It sounds unexpected, so identify that first and see if there’s something you can do about it. If it’s a resolvable issue, resolve it on the current platform and then gather some more data to inform your new instance type requirements. If it is not resolvable and is therefore an expected result of how your platform works, you’re going to need to figure out if you can throttle that performance hit or continue to deal with it. A ~15% nominal CPU usage is low enough that I would not be enticed to upgrade instance performance due to it - therefor if you are only upgrading because of the spike to 100% then you are going the wrong direction; identify that perf hit’s source first.
What is your memory utilization like? And why is Apache complaining? Are you saying you have configured as many workers as you can given your memory footprint? If so, how close to max memory utilization do you get? Are you paging/swapping as a result? Remember that when you migrate to a new performance paradigm with an instance upgrade, you should re-tune your entire stack’s configuration to maximize resource efficiency/effectiveness. If you throw more memory at Apache workers, be sure you know why you need it and whether the additional workers are required for your use case otherwise you may be wasting that cost on something that doesn’t directly benefit you. Alternatively, it could just be the cheapest method of a performance boost and isn’t worth the time to truly figure out, so you do you - just keep an eye on those problems because perf is a hard nail to hit with random hammers.
Your use case doesn’t seem like you need a C instance type. And I recommend against the T instance type just generally. Stick with an M type, go up a size if you really want to. Do some perf analysis for your EBS usage and determine if you need either a PIOPS volume type or potentially more dedicated bandwidth that would come with an even larger instance type. Cloudwatch is your friend, set up graphs and dashboards to watch your usage and find when you bump up against the limits.
Not being considered. The site has a lot of custom work: cron tasks, daemons, wrappers, shell scripts, custom security, custom theme functions and a workflow deployment mechanism that requires privileged CLI access. It’s got to be migrated as-is if only because I have neither the time nor the inclination to rebuild what already works. It’s not a time bomb. The sites have run flawlessly and without intrusion for the past 9 years. I’ve been building and maintaining *nix servers and mediated discussion/CMS systems since the mid 1980s so my scars are quite old.
Not trying to diminish the very good advice here, but just want to point out that when CPU credits run out, it just means you pay extra for the surplus credits consumed, IF you have the default unlimited mode setting remain as-is. For 3 spikes in a day for a t3.2xlarge 40% baseline, more so coming from a 2 vCPU config upgraded to 8 vCPU, it would hardly run out of credits. Even if it did, it would still be within reasonable threshold before the next jump up price-wise to a non-T type. For this reason, we have numerous production workloads running on T types at lower cost without performance issues.
That said, t3.2xlarge 8 vCPU 32GB RAM costs the same as r6i.xlarge 4 vCPU 32GB RAM (noting OP seemingly prefers Intel CPUs), with core count halved but without the CPU credit concerns. I don’t see r6i in OP’s list, and it should definitely fit the bill for memory-intensive workload.
If you’re on demand (not purchasing reserved instances in advace) you can just change it as you go. Make a change, measure it, change again.
What is important here is cpu and memory utilization. Look at your cloudwatch metrics, maybe set alarms, and scale your instance when needed.
The letter M means that cpu and memory is balanced. If you need more cpu and less memory move to a C instance, viceversa move to a R instance.
The number means the generation. 4 is quite old. You should most likely move to 5, 6 or 7. Newer cpus are usually faster, but do check the cost. Older cpus get deprecated, you’ll be pushed off 4 at some point, so I’d try to move off before you’re forced in a few years. Graviton types usually offer better bang for the buck, but depending on your workload you might have to reinstall everything in its arm version, starting with the operating system.
Finally “large” is the size. xlarge is double everything. 2xlarge is double double, 4xlarge is double double double, and so on. Cost grows proportionally.
Seems like you’re not considering your customer enough. Non-profits are typically cost conscious why not save them money by deploying serverless? Vertical scaling IS the method someone who hasn’t changed in 30 years but it will reach a top end and become more and more expensive
This gives you savings on an instance family, giving you the flexibility to move up/down on the sizes.
Also, consider graviton over Intel/AMD. And AMD over Intel.
Pick the newest generation if it makes financial sense.
I would not pick 5th generation (m/c/r5) right now. For AMD [m|c]6a is kind of a sweet spot currently, but I Graviton beats it for most use cases.
Testing out graviton would be dirt cheap with spot instances.