Web Lamp Server

Good I have a rasbperry pi b the 256mb ram and with the green server lamp that is very slow to serve pages with mysql.

Now I have to provar a raspberry pi b + of 512mb ram to see if there are improvements with the same service.

The service is to have my personal blog and little else, that is something stable.

In case of having to change the plate because the ones I have are somewhat obsolete, which I am advised, I have seen the orange pi that are very well priced but I do not see that they are directly compatible with dietpi, which is the system I want to use for the various options and configurations that are available.

What advice do you give me?

Odroid XU4 and C2 are good reliable devices with full DietPi support - they are more than adequate for your blog server.

John

Thank you very much for answering, now I have ripped a copy of the memory of the raspbery pi B to the raspberry pi B + to test the performance, if I see that it is not the right choice to change the plate.

Dietpi has recognized me the rasbperry B + without problems and is running the system and the programs installed, is it necessary to format the system or so I will have the same performance?

So you are using the SD card from the B in the B+? If it’s working you don’t need to reformat the card and start again.

John

Yes, that’s it, I’m using it and it seems to recognize it without problems, if so, and I can avoid reinstalling much better since now I have it configured as I wanted.

It shows a bit the improvement but still lacks a little power, on the theme of the odroid I like the idea but it is quite price, I think I should opt for something more economical if I see that my idea works more or less, would decant by the rpi2 or rpi3 that already have a CPU more powerful than the b +.

The Odroids will definitely do a well job, but they are as you stated a higher price class. Depending on the visitor numbers you assume for your blog, a current RPi will do as well. I successfully run Nextcloud + video chat with full caching here on RPi2 (1 GB RAM). The RAM is usually ~25% in active use, but indeed it is also just for private home use with not regular “external” users.
RPi3 (35$ + shipping + AC) is CPU/GPU wise way faster again, sadly not more RAM, so should be sufficient for the beginning.

So yeah, it really depends on how much parallel visitors you expect for your blog and if you might want to add other server tasks at a later time, things like video streaming and stuff of course have totally different requirements.

I run my blog (Wordpress) on my Pi 3 and it works great. I get Grade A (92) on the Pingdom speed test. CPU Usage is typically a few percent most of the time, RAM usage 150 - 200 MB, and that includes a few other services on the same device (OpenVPN, dnsmasq). Of course those would be higher with more visitors or a more complex page (or e.g. transferring a lot of data over the VPN server), but I think the little Pi 3 can handle any personal blog unless you get tons of visitors.

Doing this sped up the loading and reduced the load on the server:
https://varvy.com/pagespeed/leverage-browser-caching.html

This was my idea to put an rpi3 or an orange pi that also paint well and are economical.

The theme that dietpi is compatible with Orange pi? Or does not have any compatible version?

Have you ever looked into what’s bottlenecking your server? Maybe it’s mainly storage and insufficient RAM and not CPU horsepower?

All that’s needed is a quick check:

apt-get install sysstat
iostat
vmstat -w

At least the vmstat output would be great since this provides a quick overview about typical bottlenecks (the last colums being the most interesting ones)

I imagine that the bottleneck is the ram since 256mb is very little for a mini server. If I run a basic html page has no problems, the problem is when I run my wordpress blog that when running the mysql (mariadb) the server slows down a lot.

The issue is that if I change to a higher raspy not only increases the ram but the cpu in the most current plates.

Why guessing? It’s Linux so you can simply have a look what’s really happening :slight_smile:

Please post the output of the following in a code block after your blog has been accessed a little bit and you feel it slows down:

vmstat -w

When I get home I’ll try it with the computer.

With the htop command of dietpi I realized when I accessed the blog, the cpu is triggered 100%, the 512mb memory is more or less in half.

vmstat -w

procs -----------------------memory---------------------- —swap-- -----io---- -system-- --------cpu--------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 37536 43496 234000 0 0 0 1 67 7 1 0 98 0 0

Attached a htop capture plus the vmstat when I access the page to show you the results is an rpi b + of 512mb.

Hmm, so RAM is not the problem, but a stuck/overloaded webserver thread. Interestingly only one of the 4 default threads is in use, so it doesn’t seem to be due to too much simultaneous access?

Does it only occur, if you use MariaDB as underlying database? Maybe Apache somehow stuck at accessing the database. Please check:
“/var/log/apache2/error.log” and/or “journalctl -u apache2”
“/var/log/mysql/error.log” or “/var/log/mysql.err” and/or “journalctl -t mysqld”
if you see any errors there.

Does “dietpi-services restart” fix the issue or does it reappear shortly?
Might be due to wrong configured apache module and/or mariadb then.

journalctl -u apache2

– Logs begin at Thu 2018-03-08 08:35:07 CET, end at Wed 2018-03-14 19:35:57 CET. –
mar 08 08:35:43 Rpi-Srv systemd[1]: Starting The Apache HTTP Server…
mar 08 08:35:44 Rpi-Srv apachectl[945]: [Thu Mar 08 08:35:44.784857 2018] [core:error] [pid 956]
(EAI 2)Name or service not known: AH00547: Could not resolve host name *:80="" – ignoring!
mar 08 08:35:45 Rpi-Srv systemd[1]: Started The Apache HTTP Server.

