Scalability In PHP

13,384 views

Published on

Optimizing code, opcode caching, and building PHP apps to scale properly

Published in: Technology

Scalability In PHP

  1. 1. Scalability in PHP Optimizing your code, and building your apps to scale Ian Selby Senior Web Developer at Aptana www.aptana.com
  2. 2. So, how do I … at least how do I do it in PHP? Build a Scalable App?
  3. 3. We can optimize in three places:
  4. 4. Bad Practices in Coding…
  5. 5. Bad Practices in Coding…
  6. 6. Bad Practices in Coding…
  7. 7. Bad Practices in Coding…
  8. 8. Bad Practices in Coding…
  9. 9. Good Practices in Coding…
  10. 10. Good Practices in Coding…
  11. 11. Good Practices in Coding…
  12. 12. Good Practices in Coding…
  13. 13. Now that my code is optimized, How do I make it run faster?
  14. 14. Easy! Use Opcode Caching! Duh!
  15. 15. What is opcode caching? Opcode caching optimizes PHP intermediate code and caches data and compiled code from the PHP bytecode compiler in shared memory.
  16. 17. What is opcode caching? Basically, your code is pre-compiled, and then stored in memory. So, it runs faster.
  17. 18. APC – Alternative PHP Cache http://pecl.php.net/apc http://php.net/apc
  18. 19. But, it gets better… You can actually cache your own data with APC! Let’s take a look at that now…
  19. 20. Source code available at gen-x-design.com
  20. 21. So, my code is gooder and cached.. What can I do to speed up my database stuff?
  21. 22. Speed up your database stuff…
  22. 23. Speed up your database stuff…
  23. 24. Speed up your database stuff…
  24. 25. Cool, my databases are tuned… What kind of infrastructure should I set up?
  25. 26. Building a scalable infrastructure
  26. 27. Building a scalable infrastructure http://code.google.com/p/netgearman/
  27. 28. Building a scalable infrastructure Gearman Client
  28. 29. Building a scalable infrastructure Gearman Job
  29. 30. Building a scalable infrastructure Gearman Worker
  30. 32. Building a scalable infrastructure http://www.aptana.com/cloud
  31. 33. I’ll Show You Now!
  32. 35. That’s It! For more information, and to ask any questions, visit us on the web: www.aptana.com Contact me: ian@aptana.com To download studio, visit www.aptana.com/studio

×