0

I've encountered several issues with Amazon EC2 & Bitnami Wordpress AMI (RedHat) on small instance.. and honestly I don't know who to ask :) I'm not a SysAdmin/Linux expert, but I've learned basic SSH commands and other things required to keep going for a basic start.

So here's what is happening:

Wordpress website is loading extremely slow - PageSpeed & YSlow score is 27 of 100. I think this is caused by memory_limit in php.ini. When I installed Bitnami Wordpress AMI, imported WP Users, set the theme and other basic things, I wasn't able to even access wordpress website - just a blank page showed up. After few solutions, I've tried increasing php.ini memory_limit from 32M to 128M (Max). And I've increased WP memory limit to 64M.

Website loaded properly and users were able to access it - but it's extremely slow. When I try decreasing php.ini memory limit to 64M, website shows up a blank page again.

Only thing that I can think of currently is increasing EC2 instance from .small to .large or similar. Please let me know your thoughts on this issue.. and many thanks!

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
MVMojo
  • 1
  • 1
  • 1
  • A buddy switched away from EC2 when he was getting 500ms latency between web server and database server. Are you seeing similar latencies? – sarnold Jul 02 '12 at 23:54
  • IO in EC2 can be extremely slow. This can kill MySQL (I assume that's your storage?). Make sure you also allocate enough memory to MySQL. If you are not already, use an EBS backed instance and store data (not the OS) on a software RAID partition (e.g. 8 striped EBS instances). See http://stackoverflow.com/questions/3630506/benefits-of-ebs-vs-instance-store-and-vice-versa/3630707#3630707 – Eric J. Jul 02 '12 at 23:55
  • @EricJ. I don't think striping EBS volumes would be a good performance improvement. EBS uses network IO, so even if you are striping on 8 EBS volumes you still have a single network interface that all that traffic has to go through. RAID striping helps overcome disk speed as a bottleneck, but it won't help when network is the bottleneck as with EBS. – nickgroenke Jul 02 '12 at 23:59
  • @user1087981: You're wrong :-) You will see a near-linear performance improvement up to 8 EBS volumes on a large instance (probably up to about 4 on a smaller instance due to less capable NIC). I benchmarked 8 volumes on a large personally. – Eric J. Jul 03 '12 at 00:12
  • @user1087981: See also http://www.hightechinthehub.com/2012/02/importance-of-striping-in-the-cloud/ – Eric J. Jul 03 '12 at 00:13
  • I had the same issue, then created an elastic IP and completed my vhosts setup in httpd.conf and routed real domain name then reinstalled wordpress by editing the config file changing the table prefix and running install again. It was worthlessly slow CSS didn't even show, now fast, same AMI micro instance hate to give it out here but subox.one – Rich Bianco Aug 15 '18 at 03:28

4 Answers4

5

We had a similar problem with a Php/MYSQL Application which we moved to an EC2 instance connecting to an RDS database instance. Pages were taking 10x longer to load than on our previous server, even though all specs were the same, i.e. number of CPUs, RAM, clock speed, and the versions of Php/Apache were identical.

We finally found the cause of the problem, the default setting for an RDS database for the Cache query size is 0. This causes the database to run extremely slowly. We changed the query_cache_size to be 1000000000 (1G) (as the RDS instance had 4G of RAM) and immediately the application performance was as good as our previous (non-AWS) server.

Secondarily, we found that an EC2 server with MySQL installed locally on the server did not perform well, on the Amazon Linux build. We tried the same thing on an EC2 instnace running Ubuntu, and with a local MySQL database the performance was great.

Obviously for scalability reasons we went with using an RDS instance but we found it interesting that moving the MySQL database onto the EC2 instance radically improved the performance for an Ubuntu linux EC2 server but made no difference with the Amazon Build of Linux.

Peter
  • 51
  • 1
  • 2
2

Since you have not received an answer yet, allow me to summarize my comments into something that is hopefully useful:

Some areas you can affect are:

  • PHP needs RAM, but so does your database (I know nothing about Bitnami, but Wordpress uses a SQL database for storage).
  • Allocate enough RAM to PHP. Seems like that's somewhere between 64MB and 128MB.
  • If you are using MySQL, edit my.ini. If you're using a default configuration file for MySQL, the memory allocation parameters are dialed way too low. If you post your my.ini file, I can give suggestions (or if you're using a different database, state which that is).
  • Consider striping multiple EBS volumes for your data partition.
  • Use an EBS backed instance if you are not already.

You can make a more informed decision about where to tune if you have profiling results in hand.

Community
  • 1
  • 1
Eric J.
  • 147,927
  • 63
  • 340
  • 553
  • Thank you so much on your useful advice. I'll definitely try profiling the app and getting back here about it. Not sure how that is done though... I'll search around. #Point 3 I was unable to find my.ini file, only my.cnf Here is 'my.cnf' file: [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid Just that. No reference to any kind of memory or similar :( – MVMojo Jul 03 '12 at 22:11
  • #Points 1 & 2 Yes I'm using MySQL. Current memory_limit that is set is 128M. #Point 4 Did it, nothing changed unfortunately. Currently I have only one instance by the way. #Point 5 Yes I'm using EBS-backed instances. Not sure thought what I can do if instance crashes or something goes wrong.. I understand that EBS is best backup solution for EC2, but I'll poke around to see how this can be used in practice. – MVMojo Jul 03 '12 at 22:12
  • Some versions of MySQL use my.cnf instead of my.ini. On Linux, there are sometimes overrides for my.cnf in subfolders. See the MySQL Config File topic here http://dev.mysql.com/doc/refman/5.1/en/option-files.html – Eric J. Jul 03 '12 at 23:12
2

I would suggest to use a Cache tool. The first one that you can try is APC (Alternative PHP cache). It is easy to install in Red Hat: yum install php-pecl-apc. You can get much better results with a WordPress specific cache plugin like W3 Total Cache or Super Cache. I use the last one and it is easy to install in WordPress application:

  1. Install Super Cache from the WordPress admin panel
  2. Change the .htaccess permissions: sudo chmod 666 /opt/bitnami/apps/wordpress/htdocs/.htaccess
  3. Enable the plugin and follow the configuration steps. You can see how this plugin modifies the .htaccess file
  4. Configures the cache options according to your preferences and test it. You can do performance tests using a service like blitz.io
  5. Change the .htaccess permissions to 600 when everything is ok.

I hope it helps.

Beltran
  • 1,150
  • 6
  • 10
0

We saw something similar. For us, the opportunity cost of our time fiddling with optimization settings was much higher than just going with a dedicated Wordpress hosting provider.

The leaders in this space (dedicated Wordpress hosting) appear to be WP-Engine and a few others like Synthesis

http://trends.builtwith.com/hosting/wordpress-hosting

I had my personal site on dreamhost but they ended up becoming worse and worse over the years so I moved to bluehost, which has been ok.

Overall, I think EC2 is great but it requires a lot of fiddling. Depending on the cost of your time and area of expertise, you might choose to switch to a more specialized provider.

I have no affiliation with any of these companies other than my personal experience being an individual shared hosting customer at both dreamhost and bluehost.