Successfully reported this slideshow.
Your SlideShare is downloading. ×

Roy foubister (hosting high traffic sites on a tight budget)

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 29 Ad

More Related Content

Slideshows for you (20)

Advertisement

Similar to Roy foubister (hosting high traffic sites on a tight budget) (20)

More from WordCamp Cape Town (15)

Advertisement

Recently uploaded (20)

Roy foubister (hosting high traffic sites on a tight budget)

  1. 1. Hosting High Traffic Sites on a tight Budget on a tight Budget <ul><li>or </li></ul><ul><li>Getting ONE server to stay up while you are able to get a good night’s sleep! </li></ul>
  2. 2. Who is this guy?
  3. 3. A little story : keo.co.za - 28k comments a month - Peaked at 58k
  4. 4. Ryan Allen's 12.4 step process - 20 blogs - 850,000+ pages a day - 25 million / month
  5. 5. Whats the point <ul><li>- Getting a server to use a 3rd of the resources </li></ul><ul><li>- Delivering 5 x the amount of pages </li></ul>
  6. 6. The brief <ul><li>Big publishing client - social site “next big thing” </li></ul><ul><li>- Image </li></ul><ul><li>- Music </li></ul><ul><li>- Video </li></ul><ul><li>- Must be fast </li></ul><ul><li>- 99% uptime </li></ul><ul><li>- Easy to maintain </li></ul>
  7. 7. The development <ul><li>Wire frames > design > development </li></ul><ul><li>The dev goes smooth on a local dev box </li></ul><ul><li>Client says right make it live. </li></ul>
  8. 8. Production Server <ul><li>Order the linux server from the hosting co. </li></ul><ul><li>Ubuntu 11.04 installed with LAMP - Sounds great!! </li></ul><ul><li>Sounds good, right - Linux can handle anything, its the greatest thing since duck tape! </li></ul><ul><li>The media release goes out and the people start flooding to the site. </li></ul>
  9. 9. CRASH <ul><li>Oh hell - the sites response is slow </li></ul><ul><li>“ Duck it” the site is down!!! </li></ul><ul><li>You try connect to it with SSH - nothing, no pings - IT'S GONE! </li></ul><ul><li>Call the hosting company - please hard reboot our server :| </li></ul><ul><li>Client breathing fire your way! </li></ul>
  10. 10. WTF just happened? <ul><li>Hardware resources are finite - the default install of LAMP will let you down under load. </li></ul><ul><li>Resource bottle necks </li></ul><ul><li>CPU - Dynamic generated pages, mysql </li></ul><ul><li>Memory - PHP, cache, mysql </li></ul><ul><li>Disk - Files, static content, file pointers </li></ul><ul><li>Network - Static content, dynamic content </li></ul>
  11. 11. Make it simple! <ul><li>Optimizing can get out of control, some simple changes can make a big difference. </li></ul><ul><li>- Use products that have community support </li></ul><ul><li>- Use products that are expected by by your team </li></ul><ul><li>Think about the full process from server to rendering in the browser. </li></ul>
  12. 12. Test Server time <ul><li>- Ubuntu 11.04 install </li></ul><ul><li>- Intel Pentium Dual CPU E2180 @ 2.00GHz / 4Gb ram </li></ul><ul><li>- PHP 5.3 / MYSQL 5.1 </li></ul><ul><li>- WordPress 3.2.1 </li></ul><ul><li>- Twentyeleven default theme / WP theme test data </li></ul><ul><li>Please send donations for </li></ul><ul><li>new test server equipment!!! :) </li></ul>
  13. 13. Apache <ul><li>Default install of Apache-prefork max clients = 150 (can set up to 256 before having to recompile) </li></ul><ul><li>mod_php </li></ul><ul><li>Keep alive default is 15 - set it to 5 seconds! </li></ul><ul><li>Apache ready </li></ul><ul><li>Options: </li></ul><ul><li>- apache-worker with php on fast-cgi - have fun! </li></ul>
  14. 14. Mysql <ul><li>Default settings - new versions of Ubuntu have query cache turned on - this saved my butt on keo.co.za </li></ul><ul><li>MyISAM or InnoDB = WP performance almost the same with query cache turned on! </li></ul><ul><li>Mysql ready </li></ul><ul><li>Very cool Mysql tuning scripts on git hub - help set the settings from reading your server stats. </li></ul>
  15. 15. Hammer time <ul><li># ab -k -n1000 -c150 http://wptest.dev/index.php </li></ul><ul><li>Apache bench - comes with apache. </li></ul><ul><li>-n 1000 hit the site 1000 times! </li></ul><ul><li>-c 150 concurrent hits (apache max clients at 150) </li></ul><ul><li>-k try set keep alive </li></ul>
  16. 16. Warning : load 108! What?? <ul><li>Got 12 pages/sec out in 81 seconds, Load? </li></ul>
  17. 17. APC to the rescue. Not... <ul><li>OK, lets OP cache - preprocess all the PHP scripts and cache them in machine code. </li></ul><ul><li>hmmm - run test -> load spikes to 104 -> 12 pages/sec </li></ul><ul><li>Not much help </li></ul><ul><li>(I know there is more to APC - but not fresh install!!) </li></ul>
  18. 18. Jump Tests!!! <ul><li>- Get system stats? </li></ul><ul><li>- I only have one Hard drive in the server </li></ul><ul><ul><ul><li>What if its a disk IO issue? </li></ul></ul></ul>
  19. 19. RAM drive <ul><li>This is not an installation procedure! </li></ul><ul><li>Create copy files over to memory drive </li></ul><ul><li>- Be brave and run this in production </li></ul><ul><li>- Shoot your self in the foot </li></ul><ul><li>- Feels the same? </li></ul>
  20. 20. Got it - load 40 @ 53 req/s <ul><li>Blazing fast performance! </li></ul><ul><li>Same task completed in 17 seconds - 400% improvement!!! </li></ul><ul><li>Now do it in a safe way! WP pick your cache!!! </li></ul><ul><li>WP CACHE </li></ul><ul><li>WP SUPER CACHE </li></ul><ul><li>W3 TOTAL CACHE </li></ul><ul><li>What to name the next cache!!! </li></ul>
  21. 21. w3 Total cache <ul><li>This was suggested by the Joyent cloud developers </li></ul><ul><li>Options - </li></ul><ul><li>- Object </li></ul><ul><li>- Pages </li></ul><ul><li>- etc..... </li></ul><ul><li>Remove the Ram drive, install and activate just object cache, </li></ul><ul><li>Server load 40 @ 40 req/s - finished in 24 seconds..... nice </li></ul>
  22. 22. Cache’ing out! <ul><li>Turned on the total cache </li></ul><ul><li>- objects, pages, etc.... </li></ul><ul><li>Server load 33 @ 61 req/s </li></ul><ul><li>- finished in 16 seconds..... Blistering!!! </li></ul><ul><li>500% improvement!!! </li></ul>
  23. 23. The change
  24. 24. Split off static content Simple - define content url in the wp-config.php
  25. 25. Nginx & DNS <ul><li>- Bind to second IP on the same server </li></ul><ul><li>- webroot to the same as apache webroot </li></ul><ul><li>- return all media files. </li></ul>
  26. 26. Gain? <ul><li>- 1 call to Apache - PHP </li></ul><ul><li>- 8 calls to Nginx - no cookie, no resource hit! </li></ul>
  27. 27. Next step - Nginx proxy?? <ul><li>Setup Nginx to proxy dynamic calls to Apache on localhost and deliver static content itself. </li></ul><ul><li>Caution - plugins and client IP addresses.... Test, Test, etc.... </li></ul>
  28. 28. Simplicity, don’t over do it!
  29. 29. Thank you! Any Questions? FormFunction Digital Consultants (Pty) Ltd +27 21 462 0257 www.twitter.com/formfunction www.formfunction.co.za Roy Foubister [email_address] Skype: roy-osoutsource twitter.com/fobroster

Editor's Notes

  • Thanks for introduction..
  • Thanks for introduction..

×