12月 242013
 

In our first installation in this blog, we went through a basic XCache installation with CentOS, Apache and PHP 5. Now, we’re going to look into how to make it work for your personal installation.

Much like every other tutorial out there, if you explicitly follow the instructions you find on the internet, you’re usually going to run into problems. One of the biggest problems I see in systems configurations, is getting someone that “tunes” the machine by copying and pasting configs straight from a forum or blog. Sure, it works, but that doesn’t mean it works *good*. It could also cause many more problems that it solves.

The best way to tune a machine will always be understanding what you’re doing. And that’s what we’re going to try to do here today with XCache. Continue reading »

9月 062011
 

本文主要讲述web优化方案和缓存工具的调研及使用。根据目前的测试结果来看,采用varnish+xcache作为 apache和php缓存这种架构具有高并发、高稳定性,易扩展等优点,服务器的动态请求处理能力是之前的7倍之多。通过分析发现,目前对服务器的负载主要是在cpu使用方面,随着流量的增加瓶颈也将出现在cpu方面,而内存和IO方面都不是问题。

针对这样的情况,我们就要研究怎么去降低cpu的负载,消除或降低系统的瓶颈。

业务特点分析
U 服务采用的是LAMP(Linux Apache mysql php)架构,而服务本身的逻辑比较简单,就是根据不同的url返回特定的页面内容,而这些页面内容基本是不会变的。整个过程是由php动态完成的,不需要和其他服务器交互。在一个请求的响应过程中,系统cpu的消耗基本都在php处理上面。我们要做的就是尽量减少php的动态处理。 Continue reading »

6月 212011
 

一、配置

1、分层:Xcache将缓存对象分为两类:php代码和php变量,前者在xcache.ini中只是单纯的xcache前缀,后者则用xcache_var前缀,两个对象可以独立调整。

2、配置说明:

xcache.admin.user string
//”验证名.”
xcache.admin.pass string
//”md5 后的验证密码, 亦即 md5(您的密码), 留空则禁用管理页面.”
xcache.test string
//”仅在测试一些功能的时候才启用. 如果您不知道这个功能的作用, 则您不需要知道.” Continue reading »

4月 192011
 

一、PHP加速器介绍

        PHP加速器是一个为了提高PHP执行效率,从而缓存起PHP的操作码,这样PHP后面执行就不用解析转换了,可以直接调用PHP操作码,这样速度上就提高了不少。

        Apache中使用mod_php的请求、响应执行流程:

  1、Apache接收请求。
2、Apache传递请求给mod_php。
3、mod_php定位磁盘文件,并加载到内存中。
4、mod_php编译源代码成为opcode树。
5、mod_php执行opcode树。

       PHP加速器相应的就是第四步,它的目的就是防止PHP每次请求都重复编译PHP代码,因为在高访问量的网站上,大量的编译往往没有执行速度快呢?所以这里面有个瓶颈就是PHP的重复编译既影响了速度又加载了服务器负载,为了解决此问题,PHP加速器就这样诞生了。

二、PHP加速器安装与配置

4月 192011
 

随着PHP流行,PHP的执行效率也越来越被大家关注,可以选择的缓存器也是越来越多,从老的php-memcache到eaccelerator还有新兴的xcache.为了挑选一个合适的缓存器决定自己实测一下,看看哪个缓存器的效率更高,由于php-memcache很少有人用了现在只测试eaccelerator和xcache.

硬件配置:
CPU:Intel 2140(双核心)
内存:2G DDR667
硬盘:80G(IDE接口,2M缓存)

软件版本
系统:Mandriva 2008 free,apache-2.2.6,php-5.2.4,ZendOptimizer-3.3.0,mysql-5.0.45.
测试对象的版本:eaccelerator-0.9.5.2,xcache-1.2.1 Continue reading »

11月 142010
 

测试结论备忘
环境:ubuntu server 9.04
nginx+mysql+fastcgi

1、单独Zend Optimizer优化:
测试结果很不稳定,偏差很大,加速并不多。

2、单独eAccelerator(做为Zend扩展)优化:
测试结果稳定,偏差小,加速也明显。

3、eAccelerator和Zend Optimizer共存:
测试结果稳定,偏差小,加速明显。比单独eAccelerator优化好。

4、单独Xcache优化:
测试结果稳定,偏差小,加速不如单独eAccelerator。

5、Xcache和Zend Optimizer共存:
测试结果稳定,偏差小,加速不如单独eAccelerator。
Xcache就算关闭保护功能,速度也没提升多少。