Hello!
I am running a Raspberry Pi Model B Revision 2 with an Apache 2.2.2 web server and WordPress 5.4.something.
I've read some online tutorials and whatnot, and they seem to suggest that there would be no problems simply setting up a LAMP stack and running WordPress. The actuality is my Raspberry Pi can barely even load the webpage, and when it does, there's absolutely no image loading, no styling, barely anything other than the text. The strange part is when I was testing it in a local network connection (laptop to router to pi), it was working sub-optimally, but still displayed properly. Now that my website is back online, using Cloudflare and Namecheap, it's utterly demolished in terms of performance.
Any thoughts on what I can do to get a good looking site workable on the Pi? I'm not sure if I'm ready to go through the horror of learning how to configure another server....doing that for Apache2 was probably enough! But if that's the way it has to be...
Thanks!
-
- Posts: 2
- Joined: Sun Mar 26, 2017 11:30 pm
Re: Pi almost entirely unable to run WordPress site
Some aspects of performance depend on write speed. SD cards have awful write speeds. Web browsers timeout when the response time is bad. Either use a fast SD card or put the Web server on an SSD.
You can cache all the static pages using a proxy server. Nginx does a better job than Apache when memory is tight because Nginx has a proxy server built in.
When your Web pages have the wrong cache settings, everything is served fresh even when it is not needed. Check your cache settings.
You can offload work to CDNs. After that, there is not a lot you can do without changing the content you deliver.
You can cache all the static pages using a proxy server. Nginx does a better job than Apache when memory is tight because Nginx has a proxy server built in.
When your Web pages have the wrong cache settings, everything is served fresh even when it is not needed. Check your cache settings.
You can offload work to CDNs. After that, there is not a lot you can do without changing the content you deliver.
-
- Posts: 2
- Joined: Sun Mar 26, 2017 11:30 pm
Re: Pi almost entirely unable to run WordPress site
So this is due to bad SD card write speeds, poor caching techniques, and a hefty Apache server and sizable pages (My home page does feature a very large, high quality image)? Just so I'm clear.
- Attachments
-
- bad_wordpress.png (52.54 KiB) Viewed 4287 times
Re: Pi almost entirely unable to run WordPress site
And the original pi is pretty slow with only a half gig of ram. Have you watched htop or something like that while all this is going on to see if it's into swap? Are you using swap?grant-pi-242 wrote:So this is due to bad SD card write speeds, poor caching techniques, and a hefty Apache server and sizable pages (My home page does feature a very large, high quality image)? Just so I'm clear.
Re: Pi almost entirely unable to run WordPress site
Apache, even on the original RPi, serves static web pages just fine.
The problem comes with large-footprint databases needed for storing the Wordpress data. You must tune MySQL for the small amount of RAM available: there is guidance in this forum. Getting the data off SD card and onto faster USB-attached SSD is a big win.
Even so, the application will barely fit. So be prepared to do some performance tuning. "dstat" gives a good overview of the overall pressures of a system, you'll see that it has a MySQL plugin allowing you to see the effect of Wordpress's MySQL usage on disk I/O latency on the SD card. "dstat"'s manpage generously gives a summary of Linux's many other performance tuning tools.
Use "dtstat" now to get a benchmark for the issue, and to confirm that the essential issue is disk latency rather than CPU throughput, memory pressure, or network throughput. Obviously memory pressure is visble in excessive swapping, for more insight install ps_mem.py from GitHub.
The problem comes with large-footprint databases needed for storing the Wordpress data. You must tune MySQL for the small amount of RAM available: there is guidance in this forum. Getting the data off SD card and onto faster USB-attached SSD is a big win.
Even so, the application will barely fit. So be prepared to do some performance tuning. "dstat" gives a good overview of the overall pressures of a system, you'll see that it has a MySQL plugin allowing you to see the effect of Wordpress's MySQL usage on disk I/O latency on the SD card. "dstat"'s manpage generously gives a summary of Linux's many other performance tuning tools.
Use "dtstat" now to get a benchmark for the issue, and to confirm that the essential issue is disk latency rather than CPU throughput, memory pressure, or network throughput. Obviously memory pressure is visble in excessive swapping, for more insight install ps_mem.py from GitHub.
-
- Posts: 2
- Joined: Fri Nov 03, 2017 10:38 am
Re: Pi almost entirely unable to run WordPress site
Hi
I have the same exact problem on a Pi 2. Did you find a solution?
Thank you
I have the same exact problem on a Pi 2. Did you find a solution?
Thank you
Re: Pi almost entirely unable to run WordPress site
Hi Grant
Your mangled web page shouldn't be due to performance shortcomings. I have a Wordpress blog running with Apache on a Pi2, MySQLm and storage in the SD card. Performance is just fine and pages load in about half a second. How big is that "high quality image" on your front page ?
Also check out the Apache error log when you refresh the page (/var/log/apache2/error.log).
Jim.
Your mangled web page shouldn't be due to performance shortcomings. I have a Wordpress blog running with Apache on a Pi2, MySQLm and storage in the SD card. Performance is just fine and pages load in about half a second. How big is that "high quality image" on your front page ?
Also check out the Apache error log when you refresh the page (/var/log/apache2/error.log).
Jim.
Unix engineer since 1989
- Ronaldlees
- Posts: 294
- Joined: Sat Apr 16, 2016 4:28 pm
- Location: North Carolina, US
- Contact: Website
Re: Pi almost entirely unable to run WordPress site
Yeah - as has been pointed out already, you really have to watch the size of those photos. The network speed is one of the lesser abilities of the Pi (at least so far). So to run a WP site on a Pi you want to use pretty small, efficient graphics.
My WP is based on a Pi2 with Hiawatha and SQLite3 on a uSD. It's reasonably snappy for two or three users, given that my pics are down-sized. Are you expecting many visitors? If so, then the total graphics load may be too much. As was previously mentioned, you may want to use a front-end caching proxy. (I think Hiawatha can do that as well, but need to check that info).
BTW - the SQLite3 DB has no security built-in, so my WP is local intranet only.
My WP is based on a Pi2 with Hiawatha and SQLite3 on a uSD. It's reasonably snappy for two or three users, given that my pics are down-sized. Are you expecting many visitors? If so, then the total graphics load may be too much. As was previously mentioned, you may want to use a front-end caching proxy. (I think Hiawatha can do that as well, but need to check that info).
BTW - the SQLite3 DB has no security built-in, so my WP is local intranet only.
I am the Umbrella man