accelarating php applications at intan sabah technology updates 2011

53
www.mimos.my © 2009 MIMOS Berhad. All Rights Reserved. Accelerating PHP Applications Errazudin Ishak

Upload: phptechtalk

Post on 18-May-2015

1.194 views

Category:

Technology


0 download

DESCRIPTION

"Accelarating PHP Applications" Presented at INTAN Sabah Technology Updates 2011

TRANSCRIPT

Page 1: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2009 MIMOS Berhad. All Rights Reserved.

Accelerating PHPApplications

Errazudin Ishak

Page 2: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Who Am I

PHP Center of Excellence

The Curious Case of Enterprise PHP

Summary

Agenda

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 3: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Senior engineer @ Mimos Berhad

Focuses on web application development, deployment, performance and stability.

2009 : foss.my , MyGOSSCON

2010 : Entp. PHP Techtalk, BarcampKL, PHP Meetup, MOSC2010, PHPNW UK, PHP20102010, MyGOSSCON

Me

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 4: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Agenda

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Who Am I

PHP Centre of Excellence

The Curious Case of Enterprise PHP

Summary

Page 5: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

phpcoe.mimos.my

Page 6: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

phpcoe.mimos.my

Top goals;

• increasing the maturity of the PHP application life cycle,

• showcasing the best practice of enterprise PHP development

• contributing to/supporting PHP open source projects

• supporting PHP user groups/communities

• organizing conferences/seminar

• developing localized training material

• forming and maintaining partnerships with the communities and developing professional services.

Page 7: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Events : Enterprise PHP Tech talk

Page 8: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Events : Facebook Developer Garage

Page 9: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Events : PHP Malaysia Meetup

Page 10: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Events : PHP Northwest, UK

Page 11: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Accelerating PHP Application

http://goo.gl/EbTI

Page 12: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

The News

Page 13: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

iSDPIntelligent Service Delivery Platform

Page 14: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

The struggle begins..

Page 15: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Who Am I

PHP Center of Excellence

The Curious Case of Enterprise PHP (How actually we makes PHP apps fly)

Summary

Agenda

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 16: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Enterprise == ?

Page 17: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

BA

Designer

Project Lead

DBA

Tester

PM

Sys. AdPHP Geek

TEAM

Page 18: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

TEAM

Requirement

•Customer need this …•User want that …•My boss add this …•My BA... more headache …

Page 19: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

"Faster sites create happy users” – Google, April 9, 2010

http://www.flickr.com/photos/36230948@N05/

Page 20: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• Planning

oRequirement Analysis

oDesign

• Execution

oCode

oTest

• Deployment

oSys Adm nightmare?

Web Application Lifecycle

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 21: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• Planning

oRequirement Analysis

oDesign

• Execution

oCode

oTest

• Deployment

oSys Adm nightmare?

Web Application Lifecycle

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 22: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• Planning

oRequirement Analysis

oDesign

• Execution

oCode

oTest

• Deployment

oSys Adm nightmare?

Web Application Lifecycle

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 23: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

TEAMRequirement

Architecture

•Design Diagrams (Technical )•HLD•Blueprint

Page 24: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

"Real performance is architecture-driven”- R.Lerdorf

http://goo.gl/abCVp

Page 25: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

"PHP is rarely the bottleneck”

-R.Lerdorf

Page 26: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Front End

Back End

Page 27: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Front End

nginx Zend Server

Page 28: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Back End

Zend Server

MySQL

Page 29: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

TEAMRequirementArchitecture

Tools

•Planning•Development•Deployment

Page 30: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

TEAMRequirementArchitectureTools

Foundation

•Stable?•Framework vs No-Framework•On Your Own Frame to-do work

Page 31: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

TEAMRequirementArchitectureToolsFoundation

Design patterns

•Best practice of solving probs.•MVC?

Page 32: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

TEAMRequirementArchitectureToolsFoundationDesign patterns

Testing

•Developer, Unit, Functional, Performance, Integration,Usability

Page 33: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

