Archive

Posts Tagged ‘ubuntu’

Google Apache modpagespeed 测试

November 9th, 2010 西坪 No comments

昨日尝新测试Google Pagespeed Mod。今天重新测试了一下,服务器为OpenVZ vps/amd64bit/512M。Web服务器为 Apache 2.2.11。机器的性能是比较差的,所有数据仅供参考。

从客户端看速度有不错提升

未启用之前在Google Chrome中打开 本页,页面各部分内容的大小如下图:

a2b

请求速度如下图:

a1b

开启mod_pagespeed以后,页面各部分内容的大小如下图:
a2

css减少约1K,js减少1.5K,图片没有太大变化。总体减少约2K。

请求速度如下图:

a1

页面加载时间变化明显,document加载减少了480ms,css减少了6ms(提升比为25%),图片减少了24ms(提升比为18%),js脚本减少了6ms(提升比为25%),整体加载时间减少了460ms(提升比为21%)。

从服务端看

用ab在本机测试服务器的性能,可能是因为机器资源有限,ab本身要消耗一些资源,而本机测试时传输阶段的性能提升可以不计,故整体提升作用不明显。另外,ab不会去获取外部连接的文件也会错过mod_pagespeed在css/js/jpg方面的许多优化工作。尽管如此,处理速度还是有一些提升。开启前,50%的请求需要609ms,开启后降到599ms;66%的请求需要641ms,开启后降到621ms。所有请求的处理时间的中位数从609ms降到599ms。

启用前数据如下:

blog@feihoo:~$ ab -n 1000 -c 3 blog.feihoo.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
 
Document Path:          /
Document Length:        114025 bytes
 
