Techniques for Building Enterprise PHP Applications
by Chuck Hagenbuch, John Coggeshall, Rock Mutchler from Zend
Problem: client’s site was slow
Resolutions:
– Profile site lloking for slow pages/functions in current system
. Patch this bottle necks with a faster solution:
for example caching dynamic content with zend platform or fixing poorly written code
– Identify small changes that causae large effect on site performance
. indexing tables properly
. removing large download from apache (with ZDS)
. Rewritting expensive PHP processes
– Sample from profiling the site
. the gallery section was reading the directory structure every time and checking this with mysql in order to provide the user with approved gallery pages.
. this directory/mysql process was made far less expensive by caching this data with Zend Platfrom’s dynamic page caching
. output_cache_fetch(string key, string function, int lifetime) was used to cache the return values of the function calls which returned the gallery listings.
. when new galleries were approved or altered in anyway output_cache_remove_key(string key) was called to allow the new information to be added to the cache.
–//–
Paypal SDK.
Problem: design a development kit for PayPal’s SOAP web services
Requirements;
. PHP4 and PHP5 compativle
. Use PEAR SOAP
. Code should automatically adapt to new WSDL
. Classes should be pre-defined for code completion
. Create a useable API out of 14 SOAP calls using over 70 complex types
PEAR SOAP Improvements
. Over 20 bugs fixed and enhancements made
. extension of SOAP_Header objects
. process XSD annotations for documentation
. PEAR SOAP v0.9.1 (most of the bug fixes was because of this project)
Pre-generated API
. Every call is pre-generated to avoid needing to parse WSDL on every request
. Type classes are generated as well, with an extension to the PEAR SOAP WSDL parser
. Types are automatically translated to SOAP_Value objects:
Automatic Update Script
. Check for new WSDL and other XML resources
. Rebuilds the entire SDK if available files are newer than the bundled versions
. php paypal-sdk-update version
. php paypal-sdk-update update
. php paypal-sdk-update rollback
Online Testing Console
. Visual WSDL call builder
. Walks you through profile creation, displays code, executes calls and display results
. also includes paypal button encription
The paypal sdk is now being downloaded four times as often as all other sdk languages from the paypal developer network
–//–
Client InstaClick
Issues
. Need the ability to scale to 24 million users
. servers are reaaching capacity
. certain parts of system architecture has scalability issues
Resolutions
. Complete architecture review
. server/software configurations
. review and changes to design guidelines
. Benchmarking
. On the 2 OS’s supported by Instaclick (freeBSD, OS X)
. Mysql, apache, squid (different versions of the software as well)