TEAMRequirementArchitectureToolsFoundationDesign patternsTesting

Optimization

•They want it fast•We need

•Accelerator (eAccelerator, Alternative PHP Cache, ionCubePHP Accelerator,Turck MMCache,XCache,NuspherePhpExpress,Zend Optimizer+,Zend Platform •Cache (Smarty, Zend_Cache, Memcached)

Page 34: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

"Premature optimization is the root of all evil ”- Donald Knuth

http://goo.gl/twTea

Page 35: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• System calls

oweb server processes

o Index

oWeb server config

o Include

o S-L-D-Ktrace / truss

Where to start

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 36: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• Include hierachy > redundancy

oTools > pecl/inclued

o include_once/require_once

oGraph

Find the culprit

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 37: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

"Profile your code to pinpoint bottlenecks”

- Eric Higgins

Page 38: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• Code

• Network

• DB

• System

Areas

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 39: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• xdebug

• valgrind.org

• Xhprof

• Zend Studio/Server

Profiling Tools

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 40: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

TEAMRequirementArchitectureToolsFoundationDesign patternsTestingOptimization

Security

•Prevention of harmful event(s)•Real Risk•Severe consequences

http://goo.gl/nPgwj

Page 41: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

TEAMRequirementArchitectureToolsFoundationDesign patternsTestingOptimizationSecurity

Deployment

•Develop, Test, Deploy (Test, Live)•Simple XAMPP to HA, Scalable architecture

Page 42: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

“Every nanoseconds count!” - My Big Boss(your boss also)

http://geekonfilm.files.wordpress.com/2009/09/vader.jpg

Page 43: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• Design

o Algorithm used

o Architecture

o Special tricks

• Code

o Avoid ‘slowdowns’

• Deploy

o “it works on my dev machine!”

Layers

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 44: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• Measure

• Benchmark

• Analyse

• (Loop?)

Performance Enhancement

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 45: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• Avoid Premature Optimization

• Measuring Performance

oMemory and CPU Measurement

o Requests Per Second

• Pinpointing The Cause Of Poor Performance

• Code Profiling

• Database Operations Analysis

• General PHP Optimisation

o Opcode Caching

o Realpath Cache

Key Points

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 46: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• General Zend Framework Optimization

o Class Loading Optimisation

o Configuring Default Caches

o Cache At The Right Level

o Minimising Include Paths

• HTTP Server Optimization

o Optimising Apache's Configuration

o Avoiding Apache Completely

Key Points

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 47: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

TEAMRequirementArchitectureToolsFoundationDesign patternsTestingOptimizationSecurityDeployment

Operation•Helpdesk•Monitoring•Root cause analysis•Change management

Page 48: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Enterprise PHP

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

TEAMRequirementArchitectureToolsFoundationDesign patternsTestingOptimizationSecurityDeploymentOperation

Page 49: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Who Am I

PHP Center of Excellence

The Curious Case of Enterprise PHP

Summary

Agenda

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 50: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

• Objectives & constraints

• What is the Problems

• Don’t make assumptions (VNV it)

• Right tools (but tools is just a tools)

• Use profiler with benchmarks

• Resources are limited (monitor them)

Checklist

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Page 51: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

Ready to make your web apps fly?

http://goo.gl/abCVp

Page 52: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

Resources

www.mimos.my © 2011 MIMOS Berhad. All Rights Reserved.

• Eric Higgins, Google Webmaster code.google.com/speed/articles/optimizing-php.html

• Rasmus’s talk at Hacker Dojo http://talks.php.net/show/digg/

• code.google.com/speed/page-speed

• developer.yahoo.com/performance/rules.html

• www.zend.com/en/products/server

• www.nginx.net

• www.survivethedeepend.com

• pecl.php.net/package/xhprof

• github.com/facebook/xhprof

Page 53: Accelarating PHP Applications at INTAN Sabah Technology Updates 2011

THANK YOU

www.mimos.my © 2009 MIMOS Berhad. All Rights Reserved.

@errazudin

* All images, logos and data are the copyright of their respective owners

[email protected]