Upload
ian-selby
View
12.195
Download
3
Tags:
Embed Size (px)
DESCRIPTION
Optimizing code, opcode caching, and building PHP apps to scale properly
Citation preview
Scalability in PHPScalability in PHP
Optimizing your code, and Optimizing your code, and building your apps to scalebuilding your apps to scale
Ian SelbyIan SelbySenior Web Developer at AptanaSenior Web Developer at Aptanawww.aptana.com www.aptana.com
So, how do ISo, how do I
… at least how do I do it in PHP?… at least how do I do it in PHP?
Build a ScalableBuild a ScalableApp?App?
We can optimize in three places:We can optimize in three places:
Bad Practices in Coding…Bad Practices in Coding…
Bad Practices in Coding…Bad Practices in Coding…
Bad Practices in Coding…Bad Practices in Coding…
Bad Practices in Coding…Bad Practices in Coding…
Bad Practices in Coding…Bad Practices in Coding…
Good Practices in Coding…Good Practices in Coding…
Good Practices in Coding…Good Practices in Coding…
Good Practices in Coding…Good Practices in Coding…
Good Practices in Coding…Good Practices in Coding…
Now that my code is optimized,Now that my code is optimized,
How do I makeHow do I makeit run faster?it run faster?
Easy!Easy!
Use Opcode Use Opcode Caching!Caching!
Duh!Duh!
What is opcode caching?What is opcode caching?
Opcode caching optimizes PHP Opcode caching optimizes PHP intermediate code and caches intermediate code and caches
data and compiled code from the data and compiled code from the PHP bytecode compiler in shared PHP bytecode compiler in shared
memory.memory.
Opcode caching optimizes PHP Opcode caching optimizes PHP intermediate code and caches intermediate code and caches
data and compiled code from the data and compiled code from the PHP bytecode compiler in shared PHP bytecode compiler in shared
memory.memory.
What is opcode caching?What is opcode caching?
Basically, your code is pre-Basically, your code is pre-compiled, and then stored in compiled, and then stored in
memory.memory.
So, it runs faster.So, it runs faster.
Basically, your code is pre-Basically, your code is pre-compiled, and then stored in compiled, and then stored in
memory.memory.
So, it runs faster.So, it runs faster.
APC – Alternative PHP CacheAPC – Alternative PHP Cache
http://pecl.php.net/apchttp://php.net/apc
But, it gets better…But, it gets better…
You can actuallyYou can actuallycache your owncache your owndata with APC!data with APC!
Let’s take a look at that now…Let’s take a look at that now…
Source code available at gen-x-design.comSource code available at gen-x-design.com
So, my code is gooder and cached..So, my code is gooder and cached..
What can I do What can I do to speed up myto speed up mydatabase stuff?database stuff?
Speed up your database stuff…Speed up your database stuff…
Speed up your database stuff…Speed up your database stuff…
Speed up your database stuff…Speed up your database stuff…
Cool, my databases are tuned…Cool, my databases are tuned…
What kind of What kind of infrastructureinfrastructureshould I set up?should I set up?
Building a scalable infrastructureBuilding a scalable infrastructure
Building a scalable infrastructureBuilding a scalable infrastructure
http://code.google.com/p/netgearman/
Building a scalable infrastructureBuilding a scalable infrastructure
Gearman ClientGearman Client
Building a scalable infrastructureBuilding a scalable infrastructure
Gearman JobGearman Job
Building a scalable infrastructureBuilding a scalable infrastructure
Gearman WorkerGearman Worker
Building a scalable infrastructureBuilding a scalable infrastructure
http://www.aptana.com/cloud
I’ll Show YouI’ll Show YouNow!Now!
That’s It!That’s It!For more information, and to ask any For more information, and to ask any
questions, visit us on the web:questions, visit us on the web:
www.aptana.comwww.aptana.com
Contact me: [email protected] me: [email protected]
To download studio, visit www.aptana.com/studio