简体   繁体   中英

How to speed up Apache/PHP/MySQL on Raspberry Pi (Raspbmc > Debian)?

I'd like to know how to make it faster. Just for the plain fun because of course there are caching solutions which make websites fly on every system, but it'd be cool to get the most out of non-cached performance as well.

I thought about installing HipHop php (hhvm), but don't know what I am up to. I see mostly negative comments when Googling.

Maybe just tuning Apache and mysql will do. And I think the slowness comes mostly from the slow disk and memory performance.

Not really an answer, but I have a Pi as my home server and found it was quite slow. It takes 0.3 - 0.5 seconds to render a page. Which is slow! Sometimes I get up to 3 seconds on rare occasions.

I have done a fair bit of testing and got nowhere, so I can confirm the following doesn't help:

  • Gigabit router with cat6 cable, no difference, the pi is only 100mb which is a shame.
  • 95mb/s SD card, didn't seem to make a difference
  • Overclocked to 1ghz, used heatsinks and a fan, no difference...

So the best solution is to not use a pi for a production server. Use it only for a local development server if you don't mind the page loading speeds.

To get quicker load times on the raspberry pi, what I've found helps is to use a lighter weight webserver. What I've used in place of apache is nginx. I hear monkey is even better, however they don't yet have a release arm build.

Here are some numbers. http://raspberrywebserver.com/raspberrypicluster/comparing-the-performance-of-nginx-and-apache-web-servers.html

Additionally I've used mongodb instead of MySQL because of it being quicker for more specific use cases. I'm certain that it isn't always the solution to go with however, as it radically changes how you would store your data and makes multi table relational queries a pain. MySQL vs MongoDB 1000 reads

Finally make sure you have a fast SD card, and you can turn on a swap file or swap partition to help with only having 512 megs of memory (model b).

Of course if you are using the pi to develop for a specific environment you may not have any of those options. But if you want to use it for a personal web server or have more freedom with the production environment, that's the route I'd check into.

Use MYISAM instead of INNODB on Raspberry PI if you can. You will see some differences in speed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM