zendcon 2008 or: how i learned to stop worrying and love the php

26
ZendCon 2008 ZendCon 2008 Or: Or: How I learned to stop How I learned to stop worrying and love the PHP. worrying and love the PHP.

Post on 15-Jan-2016

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

ZendCon 2008ZendCon 2008

Or: Or:

How I learned to stop How I learned to stop

worrying and love the PHP.worrying and love the PHP.

Page 2: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

KeynoteKeynote

Many companies replacing Java with Many companies replacing Java with PHPPHP Zero9Zero9 Orange UK (Telecom)Orange UK (Telecom) BNP Paribas (French Bank)BNP Paribas (French Bank) IGNIGN YahooYahoo DFW AirportDFW Airport

Page 3: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

New stuff from ZendNew stuff from Zend Framework Cert.Framework Cert. AppCeleratorAppCelerator Magento(ecommerce)Magento(ecommerce) Zend Studio 6.1Zend Studio 6.1 Partnership w/ AdobePartnership w/ Adobe Adobe => FlexAdobe => Flex

Zend StudioZend Studio PHPUnit (testing)PHPUnit (testing) FlexFlex AMF (Flash AMF (Flash

ActionScript)ActionScript) Dojo (javascript Dojo (javascript

components/widgets)components/widgets)

Page 4: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Join-FuJoin-Fu

Slides in X driveSlides in X drive

Page 5: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Analysis @ NingAnalysis @ Ning

ToolsTools OprofileOprofile Dtrace extensionDtrace extension System tapSystem tap

www.sklar.com/blog/www.sklar.com/blog/ Slides on X:Slides on X:

Page 6: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

PECL Picks (PHP Extens.)PECL Picks (PHP Extens.)

Opcode CachingOpcode Caching APCAPC MemcachedMemcached

Image ManipulationImage Manipulation ImagickImagick

Curl ReplacementCurl Replacement Pecl_HttpPecl_Http

Upload Progress - UploadProgressUpload Progress - UploadProgress

Page 7: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

PDF – PDF, HaruPDF – PDF, Haru Version Control – svnVersion Control – svn Database – PDO*, PDO_User (netezza?)Database – PDO*, PDO_User (netezza?) I18n – TranslitI18n – Translit Diffs – xdiffDiffs – xdiff Search – SphinxSearch – Sphinx Doing “bad” thingsDoing “bad” things

Runkit, funcall, intercept, operatorRunkit, funcall, intercept, operator Type Hinting – spl_typesType Hinting – spl_types Params - paramsParams - params

Page 8: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Debugging – XdebugDebugging – Xdebug Language EmbeddingLanguage Embedding

Java, Lua, Perl, PythonJava, Lua, Perl, Python

OtherOther Ssh2Ssh2 AMFAMF

Elizabethmariesmith.comElizabethmariesmith.com Slides on X:Slides on X:

Page 9: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Knight Rider Knight Rider MethodologyMethodology

Eli WhiteEli White Tripadvisor, travelpod, eliw.comTripadvisor, travelpod, eliw.com

All about the toolsAll about the tools Editor – notepad, studio, ide, etc…Editor – notepad, studio, ide, etc… Profiling – APD, wincachegrind, webgrind, Profiling – APD, wincachegrind, webgrind,

xdebugxdebug Load testing – http_load, siege, Load testing – http_load, siege,

apachebenchapachebench

Page 10: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Performance – APC, memcached, Performance – APC, memcached, gearman (batch processing)gearman (batch processing)

Code Libraries – Pecl, pear, js – jquery Code Libraries – Pecl, pear, js – jquery etcetc

Debugging – xdebug, dbg, zstudio, apd, Debugging – xdebug, dbg, zstudio, apd, firebug, dev toolbarfirebug, dev toolbar

Testing – simpletest, phpt, phpunit, Testing – simpletest, phpt, phpunit, selenium (js)selenium (js)

Multi-tier servers – Dev, Integration, Multi-tier servers – Dev, Integration, Testing, Staging, ProductionTesting, Staging, Production

Errors – E_ALL && E_STRICTErrors – E_ALL && E_STRICT

Page 11: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Version Control – SVN, CVS, GITVersion Control – SVN, CVS, GIT Lint (suspicious code) – php –l, phplintLint (suspicious code) – php –l, phplint Code Sniff – check coding standardsCode Sniff – check coding standards GUIs – DB – aqua data studio, GUIs – DB – aqua data studio,

squirrelsql; version control – squirrelsql; version control – subcommander, smartsvnsubcommander, smartsvn

Little things (commands) – rsync, grep, Little things (commands) – rsync, grep, find, sed, cutfind, sed, cut

Hardware – acquire what will helpHardware – acquire what will help Social networking – Community!Social networking – Community!

Page 12: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Zend Studio SecretsZend Studio Secrets

F-KeysF-Keys Ctrl-f8 = switch persepctivesCtrl-f8 = switch persepctives Ctrl-f7 = switch panesCtrl-f7 = switch panes Ctrl-f6 = switch files, alt-left, alt-rightCtrl-f6 = switch files, alt-left, alt-right Ctrl-m = max/minimize panesCtrl-m = max/minimize panes Ctrl-l = show shortcutsCtrl-l = show shortcuts Ctrl-r = open fileCtrl-r = open file Ctrl-k = show next findCtrl-k = show next find

Can be config’d to show white spaceCan be config’d to show white space Wizards – PHPUnitWizards – PHPUnit

Page 13: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Rich UIs w/ ZF + DojoRich UIs w/ ZF + Dojo

Webinar @ Webinar @ http://www.zend.com/en/resources/webinhttp://www.zend.com/en/resources/webinars/ars/

Matthew Weier O’PhinneyMatthew Weier O’Phinney

Page 14: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Keynote WednesdayKeynote Wednesday MagentoMagento

OOPOOP Zend FrameworkZend Framework 170 Extensions170 Extensions Powering Poster.com, fiesta bowlPowering Poster.com, fiesta bowl Modular, flexibleModular, flexible Connect – extension siteConnect – extension site Customize user experienceCustomize user experience Iphone optimizedIphone optimized Layered NavigationLayered Navigation Ratings, reviews, tags, feedsRatings, reviews, tags, feeds Call center functionalityCall center functionality Promotion enginePromotion engine

Page 15: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

ZF – Less TrainingZF – Less Training NewBSD LicenseNewBSD License Design packages (themes)Design packages (themes) Pear channelPear channel SOAP, XMLRPC APIsSOAP, XMLRPC APIs

Page 16: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Web Services w/ Z Frame.Web Services w/ Z Frame. Matthew Turling – ishouldbecoding.comMatthew Turling – ishouldbecoding.com HTTP_AuthHTTP_Auth

Zend_Server_InterfaceZend_Server_Interface Zend_Server_ReflectionZend_Server_Reflection Zend_Server_AbstractZend_Server_Abstract

RESTREST Zend_Rest_Server – not idealZend_Rest_Server – not ideal Zend_Rest_ClientZend_Rest_Client Book: Restufl web services, isbn: 059652…Book: Restufl web services, isbn: 059652…

Page 17: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

ControllerController contextSwitchHelpercontextSwitchHelper Content NegotiationContent Negotiation

XMLRPCXMLRPC Zend_XmlRpc_Server, _Request, _Response, _Server_Fault, Zend_XmlRpc_Server, _Request, _Response, _Server_Fault,

_Server_Cache (not ready), _Client, _Client_Serverproxy _Server_Cache (not ready), _Client, _Client_Serverproxy (allows xmlrpc as native php object)(allows xmlrpc as native php object)

Boxcarring – allow multiple calls on single requestBoxcarring – allow multiple calls on single request JSON-RPCJSON-RPC

Zend_Json_Server, _Server_smd, _Server_Request, Zend_Json_Server, _Server_smd, _Server_Request, _Server_error_Server_error

SOAPSOAP Zend_Soap_ServerZend_Soap_Server Verbose, enumerators, complex, namespaces, user-defined Verbose, enumerators, complex, namespaces, user-defined

data typesdata types

Page 18: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

RIA w/ ZF + Flex + AirRIA w/ ZF + Flex + Air John Coggeshall – Automotive Computer John Coggeshall – Automotive Computer

ServicesServices Air – Allows access to local services on Air – Allows access to local services on

clientclient Zend StudioZend Studio

Flex Builder PluginFlex Builder Plugin Log_Watcher pluginLog_Watcher plugin

Adobe Actionscript3 + Flex w/ PureMVC Adobe Actionscript3 + Flex w/ PureMVC extension (puremvc.org)extension (puremvc.org)

Page 19: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Enterprise PHPEnterprise PHP Ivo JanschIvo Jansch Know customer wants vs needsKnow customer wants vs needs Wireframes – Axure (Wireframes – Axure (www.axure.comwww.axure.com) )

$500 for 5 seats$500 for 5 seats CruiseControl, PHPUnderControlCruiseControl, PHPUnderControl

Page 20: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Scaling Mozilla’s Scaling Mozilla’s WebsitesWebsites Laura ThomsonLaura Thomson

Mozilla.com runs on DrupalMozilla.com runs on Drupal Services – Bouncer (load balancing)Services – Bouncer (load balancing) Addons.mozilla.com = “AMO”Addons.mozilla.com = “AMO”

72M hits, 4M page views, 1M user sessions72M hits, 4M page views, 1M user sessions Runs on CakePHPRuns on CakePHP

InfrastructureInfrastructure 3 datacenters (San Jose, Amsterdam, China)3 datacenters (San Jose, Amsterdam, China) Net Scaler hardware (Citrix)Net Scaler hardware (Citrix) Web Servers -> memcached, db cluster (my,pg)Web Servers -> memcached, db cluster (my,pg)

12 nodes each for static, dynamic12 nodes each for static, dynamic

Page 21: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Scaling SUMO (support.mozilla.org)Scaling SUMO (support.mozilla.org) KB, Forum, wiki (tikiwiki)KB, Forum, wiki (tikiwiki) Initially only 5 reqs/secondInitially only 5 reqs/second Architecture analysisArchitecture analysis Load TestsLoad Tests Profiling (xdebug + kcachegrind)Profiling (xdebug + kcachegrind) 270 Queries / page load!270 Queries / page load! Reduce includesReduce includes Now up to 12 reqs/secondNow up to 12 reqs/second DBDB

Caching, move to innodbCaching, move to innodb Fix slow queries, add indexesFix slow queries, add indexes Now down to 19 queries/pageNow down to 19 queries/page Duplication – Send selects to slaves, other to masterDuplication – Send selects to slaves, other to master Logic to make post-update selects on masterLogic to make post-update selects on master

Memcached – Whole-page, sessionsMemcached – Whole-page, sessions

Page 22: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Scaling SUMO contd.Scaling SUMO contd. Use cron jobs instead of rolling up on certain Use cron jobs instead of rolling up on certain

pagespages Load Testing (now at 22 reqs/sec)Load Testing (now at 22 reqs/sec)

MilleniumMillenium Log replayLog replay https://svn.mozilla.org/projects/webtesthttps://svn.mozilla.org/projects/webtest

Peak Download Day StatsPeak Download Day Stats 14Gb/s14Gb/s 2Gb/s web traffic2Gb/s web traffic 300x spike300x spike Turned off AMO to helpTurned off AMO to help One net scaler failedOne net scaler failed

Page 23: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Testing With SeleniumTesting With Selenium Stefan PriebschStefan Priebsch Testing – Unit, system, acceptance, integration, Testing – Unit, system, acceptance, integration,

performance, load, usability, securityperformance, load, usability, security Selenium IDE – ide.openqa.org – firefox pluginSelenium IDE – ide.openqa.org – firefox plugin

AssertionsAssertions PluginsPlugins

Selenium RC – Remote control, selenium-Selenium RC – Remote control, selenium-rc.openqa.orgrc.openqa.org

PHPUnit integrationPHPUnit integration PHPUnit_Extensions_selenium_testcase (can set up using PHPUnit_Extensions_selenium_testcase (can set up using

xvfb)xvfb) Can be fired via Cruisecontrol (phpUnderControl for mgmt), Can be fired via Cruisecontrol (phpUnderControl for mgmt),

Continuum, XincContinuum, Xinc Virtual Machines – Snapshot mgmtVirtual Machines – Snapshot mgmt

Side note – Red hat switching to KVM from XEN.Side note – Red hat switching to KVM from XEN.

Page 24: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Scaling PHP ApplicationScaling PHP Application Maurice Kherlakian – Bell CanadaMaurice Kherlakian – Bell Canada ScalabilityScalability

Performance vs High AvailabilityPerformance vs High Availability

Load Balancers – Soft vs hardwareLoad Balancers – Soft vs hardware Session Persistence – Sticky, Sharing Session Persistence – Sticky, Sharing

(memcached), Session Clusting in Z. Platform(memcached), Session Clusting in Z. Platform

Synchronization – Rsync –avzSynchronization – Rsync –avz Static Content SeparationStatic Content Separation

Memory consumptionMemory consumption Use low-memory http server (lighttpd, thttpd) or cdnUse low-memory http server (lighttpd, thttpd) or cdn

Page 25: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

DatabaseDatabase Master-slave, dual master, replicationMaster-slave, dual master, replication DRDB = master-slave, HA, no perf gainDRDB = master-slave, HA, no perf gain Mysql clusterMysql cluster Partitioning, shardingPartitioning, sharding Tools – mysql_sla, slow query log, monyogTools – mysql_sla, slow query log, monyog

Code AccelerationCode Acceleration XCache, APC, eAccelerator, Zend PlatformXCache, APC, eAccelerator, Zend Platform DB RequestsDB Requests HTML CachingHTML Caching Client side – etags, expire headersClient side – etags, expire headers

Code DesignCode Design Standards, Zend FrameworkStandards, Zend Framework

Plan Plan Plan!Plan Plan Plan! Ensure CompatibilityEnsure Compatibility

Page 26: ZendCon 2008 Or: How I learned to stop worrying and love the PHP

Final KeynoteFinal Keynote Mark deVisser – American Cancer Mark deVisser – American Cancer

SocietySociety Social network for cancer storiesSocial network for cancer stories www.sharinghope.tvwww.sharinghope.tv VMIX for video back endVMIX for video back end ““Code Against Cancer” requesting helpCode Against Cancer” requesting help