Wordpress site running on Raspberry Pi
pipress.vo3.net
pipress.vo3.net
So he's serving a static page 90% of the time? I'd love to see how this thing operates without a cache.
ab -n 1000 -c 20 http://pipress.vo3.net/wp-login.php\?action\=lostpassword
Seems to have killed it. The site came back when I killed the process.Sorry jstalin but I had to do it! For science!
irc://irc.linpro.no/#varnish
Most blogs lack any dynamic content (except the admin section) and can just regenerate the pages when a new post is made or new comment added.
Typically flash is broken up into 'pages' and a page can be as small as 8K bytes and as large as 128K bytes, there are reasons for doing it different ways (mostly related to write latency) but if you consider an 8GB flash with 128K byte pages, that is 64K 'pages' (8G/128K) And if you wan to write one byte on that 'page' you have to rewrite the entire page.
San Disk and others will typically spec that a single 'page' can be written 100,000 times, and wear levelling software insures that no single page gets written more than any other page. So you can expect a total of 100,000 * 64K or 6.55B writes before you see a failure.
If you look at typical 'disk' sorts of statistics you will see that a typical SATA drive will do something like 80 - 100 IO operations per second (IOPS) so writing at 80 IOPS you would take nearly 23 thousand hours to wear out an 8G flash. But at Flash speeds (10,000 IOPS) that could easily drop to a mere 182 hours (which is why you don't see a lot of 8G SSDs)
But this is where the math gets fun. The card is spreading writes over total available pages, so assuming 128K pages and 100K writes per page and 500 IOPS (somewhere between a SATA SSD and a spinning rust drive, and well within the rate possible using USB channels or SPI) that kills off 128K bytes every 200 seconds.
Writes get flushed out to disk right away to keep the file system consistent and so you get more writes than you might expect. And writing one byte to a file, not only changes the inode holding that byte, but it also changes the inode holding the directory entry which has the length and modification time (assuming you've disabled atime). So every write from user land can be 2 writes to the device, and sometimes more if it results in overflowing a directory block.
Other variables include how effective the write leveling works, the card has to 'remember' its leveling. An early version I saw wrote a generation number into a page header (written with the same page) and then managing the map. On cheap cards the map (from the linear space presented to the user to the random space of the actual flash) I've seen code which basically mapped each page to 16 candidate pages and then linearly searched amongst those 16 for the next page to write. This had the effect that the single page write endurance lifetime was shorter than the aggregate device write endurance lifetime. (back when I was doing my embedded OS work I was using JTAG to read back flash state directly from flash drives (not the SD cards but the early drives offered for sale as replacement disks)
Anyway, like most things, its not immediately obvious what factors come into play and its easy to do things that screw you (like doing atime writes).
[1] www.flashgenie.net/img/productmanualsdcardv2.2final.pdf
http://media.kingston.com/pdfs/FlashMemGuide.pdf
Also, see this thread:
http://www.raspberrypi.org/phpBB3/viewtopic.php?t=21281&...
Edit - The Kingston data is a bit dated but in any case 10000 is probably a better number for cheaper cards.
#!/usr/bin/perl
use strict;
use warnings;
my $letters = "ABCEDEGHIJKLMNOPQRSTUVWXYZ-";
my $range = length $letters;
while (1) {
foreach (1..16) {
my $nm = "A";
foreach (1 .. 15) {
$nm .= substr($letters, rand($range), 1);
}
open(my $fh, ">", "$nm.delete-me");
foreach (1 .. 128) {
$nm .= substr($letters, rand($range), 1);
}
print $fh "$nm\n";
close $fh;
}
`sync`;
`rm *delete-me`;
}
Killed it dead in 3 hrs 18 minutes. Your mileage may vary.May not be 'first hand' enough though.
It looks like this is what he is doing. I'd be willing to bet the site will stay up.
I officially dub it the cutest webserver.. in the world.
There are a few caveats here. If you're serving the same content ( < 512MB ) and it's static, then yeah, why not? Serving static content isn't CPU intensive and you're serving directly from RAM.
Nice work.
He should try it, as he is getting errors with Varnish.
- OpenVZ 128MB RAM
- Ubuntu
- Nginx
- MySQL
- PHP-FPM
- APC
- Varnish -->> Redis
At 250user/second here's the result : http://imgur.com/a/hPkyZ
This is vanilla WordPress installation. There is almost no difference in load time or overall resource usage as far as I'm concerned. I've never use Redis before so thank you for this.