Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Federico Feroldi: PHP in Yahoo!


Published on

Published in: Technology
  • Be the first to comment

Federico Feroldi: PHP in Yahoo!

  1. 1. PHP at Yahoo! Federico Feroldi Senior Architect Engineer Yahoo! Europe
  2. 2. This presentation <ul><li>Yahoo! numbers and values </li></ul><ul><li>Yahoo! and PHP: a brief history </li></ul><ul><li>PHP at Yahoo! today </li></ul><ul><li>Final notes, QA </li></ul>
  3. 3. Yahoo! Some numbers
  4. 4. Some numbers about Yahoo! 20 Countries & Languages
  5. 5. Some numbers about Yahoo! 500M Unique visitors per month 238M Active registered users source comScore March 2007
  6. 6. Some numbers about Yahoo! 3,5B Average daily pageviews source comScore March 2007
  7. 7. Our Mission
  8. 8. Our Mission To connect people to their passions , their communities , and the world’s knowledge
  9. 9. Our values as a Engineers Security and Privacy High Availability Performance Flexibility and Innovation
  10. 10. Yahoo! and PHP A brief history…
  11. 11. Yahoo! and PHP: a brief history We started in 1994 with custom C/C++ software Because at the time, free technologies were considered too “immature” to run large, complex destinations.
  12. 12. Yahoo! and PHP: a brief history Then we moved to the Open Source software The growth of the Open Source movement has spurred a change in thinking because languages like PHP aid performance and integration.
  13. 13. Yahoo! and PHP: a brief history Circa 1996 The Filo* Web Server was replaced by the Apache web server * David Filo, one of the Yahoo! founders, coded this simple, programmable, high performance web server that powered the first Yahoo! web site.
  14. 14. Yahoo! and PHP: a brief history Circa 1999 We replaced custom flat binary files with the Open Source MySQL database
  15. 15. Yahoo! and PHP: a brief history Circa 2001 We needed to replace our custom scripting languages with a modern language designed for the Web. Custom scripting languages became a “pain in the neck to maintain and use” and was difficult to integrate them with third-party software.
  16. 16. Yahoo! and PHP: a brief history What we needed High Performance Robust, sand boxed environment Modern language features C/C++ extensions Runs on FreeBSD Internationalization support Low training costs
  17. 17. Yahoo! and PHP: a brief history Why we picked PHP Designed for Web scripting High Performance Large Open Source Community Code-in-HTML paradigm Integration, libraries, extensibility Tools: IDE, debugger, profiler
  18. 18. PHP at Yahoo! today
  19. 19. PHP at Yahoo! today Development Methodology Server Architecture Application Layout Dependency Management Security Performance Globalization Open Source Frameworks
  20. 20. Yahoo! PHP: Server Architecture Users Load Balancers Apache PHP APC, PEAR, PECL, Custom Extensions Custom Apache Extensions FreeBSD 4.x/6.x, Linux 2.6.x MySQL Web Services Ad API User API
  21. 21. Yahoo! PHP: Application Layout HTML PHP HTML Templates /usr/local/share/htdocs/*.php Template Helpers /usr/local/share/htdocs/*.inc Business Logic /usr/local/share/pear/*.inc Data Access, Networking, Crypto C/C++ core code
  22. 22. Yahoo! PHP: Dependency Management Light base PHP package Basic PHP install includes only XML parser. All extensions disabled by default: ./configure --disable-all + Avoids unnecessary dependencies + Smaller Apache memory footprint
  23. 23. Yahoo! PHP: Dependency Management Self contained extension packages Extensions can be installed separately with the package management tool. Required dependencies are included in the installation process.
  24. 24. Yahoo! PHP: Security php.ini settings Always set open_basedir Insurance against /etc/passwd exploits. Set allow_url_fopen = Off Use libcurl instead, avoid open proxy exploits. Set display_errors = Off However, set log_errors = On
  25. 25. Yahoo! PHP: Security Input Filtering XSS and SQL Inj. most common attacks Never trust the data coming from the browser. Use input_filter hook Sanitize all user-submitted data on each request. Use PECL filter package Derived from our filtering library.
  26. 26. Yahoo! PHP: Performance Opcode Caches Easiest performance boost Cache parsed PHP scripts in shared memory. Runtime optimizations without code modifications. Several products available APC* Zend Performance Suite Turck MMCache * that’s what we use
  27. 27. Yahoo! PHP: Performance Custom PHP Extensions in C/C++ Yahoo! Develops its own extensions Fast and optimized execution speed. Access to custom client libraries. but Longer development (edit, compile, link, debug) Manual memory management (and related issues)
  28. 28. Yahoo! PHP: Performance Applications architecture Avoid PHP sessions (they’re slow) Use cookies to store the user data that you most often need (like userid, profile timestamp, etc…) in an encrypted and signed format.
  29. 29. Yahoo! PHP: Globalization Unicode Yahoo! contributed to PHP Unicode ext. Andrei Zmievski (Yahoo!), Andi Gutmans (Zend) and many members of PHP community.
  30. 30. Yahoo! PHP: Globalization I18N support Generate per intl PHP templates (r3 TMT) Yahoo! has donated to the Open Source his homegrown Template Management Tool (r3 TMT) . r3 allows developers of web applications to customize and translate their UI for different languages, markets and uses.
  31. 31. Yahoo! PHP: PHP Frameworks Smarty Not widely used at Yahoo!. Written in user-space PHP . Caching lowers but does not eliminate the run-time overhead on each request . With Yahoo!'s level of traffic, this overhead can be considerable .
  32. 32. Yahoo! PHP: PHP Frameworks Symfony We began to use Symfony ! (recently) Good for integrated development , testing . Factors out common patterns . Encourages good design .
  33. 33. Yahoo! PHP: PHP Frameworks Symfony (what we kept) Core MVC Architecture Configuration system The View Layer User Security
  34. 34. Yahoo! PHP: PHP Frameworks Symfony (what we replaced) Model Layer and ORM Doesn’t scale to our needs Configuration system (extended) More flexible , I18N support Internationalization Integrated with r3 TMT
  35. 35. Yahoo! PHP: PHP Frameworks Drupal Usage investigations going on. Excellent application framework . Not tested yet on Yahoo! production .
  36. 36. Final notes
  37. 37. Yahoo! Developer Network PHP Developer Center Using PHP with Yahoo! Web Services API HowTo Articles and Code Samples . Active community .
  38. 38. Yahoo! Developer Network Yahoo! Web Services Yahoo! Mail API Integrate your application with Yahoo! Mail . Yahoo! Maps API Easily build advanced map based mashups . Flickr API Get access to milion of pictures . API The number one tagging and bookmarking tool .
  39. 39. Thank you! - Questions? Yahoo! Developer Network Federico Feroldi [email_address]