Jesus Forain
Posts: 14
Joined: Sat Sep 08, 2012 4:51 pm
Location: France

My webserver, running 24/7

Tue Sep 18, 2012 10:08 pm

I use the RPI to do web developpement, here is the address of my webserver used for developpemnt (french language) http://www.jesus-forain.fr
This website may be sometimes unavailiable.

The main goal is to run the RPI 24/7, I'll hope there won't have any problems and wrost of all data loss. I don't know if a SD card can reliably run 24/7. I planned to plug an USB key to do backup with a crontab.

Get details in realtime here: http://info.jesus-forain.fr

I'm surprized by the speed. This little computer can run an entire webserver but can't handle many connections. By using 3 RPI, one for Apache, one for PHP and one for MySql I think you can have a strong webserver for a low traffic website.

Technical details:

Computer: Raspberry PI model B without case.
OS: Raspbian.
SD card: SanDisk Ultra SDHC 32GB. ref SDSDU-032G-U46.
USB charger: noname 1A BLUEWAY TCUMINI1A1USBV2
Connection: wired Ethernet port.

Webserver software:
Apache
PHP with Xcache
MySql

ADSL:
upload: 60-70Kb/s
download: 350kb/s

Location: Bordeaux, France

RussoNC
Posts: 48
Joined: Fri Sep 07, 2012 6:53 am
Location: New Caledonia
Contact: Website

Re: My webserver, running 24/7

Wed Sep 19, 2012 9:05 am

