Slow WordPress on EC2

0

Hey! I'm using AWS C7g.xlarge instance to host my WordPress website. The server is running Amazon Linux 2 AMI with LEMP stack that is Nginx as a reverse proxy to Apache, Mariadb, and PHP.

I'm facing a very weird issue. The WordPress Admin panel is working very fast. But when a customers login to the website. The website becomes really slow. It initially take around 5-6 seconds for the customer to be redirected to the customer dashboard and then each page he visits takes up to 10 seconds to load.

The same website with absolutely same code is deployed on Cloudways Vultr server as well. There without any changes, the website works very fast for both administrators and customers.

After days of troubleshooting, I found that on AWS server, Nginx is forwarding the requests to the Apache very fast but it's Apache that takes too long to respond. Hence, the website becomes really slow for logged in users.

Unfortunately, I can't access the server configurations on Cloudways due to their privacy.

But the only difference between my AWS and cloudways server is literally just the Nginx and Apache configuration.

So, I'm looking for someone who can guide me about how can I maximize the Apache performance on my EC2 instance. I already tried increasing the php.ini values but no luck.

Thanks for any help in advance.

asked 2 years ago1420 views
2 Answers
0

Hi,

3 things come to my mind :

  • Apache seems to be too much since there's already one nginx reverse proxy
  • I have a question though. Did you use a AMI from AWS marketplace ? They usually are very well optimized and used by a ton of people so bugs and issues are fixed fast in the community or by the AMI provider.
  • C7g.xlarge is Graviton... this means thats everything installed on the EC2 should be compatible with this ARM Architecture. Maybe the Apache which is runing has been compiled for x86. Maybe the overhead is there ?

I would suggest this readings https://github.com/MkFoster/wordpress-install-notes and recheck

Maybe you can start again with a deployment of your Wordpress on EC2 Intel type first, being sure that everything is working fine then migrate like discribe here : https://www.keyq.cloud/insights/migrating-your-x86-ec2-web-servers-to-the-amazing-aws-graviton2-instances/

I hope it helps. Let us know !

Cheers,

Vince

profile picture
answered 2 years ago
  • Thanks for taking the time to answer my query, Vince. I highly appreciate that.

    1- The server is running Amazon Linux 2 AMI.

    2- You're right. The issue could be that the Apache has been compiled for x86. But unfortunately, that's not the case here.

    I tried to launch the same website on C6a.large which runs on an Intel processor with x86 architecture but the results were identical.

    I'm totally fed up of all this because apparently, I have tried every possible solution but WordPress for customers only seems to be running fast on Cloudways. I even tried launching a high-performing server on Digital Ocean. But the results were the same as on Amazon EC2.

    I don't know what special PHP packages are running on Cloudways or how they configured their servers that only there, the website code is running fast.

    At this stage, I have no idea how I can troubleshoot this issue because the issue is not with the code but with the server.

    Thanks!!

0

Hello,

How did you install the Wordpress and the underlying components? I've used in the past (and actually still use for my personal stuff) the Wordpress AMI from Bitnami - it was very fast even on the smallest instances.

AWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions