LAMP Optimization

2,687 views

Published on

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,687
On SlideShare
0
From Embeds
0
Number of Embeds
34
Actions
Shares
0
Downloads
64
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide
  • LAMP Optimization

    1. 1. LAMP Optimization LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    2. 2. 50 Slides! (counting this one) http://slideshare.net/csixty4 LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    3. 3. I’m not a sysadmin LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    4. 4. I’m not a sysadmin but I know what I like. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    5. 5. I Like Fast Servers LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    6. 6. LAMP Linux Apache MySQL PHP LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    7. 7. Optimizing Linux Prevent swapping Disable atime updates Buy another machine LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    8. 8. vmstat -S M Virtual memory statistics in Megabytes (or Kilobytes) LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    9. 9. “Free” drop + High “Swap” = Poor performance LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    10. 10. RAM is cheap. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    11. 11. “Access Timestamp” LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    12. 12. “I agree, we really should do something about atime.” - Linus Torvalds, 2007 LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    13. 13. Edit /etc/fstab In the fourth column, add noatime,nodiratime Save. Reboot. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    14. 14. Time is money. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    15. 15. Add another server Move database to its own server Load balance Cluster LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    16. 16. Optimizing Apache mod_cache Keep the riff-raff out Increase MaxClients LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    17. 17. a2enmod cache mem_cache LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    18. 18. Cache static content in RAM LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    19. 19. Cache static content in RAM It’s cheap. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    20. 20. mod_evasive LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    21. 21. Keep out vulnerability scanners and attacks LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    22. 22. More resources for everyone else. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    23. 23. MaxClients in your httpd.conf LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    24. 24. Trial and error LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    25. 25. Enough to handle simultaneous connections. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    26. 26. And RAM is still cheap. LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    27. 27. Optimizing MySQL Key Buffer Query Cache InnoDB LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    28. 28. Key Buffer in my.cnf LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    29. 29. Caches table indexes LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    30. 30. key_buffer_size=128M 20-25% (or so) of available RAM LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    31. 31. Query Buffer in my.cnf LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    32. 32. Caches parsed SELECTs LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    33. 33. query_buffer_size=64M Half of key_buffer_size LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    34. 34. You get the idea.
    35. 35. InnoDB database engine LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    36. 36. Row vs. table locking LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    37. 37. Faster UPDATE LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    38. 38. Optimized for key access LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    39. 39. Faster SELECT & UPDATE LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    40. 40. Optimizing PHP Upgrade to PHP 5.3 Install an accelerator Enable output buffering LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    41. 41. PHP 5.3 has mysqlnd LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    42. 42. Native Driver LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    43. 43. Up to 30% faster LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    44. 44. PHP Accelerators Alternative PHP Cache (APC) : 3x-5x faster eAccelerator XCache Zend Optimizer+ LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    45. 45. Output Buffering LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    46. 46. Actually makes code run slightly slower LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    47. 47. Browser gets whole page at once LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    48. 48. It certainly feels faster LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009
    49. 49. Questions? davidmichaelross.com daveross.tel LAMP Optimization :: Dave Ross :: Suburban Chicago PHP & Web Development Meetup :: SuburbanChicagoPHP.org :: October 1, 2009

    ×