Most of the tips listed here will not help you
improve performance by any significant amount. The following is a list
of things that you can do that will improve the performance of your web
apps significantly.
Better ways to improve php application performance
Google recently released a document on how to improve PHP performance here.
Most of the tips listed here will not help you improve performance by
any significant amount. The following is a list of things that you can
do that will improve the performance of your web apps significantly.
1) object code caching
Each time a request comes to your server for a php script, it has to
go through the compiler and then execute the object code. If this is
cached, the 1st step is skipped and you end up with a faster and more
responsive script.
2) Template systems
Template systems provide a different type of caching. Content
caching. Template systems work well in a situation where there is
static data on one or many of your pages that doesn’t have to be
reloaded. Caching systems also provide a separation of code and html,
which will not only improve completion time of the overall project, but
make it easier for future improvments.
3) Distributed object caching systems
The most widely used system of this type is memcached (http://www.danga.com/memcached/).
This type of system makes your overall site faster by caching the majority of your database data into a large memory pool.
more on memcached:
4) PHP variables that can be set
variables_order = ‘GPC’
register_argc_argv = ‘Off’
register_globals = ‘Off’ (this is a good idea to keep off for security purposes as well)
always_populate_raw_post_data = ‘Off’
magic_quotes_gpc = ‘Off’
Disable Error Logging. This is a good idea to keep on when you are developing your scripts, but it has been known to decrease overall performance.
Use IP addresses, rather than host names to access your database. Although
this is sometimes not possible, you will get a slight boost in lookup
speed if the IP address is used to access your database rather than its
hostname.
5) Output Compression
Almost all browsers these days support something called gzip
compression. Gzip compression can decrease the overall size of your
output by up to 80%, but with a tradeoff: cpu usage will go up by
around 10%. The benefit of using this compression type is the fact that
not only will your bandwidth be decreased, but your pages will load
faster.
enabling it in php (add the following lines to php.ini):
zlib.output_compression = On
zlib.output_compression_level = (level) (where level is 1-9. Youy may
want to try different values to see what is best for your system).
if you are using apache, you can also enable the mod_gzip module. It
is highly configurable, with the ability to modify output based on MIME
types, files, or browser settings.
6) Other things that may help
when using a database, only retrieve the data that you are actually going to use.
This may sound like a no-brainer, but I have often times worked on
projects where the original programmer used (select * from mytable)
when they could have used (select fieldIneed from mytable).
|