Docsity

Web Performance Optimization Techniques for PHP Applications, Summaries of Optimization Techniques in Engineering

Partial preview of the text

Download Web Performance Optimization Techniques for PHP Applications and more Summaries Optimization Techniques in Engineering in PDF only on Docsity!

CAP

WEB PERFORMANCE OPTIMIZATION

  • (^) PHP is a server scripting language, and a powerful tool for making

dynamic and interactive Web pages.

  • (^) PHP has become the most popular web scripting language.
  • (^) The downside to the popularity of back-end scripting is higher

performance overheads

  • (^) Although PHP scripts are typically fairly lightweight, they are still a

lot slower to serve up than static HTML documents.

  • (^) In the case of heavier scripts, there can be a significant

performance hit — both for the client (in the form of higher latency

in requests), and for the server (in the form of higher resource

usage, and a lower limit on the number of concurrent requests).

  • (^) Aside from that, shared extensions are also more convenient, because they can easily be loaded or unloaded via php.ini.
  • (^) Static extensions must be built into PHP at compile time, making it more awkward to change which extensions are enabled.
  • (^) The one disadvantage to compiling in extensions is that there is a little extra overhead involved in dynamically loading shared extensions.
  • (^) Generally, though, the advantages of shared extensions (on memory usage) far outweigh this.
  • (^) Writing Your Own PHP Extensions
  • (^) PHP extensions have all the usual benefits of being written in a compiled language (C) — they are faster to execute and have a lower memory footprint; and there is a much lower delay before they begin executing.
  • (^) Compiling
  • (^) Aside from giving you complete control over installed modules, compiling PHP from the source also enables you to implement the usual compile-time performance options (such as CPU-specific features and higher levels of optimization).

• COMPILING PHP

  • (^) Given that interpreted languages are inherently slower than compiled ones, the thought of compiling PHP into an executable format is a tempting one.
  • (^) To some extent, this is what opcode caching does — it stores your PHP code after it has been compiled into bytecode and allows this to be reused.
  • (^) Bytecode still isn’t as fast as native machine code, though (because it must still be interpreted). A true compiled program would offer significant advantages.
  • (^) PHC
  • (^) Phalanger
  • (^) HipHop
  • (^) SESSIONS
  • (^) Sessions tend to be used extensively in PHP as a means of keeping state, but they can be a source of performance issues — particularly when multiple web servers are involved.
  • (^) Storing Sessions
  • (^) Storing Sessions in memcache/membase
  • (^) Using Shared Memory or tmpfs
  • (^) Session AutoStart
  • (^) Sessions and Caching