Congratulations about your project !! Very nice. I was particularly interested about your post because I was thinking to do the same thing with my Pi (I will get mine this wednesday)
Je vois que tu parles francais, donc vu que j'ai perdu un peu mon anglais parce que j'ai du apprendre le francais (J'habite en Nouvelle Calédonie) et je suis argentin. Donc génial ton site, très intéressant de pouvoir tester un site hébergé par une Pi.
Anyway here we must speak english hehe. So go on with your project and as soon I have my Pi working I'll post here.
Greetings for NC
Whant to see MySQL, nginx in action on the Raspberry pi ? Check my site: www.pirepository.com

saif
Posts: 74
Joined: Sun Apr 15, 2012 8:15 pm
Contact: Website

Re: My webserver, running 24/7

Wed Sep 19, 2012 9:41 am

That's cool. I am just wondering if you use any heatsinks on your pi. I do the same sort of thing, and my pi does run very hot. I have tried to reduce the cpu load by using lighttpd and do not use any databases, and reduced the use of non essential scripts. Despite this I think I will be investing in some heatsinks for my own setup. Sadly my pi is in constant use for other things to be left for a 24/7 webserver...might be an excuse to get (yet) another one ;-)

User avatar
RaTTuS
Posts: 10549
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: My webserver, running 24/7

Wed Sep 19, 2012 9:48 am

RPI's dont need heatsinks
/opt/vc/bin/vcgencmd measure_temp
temp=54.1'C

though I do have some on one of mine [vanity reasons]

Code: Select all

 uprecords
     #               Uptime | System                                     Boot up
----------------------------+---------------------------------------------------
     1    30 days, 18:04:22 | Linux 3.1.9+              Fri Jul 20 16:59:35 2012
     2    16 days, 17:37:40 | Linux 3.2.27+             Fri Aug 24 16:10:54 2012
->   3     4 days, 17:33:29 | Linux 3.2.27+             Fri Sep 14 17:14:50 2012
     4     4 days, 00:28:18 | Linux 3.2.27+             Mon Sep 10 16:45:10 2012
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

scorp
Posts: 96
Joined: Tue May 29, 2012 6:21 pm

Re: My webserver, running 24/7

Wed Sep 19, 2012 9:52 am

saif wrote:That's cool. I am just wondering if you use any heatsinks on your pi. I do the same sort of thing, and my pi does run very hot. I have tried to reduce the cpu load by using lighttpd and do not use any databases, and reduced the use of non essential scripts. Despite this I think I will be investing in some heatsinks for my own setup. Sadly my pi is in constant use for other things to be left for a 24/7 webserver...might be an excuse to get (yet) another one ;-)
You may have SMSC chip(not CPU) hot if your PCB is ver1. It is hardware mistake as far as I understood.

saif
Posts: 74
Joined: Sun Apr 15, 2012 8:15 pm
Contact: Website

Re: My webserver, running 24/7

Wed Sep 19, 2012 10:13 am

You may have SMSC chip(not CPU) hot if your PCB is ver1. It is hardware mistake as far as I understood.
Thanks scorp, explains a lot. Have to say it has not affected the operation of the Pi. But vanity IS another reason for heat sinks....cheers Rattus

Jesus Forain
Posts: 14
Joined: Sat Sep 08, 2012 4:51 pm
Location: France

Re: My webserver, running 24/7

Wed Sep 19, 2012 4:39 pm

I don't use any heatsinks. The RPI isn't modified.
I put a better photo of the unit on http://info.jesus-forain.fr I think i'ts 2nd revision, see /proc/cpuinfo

I removed all unused services and packages like X server to save RAM and space.

Temperature:
/opt/vc/bin/vcgencmd measure_temp
temp=42.2'C

Previous uptime was 10 days. I did a backup of SD card yesterday so I poweroff RPI for about one hour.

Argon
Posts: 109
Joined: Thu Aug 25, 2011 11:04 am

Re: My webserver, running 24/7

Wed Sep 19, 2012 8:31 pm

Hello,

Is installed php5, mysql and apache on my RasPi.
I now run 2 Joomla websites on it (for local sportclub) and 2 phpbb3 forums (15 users each). The RasP turns 24/24 7/7 without a single problem at this moment.

Only thing I search at this moment: how do I auto backup the whole SD card (also Databases) to my Nas or something else. I don't want to loose my websites off course :-)

Jesus Forain
Posts: 14
Joined: Sat Sep 08, 2012 4:51 pm
Location: France

Re: My webserver, running 24/7

Wed Sep 19, 2012 9:15 pm

To do a SD backup, the simpliest way is to do an image with a tool like Win32DiskImager. You can restore it in few minutes. This implies of course to insert card in a card reader connected to your computer.
Now, you have a whole backup of your system and its configuration, after you just need to backup changing files like databases.

For an automated daily backup, you need to use a crontab to schedule yours backups. Do this in the middle of the night, while there are nobody on the server.

You can dump your database with mysqldump.

I don't have setup a backup on my server, I don't know when I'll do it.

wh1p
Posts: 29
Joined: Tue Jul 03, 2012 11:00 pm
Location: South East UK
Contact: Website

Re: My webserver, running 24/7

Thu Sep 20, 2012 12:50 am

This thread interested me at firsat as so does any talking about pi as a web server but you were sayting your pi get very hot and this interests me as i have got raspcontrol and my own website current in development and my pi never gets very hot? although one thing i have noticed is that the ok light on my pi doesn't seem to light up anymore??

Jesus Forain
Posts: 14
Joined: Sat Sep 08, 2012 4:51 pm
Location: France

Re: My webserver, running 24/7

Thu Sep 20, 2012 5:37 pm

If your RPI gets hot, you have the first generation.
I looked for more details and I have the second generation. The difference is at right top corner, between USB and activity LEDs. If you have black rectangles with "0000" (0 ohms resistors) on it, it's the second generation. See photo on info page.

I've also added temperature display and CPU speed (not overclocked) on info page http://info.jesus-forain.fr.

saif
Posts: 74
Joined: Sun Apr 15, 2012 8:15 pm
Contact: Website

Re: My webserver, running 24/7

Thu Sep 20, 2012 6:48 pm

Jesus Forain wrote:If your RPI gets hot, you have the first generation.
http://info.jesus-forain.fr.
Yeah I know, I was one of the first to get a Pi...troubles of getting a first revision eh? But I have no regrets.

JoeBoese
Posts: 4
Joined: Fri Sep 28, 2012 2:14 am

Re: My webserver, running 24/7

Fri Sep 28, 2012 2:19 am

Heya,
I tried migrating my gallery2 setup (LAMP) on a powerful/powersucking server to my new RPI recently. Any time I browsed to a page (which would do a handful of SQL/PHP/and about 30 thumbnail downloads) the CPU would be slammed on the RPI for about 30 seconds while it worked everything off. I then tried just doing a large file download directly from Apache (simple HTTP GET). This almost maxed out the CPU and gave me about 5 MB/sec. During this download I noticed quite a bit of swapping going on in 'vmstat'. Are you guys avoiding this behavior somehow? I'm sure spreading the LAMP across 3 nodes helps with my 'gallery2' use case; but I don't think there is much I can do about the large file download bottleneck.

saif
Posts: 74
Joined: Sun Apr 15, 2012 8:15 pm
Contact: Website

Re: My webserver, running 24/7

Fri Sep 28, 2012 1:35 pm

I reduce my power usage, and CPU load by
1) Using a lightweight server. I use lighttpd, you can get even better performance with something like Hiawatha
2) Disable all services that are not needed. Do not have X/desktop environment in the backgound, etc
3) Use a fast SD card
4) For my needs swap usage is near zero (see below). But, if you need swap, sometimes reducing swapiness can help performance.

My performance is good and CPU load low because I do not use additional layers of complexity. I use PERL rather than PHP so less memory used. I use a custom DB, (you can use sqlite) even less memory. These may not be an option for you ofcourse.

