Step-1 Adding Yum Repository
Add the Reporforge repository. Then-
Yum install php-rrdtool
Alternatively, you can download the rpm from
http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/php-rrdtool-1.4.4-1.el5.rf.i386.rpm Continue reading “PHP-RRDTool installation on CentOS 5” »
xhprof provides profiling information, down to the function call. This includes execution time, CPU and memory usage for each operation. The module allows you to find and optimise bottlenecks in your application. The library includes a GUI output, you just use the classes provided to create the reports.
I installed using PECL on a Debian Squeeze development server, and the first things you need are php5-dev and make; Continue reading “Installing XHProf on Debian” »
This weekend I decided to play around with the configuration on my Rackspace Cloud Server. Since our various websites have been doing well lately, the relatively low-powered machine I am running on is starting to fill up its available RAM. So far so good but as everyone quickly learns – running out of memory and hitting the swap space is a performance killer. Since I want my sites to continue to do well, I decided to take action before they hit the RAM limit and start swapping to disk.
This is the old architecture I had deployed. Apache – the Internet’s workhorse – to perform all of the PHP processing, with Nginx as a reverse proxy, passing dynamic (PHP) requests to Apache but serving static files directly to give Apache a break and cut down its footprint. Continue reading “Using FastCGI with Nginx for Performance on a VM” »
Even though compilation is very fast, it still has a resource and time cost, especially on high-traffic servers. We can improve our response times by more than 5x by pre-caching our compiled opcode for direct execution later. There are a few PHP accelerators which accomplish this for us:
Xcache is my favourite and is the one I use in my own configurations. It works by caching the compiled PHP opcode in memory so PHP can be directly executed by the web server without expensive disk reads and processing time. Many caching schemes also use Xcache to store the results of PHP rendering so individual pages don’t need to be re-processed.
APC (Alternative PHP Cache)
APC is a very similar product to XCache – in fact XCache was released partially as a response to the perceived lag APC’s support for newer PHP versions. APC is essentially the standard PHP Accelerator – in fact, it will be included by default in PHP 6. As much as I like XCache, it will be hard to compete with built-in caching. Continue reading “PHP accelerator” »
By default PHP loads and saves sessions to disk. Disk storage has a few problems:
1. Slow IO: Reading from disk is one of the most expensive operations an application can perform, aside from reading across a network.
2. Scale: If we add a second server, neither machine will be aware of sessions on the other.
I hinted at Memcached before as a content cache that can improve application performance by preventing trips to the database. Memcached is also perfect for storing session data, and has been supported in PHP for quite some time.
Why use memcached rather than file-based sessions? Memcache stores all of its data using key-value pairs in RAM – it does not ever hit the hard drive, which makes it F-A-S-T. In multi-server setups, PHP can grab a persistent connection to the memcache server and share all sessions between multiple nodes.
Before beginning, you’ll need to have the Memcached server running. I won’t get into the details for building and installing the program as it is different in each environment. On Ubuntu it’s as easy as aptitude install memcached. Most package managers have a memcached installation available. Continue reading “Install Memcache” »
tep # 1: Enable EPEL repo
ngnix is not included in the base system. Turn on EPEL repo to install nginx stable release:
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/$(uname -m)/epel-release-5-3.noarch.rpm
Step # 2: Install ngnix
Type the following command at a shell prompt:
# yum install nginx
Loaded plugins: downloadonly, fastestmirror, priorities, protectbase
Loading mirror speeds from cached hostfile
* epel: archive.linux.duke.edu
* base: ftp.linux.ncsu.edu
* updates: centos.mirror.nac.net
* addons: mirror.cs.vt.edu
* extras: centos.mirror.nac.net
0 packages excluded due to repository protections
Setting up Install Process
Parsing package install arguments
--> Running transaction check
---> Package nginx.x86_64 0:0.6.34-1.el5 set to be updated
--> Finished Dependency Resolution
Package Arch Version Repository Size
nginx x86_64 0.6.34-1.el5 epel 319 k
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total size: 319 k
Is this ok [y/N]: y
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Installing : nginx [1/1]
Installed: nginx.x86_64 0:0.6.34-1.el5
Continue reading “Redhat/CentOS install PHP on NginX server as fastcgi” »