Tech4Africa - Tuning LAMP, and beyond LAMP

895 views

Published on

At Tech4Africa 2012, I was asked to talk about the ins and outs of tuning the LAMP Stack for ultimate performance. But I think LAMP's days are numbered, so I segwayed to talking about Nginx, NoSql databases, and Javascript halfway through.

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

  • Be the first to like this

No Downloads
Views
Total views
895
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Tech4Africa - Tuning LAMP, and beyond LAMP

    1. 1. THE LAMP STACK No muss, no fuss scaling
    2. 2. Lamb Shank
    3. 3. The Lamp StackHow to make it rock, and why not to use it at all
    4. 4. Thanks for the internets• Linus Torvalds• US Military• The Porn Industry• and...
    5. 5. LAMP• Linux• Apache• MySql• PHP
    6. 6. Software Engineering Economics• Bandwidth is cheaper than• HDD is cheaper than• CPU is cheaper than• Memory is cheaper than• Development
    7. 7. Simple high availability, high performance MySql Apache Master HAProxy 1 MySql Apache SlaveInternets Heartbeat HAProxy MySql Apache Slave HAProxy 2 MySql Apache Slave
    8. 8. Load Balancers• HAProxy • Heartbeat • Elastic IP• Rackspace Load Balancer• Amazon Elastic Load Balancing
    9. 9. Easy Linux admin• Run Debian• Keep it up-to-date• Run as few packages as possible• Monitor the hell out of it
    10. 10. Apache• Most expensive - Creating child servers• RAM, RAM, RAM• PHP memory size * max processes < RAM
    11. 11. MySql• key_buffer = RAM / 2• wait_timeout <= 30• MyISAM vs InnoDB• Master-Slave vs Master-Master vs Cluster
    12. 12. MySql replication Master Master SlaveSlave Slave Slave Slave Slave
    13. 13. Master-Master Master/SlaveMaster/Slave Master/Slave Master/Slave
    14. 14. PHP• Use a framework• Use Memcached• Separate reading and writing (Master / Slave)• Watch that memory!
    15. 15. More about memcached• How it works• Why is it fast?• Why is it slow?
    16. 16. Frameworks• CodeIgniter• CakePHP• Yii• Wordpress• ...
    17. 17. Lost my Memory• Them: Feature Creep• Us: Lack of imagination
    18. 18. # cat /etc/php5/apache2/php.ini | grep memory; Maximum amount of memory a script may consume (128MB); http://php.net/memory-limitmemory_limit = 500M
    19. 19. LAMP got us this far, but...
    20. 20. Major problems with this architectureAnd if they haven’t fixed it yet, they probably never will
    21. 21. • PHP doesn’t close MySql connections• MySql can get blocked• Web servers go psycho when waiting on MySql• No good replication• Increasingly complex to scale
    22. 22. LNNJ?• Linux• Nginx• NoSql• Javascript
    23. 23. Asynchronous
    24. 24. Event-Driven
    25. 25. The network is the computer John Gage, Sun Microsystems
    26. 26. The web is changing from this
    27. 27. To this
    28. 28. To this
    29. 29. We’re not in Kansas anymore
    30. 30. Enablers• Ajax• JSON• Long polling/ Comet / Websockets• Javascript• HTML 5• Browsers that suck less
    31. 31. Form over function• XML is all about the structure of data• JSON is all about data
    32. 32. Prepare for Zombie Invasion
    33. 33. So how do we do this thang?
    34. 34. Start with an API
    35. 35. Keep data JSON
    36. 36. Data-only down the wire
    37. 37. Make the user do the hard work
    38. 38. Write more Javascript
    39. 39. Relinquish control
    40. 40. Jason Norwood-Young 10Layer jason@10layer.com

    ×