Jesus Forain
Posts: 14
Joined: Sat Sep 08, 2012 4:51 pm
Location: France

Re: My webserver, running 24/7

Sun Sep 30, 2012 8:59 pm

I have no CPU overload problems and no swapping. Sometimes there are swapping but it's less than 10MB.
If I do a download, CPU usage are near zero.
For a web page (PHP+MySql), it's less than 20-30%.

Do you use Xcache for PHP? because if I disable it, CPU load can reach 100% sometimes.

My webserver is only a webserver, there are no extra software on it. Just Apache, MySql and PHP.

QuaCKeReD
Posts: 7
Joined: Sat Oct 13, 2012 9:23 am

Re: My webserver, running 24/7

Sat Oct 13, 2012 9:29 am

Hi, am quite new to this RPi idea though loving it at the mo!!!

Have one setup, running Zabbix with MySQL. Few issues with default install and swap usage, but haven't gone through their own tuning stages yet.

Re; Backup. Am currently using RSnapShot to my NAS mounted as NFS. Not run for a whole day yet, but looking very promising. It allows snapshot processing of whole card; hourly daily, weekly and monthly.
Yes, rsync can be CPU intensive, but after initial full backup my setup, with some 75000 files is only taking 5mins per 4hour backup,many CPU peaking around 15%

Maxwell
Posts: 1
Joined: Wed Nov 21, 2012 2:44 pm

Re: My webserver, running 24/7

Wed Nov 21, 2012 2:48 pm

Thanks for all the useful info in this thread

Could you please let me know how you are displaying the server info on the webpage http://info.jesus-forain.fr/
Many thanks

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: My webserver, running 24/7

Wed Nov 21, 2012 5:03 pm

Nice job!
I have had a web server up since 8/25/12 on a Raspi. No real problems. I have lost the SD card a couple of times, to corruption, during updates. I believe it was due to my power supply which was rated at only 500ma. When I updated the card on my Lapdock I had no corruption issues.

I switched out that RasPi with another the other day. I wanted to use my modified RasPi that is back-powered throught a USB hub I hardwired to it. This gives me 5 USB ports. Rootfs now resides on a USB HDD.

I have found that the USB HDD's are nearly immune to corruption on the RasPi. I had a RasPi with a bad SD problem. Corrupted every card I used in it. I had it, originally, on a Lapdock with a HDD. I did not know the problem existed until I moved that RasPi to use a SD card only system. After finding its problem I put it back on the Lapdock and a HDD and it occasionally corrupted the boot files. I RMAed it. I suspect it may also be true of USB sticks, but have not tested this theory out yet.

I do use Win32DiskImager to make a backup of the web server card. It takes several hours to rebuild the card if it goes toes up. I install apachephp5, SQL, lighthttpd, Samba and phpmyadmin on my card over Raspbian wheezy 9/18. I also install fail2ban on it.

I think I am going to bring up Wordpress on it next. Made a copy of the card. I will install it on the card then test it. Once I have it running I will copy it to the server HDD.

Web page at
http://rich1.dyndns.tv
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

Jesus Forain
Posts: 14
Joined: Sat Sep 08, 2012 4:51 pm
Location: France

Re: My webserver, running 24/7

Wed Sep 18, 2013 8:44 pm

After one year....it works perfectly!

I got no problems, all hardware is OK. I feared SD card corruption but card is OK. Raspbian is very stable, I got no software problems.

During the year, the rpi was only poweroff for few days due to power failures: storms and powerlines maintenance. There was also few ADSL failures and I poweroff to do backup of SD card.

I use it to do daily backups of my website database. I switched from MySql to Postgresql. It's done every night by crontab. I also use it as a personnal cloud to share files with Samba for local LAN and SSH for outside, for example to save photos taken with my phone.

For the source of info page, sorry for late but I hadn't read this topic since, go here: http://info.jesus-forain.fr/index.txt

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: My webserver, running 24/7

Thu Sep 19, 2013 9:16 pm

Transitioned to Wordpress soon after my post that. I continued to have corruption issues until earlier this year. The updates have really helped.

Brown outs did stop my server and maybe a couple of corruptions. Just usually had to restart the RasPi. Updates caused the majority of my corruption issues.

I tried separating the SQL database onto a separate RasPi. The performance gain was minuscule for WordPress, about 0.2 seconds average gain in page serves. Both RasPi were running from the same hub, one back-powered and the other powered from the hub, power usage was only about 7 watts total.

Overall, the Raspberry Pi works pretty well as a web server. If we could tap into the GPU for some more processing power it would be great. No such luck! A more powerful ARM would really help. Not so much as faster just a newer core is all it would really take.

I have been happy with it performance. At least considering its price! :D
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