Concurrency Level:      3
Time taken for tests:   209.315 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      114394000 bytes
HTML transferred:       114025000 bytes
Requests per second:    4.78 [#/sec] (mean)
Time per request:       627.946 [ms] (mean)
Time per request:       209.315 [ms] (mean, across all concurrent requests)
Transfer rate:          533.71 [Kbytes/sec] received
 
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   484  628 108.2    609    1763
Waiting:      224  288  57.5    284    1035
Total:        485  628 108.2    609    1763
 
Percentage of the requests served within a certain time (ms)
  50%    609
  66%    641
  75%    657
  80%    670
  90%    735
  95%    825
  98%    895
  99%    988
 100%   1763 (longest request)

启用后测试结果如下:

blog@feihoo:~$ ab -n 1000 -c 3 blog.feihoo.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
 
Server Software:        Apache/2.2.11
Document Path:          /
Document Length:        114356 bytes
 
Concurrency Level:      3
Time taken for tests:   209.686 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      114755000 bytes
HTML transferred:       114356000 bytes
Requests per second:    4.77 [#/sec] (mean)
Time per request:       629.057 [ms] (mean)
Time per request:       209.686 [ms] (mean, across all concurrent requests)
Transfer rate:          534.44 [Kbytes/sec] received
 
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.2      0       6
Processing:   511  628 216.0    599    3660
Waiting:      233  294 157.4    277    2984
Total:        511  628 216.0    599    3660
 
Percentage of the requests served within a certain time (ms)
  50%    599
  66%    621
  75%    635
  80%    643
  90%    664
  95%    694
  98%   1075
  99%   1641
 100%   3660 (longest request)
Categories: server & system Tags: ,

My Ubuntu Installation log

December 18th, 2009 西坪 No comments

业余使用Ubuntu好些年了,装了删删了装的,为了以后方便,把这次的新版本的安装配置过程都记录下来。

第一步,从官方下载 Ubuntu-desktop。

第二步,在VMWare上安装,并安装VMWare-tools。 在ubuntu-desktop-9.10上,不像以前需要手工安装一些包,安装linux头文件,这次一路回车就搞定了。

到这里系统就算安装完毕,发现已经用去了8G硬盘的 37%。

(update 2009-12-28): 事后发现根本没有装好,再次尝试安装,基本上各个模块编译时都会出现error日志,并报告模块没有成功编译。而原来在 ubuntu 8.10下是工作正常的。 为什么升级到 ubuntu 9.10就出错了呢?一开始在网络上搜索,看过 VMware workstation fails after 9.0.4 upgrade to 9.10, 根据该帖建议去打补丁, 但是都没有解决。

后来,去Vmware官方找了下是否有更新,结果发现 VMware Workstationfor Windows 出了新的6.5.3版本, 在 Release Notes 中发现 Ubuntu 9.04 is fully supported. 猜测也许是需要新版本。 尝试下载新版本安装后,重新安装和配置 vmware-tools, 一切顺利!

第三步,安装我需要的各种软件。

0. 设置source.list,我使用 mirrors.163.com.
设置网卡:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.126
netmask 255.255.255.0
gateway 192.168.1.1

#auto eth0
#iface eth0 inet dhcp

1. 安装 vim/ctags/cscope, 设置颜色,缩进等。 The details are noted at Here.

  • install: sudo apt-get install vim
  • Install Chinese vim help: download from http://vimcdoc.sourceforge.net/, tar and enter the directory, execute
  • sudo ./vimcdoc.sh -i
  • sudo apt-get install exuberant-ctags cscope

2. 安装 JDK/C++工具:

sudo apt-get install sun-java6-jdk sun-java6-source
sudo apt-get install build-essential

3. 安装manuals:

开发用的手册页:

sudo apt-get install manpages-dev

安装 Posix 相关的手册页。pthread 库相关的手册页就在这里面,而不在 Dev manual pages 中。

sudo apt-get install manpages-posix manpages-posix-dev

安装 STL library man pages:

sudo apt-get install libstdc++6-4.2-doc

4. 安装版本工具 Subversion 和 Git:

sudo apt-get install subversion subversion-tools git-doc git-core

5. Configure SSH server:

sudo apt-get install openssh-server

.
6. Install LAMP server by tasksel, and configure;
7. 中文支持。我安装系统时用的是英文,因此 LANG=’en_US.UTF-8′。中文输入遵循下面三步骤即可:

  1. Install Simple Chinese Language support.
  2. install: sudo apt-get install scim scim-pinyin
  3. System->Administration->Language Support->Input Method, select scim.
    1. Reboot system, 此时就可以使用智能拼音了。

Resource: SCIM Setup, SCIM Usage

中文问题的解决没有这么简单,还存在下面的问题:

  • gedit不能打开中文文件: 这个文件主要是gedit猜测编码的机制造成的,略加修改就可以。具体参考这里
  • vim不能打开中文文件:Here
  • pdf不能阅读某些中文文件: 问题的症状是能够阅读某些中文pdf,但是还有一些pdf则表现为乱码。问题的原因不太清楚,但是Google后安装了一个新包 poppler-data,就解决了。(sudo apt-get install poppler-data)

8. 安装 CHM 格式文档查看工具 kchmviewer.

sudo apt-get install kchmviewer

但是 kchmviewer 在查看 boost中文文档页时出现了编码错误。当然这不一定就是kchmviewer有问题,也可能是boost中文文档本身的兼容性等。于是另外安装了chmsee, chmsee的另外一个优点就是安装时体积很小,下载过程中才下了几百K。当然也可能是因为我提前把其他需要的库都已经装上了…
9. ruby gems:

sudo apt-get install rubygems1.9.1

10. 声音问题的解决:这里

Categories: Tools & Tips Tags:

Ubuntu 上安装buildix,PHP5, Apache2

October 12th, 2008 西坪 No comments

一开始,我在计算机上安装了buildix,发现 Buildix的各项功能也能正确运行。但是,一旦我安装并启用了 php5和mod-php5,就会导致buildix被卸载。如下:

liuzhr@suowan-master:/etc/apache2/sites-enabled$ sudo apt-get install php5 libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5 is already the newest version.
The following packages were automatically installed and are no longer required:
python-libxslt1 libapache2-svn libapache2-mod-python sun-java5-jdk python-libxml2 python-svn libapache2-mod-fastcgi cruisecontrol sun-java5-demo
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
apache2-mpm-prefork
The following packages will be REMOVED:
apache2-mpm-worker buildix
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5
0 upgraded, 2 newly installed, 2 to remove and 60 not upgraded.
Need to get 0B/2978kB of archives.
After unpacking 5747kB of additional disk space will be used.
Do you want to continue [Y/n]?

如果选择继续,安装了php5和libapache2-mod-php5,则会导致buildix卸载,如果重新安装 buildix,安装过程中会出现下面的错误,原因大概是libapache-mod-php5被buildix自动卸载了。

liuzhr@suowan-master:/etc/apache2/sites-enabled$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2
* We failed to correctly shutdown apache, so we're now killing all running apache processes. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!
apache2: Syntax error on line 183 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory。

原因应该是 buildix 依赖于  apache2-mpm-worker, 而目前的 php5只能运行单线程的apache2,这样就必须使用  apache2-mpm-prefork。
使用  apt-cache show buildix 一看,果然buildix依赖于 apache2-mpm-worker。看来必须放弃将 buildix与目前的 php5(Module方式) 在一起安装的方法。

于是只能选择使用 cgi 的方式来安装。参考这篇文章:Installing Apache2 and PHP5 using mod_fcgid 。配置的过程中发生了一些错误(you don’t have permission to access ‘/index.php’),似乎是因为下面的配置中,AllowOverride ,FCGIWrapper ,AddHandler 或者 Options +ExecCGI 的顺序导致的。没有时间仔细研究这个问题,高手看到请指教。

<directory>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
FCGIWrapper /usr/lib/cgi-bin/php5 .php
AddHandler fcgid-script .php
Options +ExecCGI
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</directory>

php5 目前不能使用 apache2-mpm-worker 模块是因为不支持多线程的apache2。 PHP如此说:Why shouldn’t I use Apache2 with a threaded MPM in a production environment? 

有关 apt-get 的命令,参考这里:https://help.ubuntu.com/community/AptGet/Howto

有关 Ubuntu上的LAMP,参考:ApacheMySQLPHP

Categories: server & system Tags: , ,