journalctl -t mysqld

– Logs begin at Thu 2018-03-08 08:35:07 CET, end at Wed 2018-03-14 19:39:20 CET. –
mar 08 08:35:49 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:49 3069299920 [Note] /usr/sbin/mys
qld (mysqld 10.1.23-MariaDB-9+deb9u1) starting as process 1184 …
mar 08 08:35:50 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:50 3069299920 [Note] InnoDB: Using
mutexes to ref count buffer pool pages
mar 08 08:35:50 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:50 3069299920 [Note] InnoDB: The I
nnoDB memory heap is disabled
mar 08 08:35:50 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:50 3069299920 [Note] InnoDB: Mutex
es and rw_locks use GCC atomic builtins
mar 08 08:35:50 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:50 3069299920 [Note] InnoDB: GCC b
uiltin __atomic_thread_fence() is used for memory barrier
mar 08 08:35:50 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:50 3069299920 [Note] InnoDB: Compr
essed tables use zlib 1.2.8
mar 08 08:35:50 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:50 3069299920 [Note] InnoDB: Using
Linux native AIO
mar 08 08:35:50 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:50 3069299920 [Note] InnoDB: Using
generic crc32 instructions
mar 08 08:35:50 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:50 3069299920 [Note] InnoDB: Initi
alizing buffer pool, size = 128.0M
mar 08 08:35:50 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:50 3069299920 [Note] InnoDB: Compl
eted initialization of buffer pool
mar 08 08:35:50 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:50 3069299920 [Note] InnoDB: Highe
st supported file format is Barracuda.
mar 08 08:35:51 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:51 3069299920 [Note] InnoDB: 128 r
ollback segment(s) are active.
mar 08 08:35:51 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:51 3069299920 [Note] InnoDB: Waiti
ng for purge to start
mar 08 08:35:51 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:51 3069299920 [Note] InnoDB: Perc
ona XtraDB (http://www.percona.com) 5.6.35-80.0 started; log sequence number 10239770
mar 08 08:35:51 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:51 2529162048 [Note] InnoDB: Dumpi
ng buffer pool(s) not yet started
mar 08 08:35:51 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:51 3069299920 [Note] Plugin ‘FEEDB
ACK’ is disabled.
mar 08 08:35:51 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:51 3069299920 [Note] Server socket
created on IP: ‘127.0.0.1’.
mar 08 08:35:52 Rpi-Srv mysqld[1185]: 2018-03-08 8:35:52 3069299920 [Note] /usr/sbin/mys
qld: ready for connections.
mar 08 08:35:52 Rpi-Srv mysqld[1185]: Version: ‘10.1.23-MariaDB-9+deb9u1’ socket: ‘/var/
run/mysqld/mysqld.sock’ port: 3306 Raspbian 9.0

these are the logs of the states, all the applications of the system are installed with dietpi-software and practically configured in the same way, can not be due to lack of CPU?

I just checked via Nextcloud on my RPi2:

  • Requests are separated on several apache instances quickly, resulting on all 4 cores being used equally, by times quite up to 100% but just for short time, until request/page load done.
  • On idle CPU usage is nearly constant 0% on all 4 cores.
  • So absolutely no problem for my nearly only home and family Nextcloud instance with 2 mobile and 2 desktop clients syncing regularly.

But yeah if you constantly have concurrent requests to handle, then the RPi will be obviously on it’s limits, slowing done fast. Maybe nginx or lighttpd (php-pfm) can handle things better, but as for my research, they do only perform noticeable better on 25+ concurrent requests. But this is an amount, where anyway a RPi is not suitable any more for sure.

The page does not have many visits when I execute it, I am the one who enters to do the test and the ago when I see that iftop does not have more connections than mine.

The raspberry pi b + is a cpu of a 700mhz core diepi through overlooking to get to 900mhz but always in a single core because the pi has no more I think it is not software if not hardware.

At first I wanted to configure it with lighttpd and mariadb but I have the blog with https through letsncrypt and I only managed to boot it with apache.

The latest DietPi supports letsencrypt/certbot in combination with Lighttpd as well, including HSTS and automatic certificate renewal. But I guess Lighttpd does not have it’s strength in less CPU usage, but in less memory usage, which might not help you.

But it might be still worth trying, as I cannot believe that simply running the webserver leads to significant CPU usage, even on RPi1 with 1 core. So do full sd card backup and fresh DietPi image and then fresh Apache or Lighttpd setup (as said, should not make significant difference) with CertBot + Wordpress and see if the issue still occurs.

dietpi-backup and Apache uninstallation + Lighttpd installation as alternative with bid less effort, but a clean image has it’s benefits as well :wink:.

Finally I saw that it was not a matter of memory as we discussed if not of cpu with an orange pi one that I got in a store nearby I configure everything and the blog is luxurious. Thank you very much for the help.