Jesus Forain
Posts: 14
Joined: Sat Sep 08, 2012 4:51 pm
Location: France

Re: My webserver, running 24/7

Sun Sep 22, 2013 2:24 pm

You talk about corruption of filesystem or hardware failure (SD card is no more usable)?

All these frameworks like Wordpress eating lot of CPU. It's PHP that consume most of CPU but if you create your website from scratch like me you can do optimized code but it takes time. You don't see difference between real (on a real server) and mirror website (on RPI). The only difference is that if there are too many connections on RPI il will quickly slow down.

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: My webserver, running 24/7

Sun Sep 22, 2013 7:48 pm

I have done both HTML and PHP static pages and now WordPress. I also have had a PHPBB setup. I have administered them locally (my own equipment) and remotely (paid server).

In fact I copied over my static HTML pages to WordPress. It would take very little to change back.

The reason I am using WordPress is because it is easier to make and maintain a web page. I have a static page on my Windows Home Server.

It is a challenge to get decent performance from WordPress on a RasPi. The real reason to try it is the drastic reduction in cost and power usage.

My WHS server was is built on an Atom 330 board. It has 2.5TB of storage. Uses a low power PSU and still uses 27 watts at idle. Cost about $450 including the software.

I have tried WordPress on a Panda Board and the performance is very close to a full PC. Of course that is a $190 plus the SD card. A little easier to use as it has a full Ubuntu version running.

Raspberry Pi cost was $35 plus a SD card at $8 and I am using a an old USB flash drive (512MB) as a swap file (increased the swappiness to 40), the software was free.

The RasPi server uses 6 watts. So we are talking a little over 52 kilowatts per year versus 236 kilowatts per year. Not a big difference $5 versus $20.

But as I said it is the challenge.
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

Jesus Forain
Posts: 14
Joined: Sat Sep 08, 2012 4:51 pm
Location: France

Re: My webserver, running 24/7

Wed Sep 25, 2013 8:01 pm

have you installed a php accelerator like xcache? It really improves perfs, the first page loading are slow, it analyzes php script, after it's fast.

I've also removed all unused packages for a server, at boot il uses about 40-50MB of RAM.

I'd found these commands to remove all GUI related packages.
Be careful! it may remove installed packages you need like Apache and conf files, do a backup of these files before press yes!. If it's removed don't forget to reinstall it.
For Apache and php I've installed latest versions avaliable in testing repo.

# apt-get remove xserver* x11-common x11-utils x11-xkb-utils x11-xserver-utils xarchiver xauth xkb-data console-setup xinit lightdm libx{composite,cb,cursor,damage,dmcp,ext,font,ft,i,inerama,kbfile,klavier,mu,pm,randr,render,res,t,xf86}* lxde* lx{input,menu-data,panel,polkit,randr,session,session-edit,shortcut,task,terminal} obconf openbox gtk* libgtk* scratch tsconf desktop-file-utils
# apt-get --yes autoremove
# apt-get --yes autoclean

There's others hi-perf HTTP servers for heavy loads like lighthttpd or nginx but the don't use .htaccess files.
I also wonder if it's possible to run php on a dedicated machine, for example: on a machine you have Apache that send php to another machine and return response to Apache machine. Could CGI do this? I didn't found something like this on Google.

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: My webserver, running 24/7

Wed Sep 25, 2013 9:06 pm

I tried a stripped Raspbian (RSE 2.4) vs. full Raspbian, no difference in page serve speed.

I split the MySQL database to a second RasPi and gained approximately 0.2 seconds better page serve performance. 0.3 seconds when updating WordPress.

I tested a 512MB versus a 256MB, no real difference there either.

I am using a cache, WP Fast Cache. That made more difference than any of the other things I tried.

Overall a standard Raspbian install with WordPress works with acceptable performance.

I have been trying to get SQLite, NGINX working with WordPress. The SQLite plugin I tried is not connecting. I decided to give it a rest and come back and try again in a while.
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

permaband
Posts: 62
Joined: Wed Aug 01, 2012 2:14 pm
Location: uk
Contact: Website

Re: My webserver, running 24/7

Thu Oct 03, 2013 4:05 am

My server has been up 14 months @ http://grognard.sytes.net/

I had some early woes, but when I switched to using Sandisk SDHC 4gb cards I stopped experiencing issues with them becoming corrupt. I also use a proper regulated switching power supply, which was so worth the £13 or so it cost.

I had been using it to test out wordpress super caching but its now running php and mysql based web forum.

I've had a few power outtages here and there but the pi handled them without issue.

I also use the pi as a VNC and SOCKS5 proxy from work.

The only issue I have found is lack of memory on my revision A means I will have to start looking at upgrading to a revision B in the near future - MYSQL's appetite's are never slated. :(

Return to “Networking and servers”