What is Zabbix

Zabbix is the ultimate open source availability and performance monitoring solution. Zabbix offers advanced monitoring, alerting, and visualization features today which are missing in other monitoring systems, even some of the best commercial ones. Below is a short list of features available in Zabbix:

  • auto-discovery of servers and network devices
  • low-level discovery
  • distributed monitoring with centralized web administration
  • support for both polling and trapping mechanisms
  • server software for Linux, Solaris, HP-UX, AIX, FreeBSD, OpenBSD, OS X
  • native high performance agents (client software for Linux, Solaris, HP-UX, AIX, FreeBSD, OpenBSD, OS X, Tru64/OSF1, Windows NT4.0, Windows 2000, Windows 2003, Windows XP, Windows Vista)
  • agent-less monitoring
  • secure user authentication
  • flexible user permissions
  • web-based interface
  • flexible e-mail notification of predefined events
  • high-level (business) view of monitored resources
  • audit log
Why Choose Zabbix

There are many reasons to choose Zabbix monitoring solution over its competitors. The best way to make sure it is the #1 choice for your organization is to give it a try. But if you have limited time, look at some of the arguments below:

  • an open source solution provides freedom with no "lock in" and security through the availability of source code. This includes not only Zabbix itself, but also components required (Linux, Apache, MySQL/PostgreSQL, PHP)
  • very easy setup and simple configuration process ensures low learning curve and therefore low cost of ownership
  • highly efficient agents for UNIX and Windows (x32, x64,Itanium) based platforms provide wider monitoring capabilities with greater speed
  • centralized monitoring system allows to store all information (configuration and performance data) in relational database for further easier processing and re-use of data
  • built-in rich visualization capabilities allow to work with your data faster and smarter
  • built-in housekeeping procedures allow to keep your data organized well

Learn more about Zabbix on Features page.

jQuery MiniUI - 快速开发WebUI

[不指定 2012/11/30 10:58 | by ipaddr ]
jQuery MiniUI - 快速开发WebUI。


它能缩短开发时间,减少代码量,使开发者更专注于业务和服务端,轻松实现界面开发,带来绝佳的用户体验。
使用MiniUI,开发者可以快速创建Ajax无刷新、B/S快速录入数据、CRUD、Master-Detail、菜单工具栏、弹出面板、布局导航、数据验证、分页表格、树、树形表格等典型WEB应用系统界面。
产品定位:

快速开发WEB界面
使用效果:

缩短开发时间,减少代码量,提升用户体验
技术亮点:

快速开发:使用Html配置界面,减少80%界面代码量。
易学易用:简单的API设计,可以独立、组合使用控件。
性能优化:内置数据懒加载、低内存开销、快速界面布局等机制。
丰富控件:包含表格、树、数据验证、布局导航等超过50个控件。
超强表格:提供锁定列、多表头、分页排序、行过滤、数据汇总、单元格编辑、详细行、Excel导出等功能。
第三方兼容:与ExtJS、jQuery、YUI、Dojo等任意第三方控件无缝集成。
浏览器兼容:支持IE6+、FireFox、Chrome等。
跨平台支持:支持Java、.NET、PHP等。
支持服务:

5*8与7*24的电话支持服务、电子邮件服务、即时通讯服务、产品培训、现场疑难解答、按人月的项目现场开发服务、新功能定制研发服务、源代码讲解研发服务等。

和墨DBA:mysql安全删除大表

[不指定 2012/11/14 10:42 | by ipaddr ]

来源: http://www.mysqlsky.com/201211/large-tbl-drop

【问题隐患】
由于业务需求不断变化,可能在DB中存在超大表占用空间或影响性能;对这些表的处理操作,容易造成mysql性能急剧下降,IO性能占用严重等。先前有在生产库drop table造成服务不可用;rm 大文件造成io跑满,引发应用容灾;对大表的操作越轻柔越好
 
【解决办法】
1.通过硬链接减少mysql DDL时间,加快锁释放
2.通过truncate分段删除文件,避免IO hang
 
【生产案例】
某对mysql主备,主库写入较大时发现空间不足,需要紧急清理废弃大表,但不能影响应用访问响应
$ll /u01/mysql/data/test/tmp_large.ibd
-rw-r—– 1 mysql dba 289591525376 Mar 30  2012 tmp_large.ibd
270GB的大表删除变更过程如下:
#(备库先做灰度)
ln tmp_large.ibd /u01/bak/tmp_tbl.ibd  #建立硬链接
-rw-r—– 2 mysql dba 289591525376 Mar 30  2012 tmp_large.ibd
set session sql_log_bin=0;  #不计入bin log节省性能,并且防止主备不一致
desc test.tmp_large;
drop table test.tmp_large;
Query OK, 0 rows affected (10.46 sec)
mysql -uroot -e "start slave;"
 
cd /u01/bak;screen -S weixi_drop_table
for i in `seq 270 -1 1 ` ;do sleep 2;truncate -s ${i}G tmp_tbl.ibd;done
rm -rf tmp_tbl.ibd
 
【性能比较】
中间ctrl-C一次,可以看到truncate前后io的对比情况,基本上影响不大
 
文件大小也成功更新
 
 
【工具介绍】
truncate – shrink or extend the size of a file to the specified size
#来自coreutils工具集
wget http://ftp.gnu.org/gnu/coreutils/coreutils-8.9.tar.gz
tar -zxvf coreutils-8.9.tar.gz
cd coreutils-8.9
./configure
make
sudo cp src/truncate /usr/bin/ 

使用Nginx做为web服务器时,如果 /abc/是某个目录,访问http://domain.com/abc时,不会添加斜杠,使得此页面一些相对路径的引用会有些问题.

可通过rewrite来自动追加斜杠:

#By 鱼漂(admin.net#163.com)
if ( -d $request_filename) {
 rewrite ^(.*[^/])$ $1/ permanent;
}

注意:Nginx的root目录在本地,另外,如果前端还有Nginx的话,需要注意端口是否一致.
http://ubuntuguide.net/install-ubuntu-910karmic-from-windows-xp-dual-boot-system

If you are operating on Windows now,you can try following steps to install ubuntu 9.10.
1.Download ubuntu karmic iso image from www.ubuntu.com
Download the latest grub4dos from here
2.Extract grldr and meun.lst from grub4dos package to root directory of C:. Copy and paste the iso image into root directory of C:\
3.Extract initrd.lz and vmlinuz from ubuntu9-10.iso/casper/ to root directory of C:(C:\initrd.lz,C:\vmlinuz).
4.Edit menu.lst by notebook,copy and paste following into the file.

timeout 5 default 0 title Ubuntu 9.10 install root (hd0,0) kernel /vmlinuz boot=casper iso-scan/filename=/ubuntu-9.10-desktop-amd64.iso ro quiet splash initrd /initrd.lz

change ubuntu-9.10-desktop-amd64.iso to the iso filename you downloaded.
5.Edit C:\boot.ini,add this line to the end:

c:\grldr="Ubuntu 9.10"

6.Restart,select boot from Ubuntu 9.10.You will get into ubuntu just like boot up with live-CD

鱼漂注:
1. Ubuntu12也可以采用类似方式从硬盘安装
2. 如果已安装一键Ghost,系统中已安装了Grub4Dos,可以直接修改C:\dosh\ghos的menu.lst
3. 如果安装过程中出现无法卸载/isodevice目录时,可以用Ctrl+Alt+F1切到命令行,umount -l /isodevice卸载后,再用Alt + F7回到图形界面继续安装。

Ubuntu Unity 创建桌面快捷方式

[不指定 2012/07/28 12:45 | by ipaddr ]

Unity的发展越来越好了,个人感觉从Ubuntu12.04开始,Unity终于可以说是可以用了。接下来就讲讲在Unity中创建快捷方式并添加到Launch Panel。

  拿eclipse举例,从eclipse.org下载好eclipse后,解压到/usr/local/eclipse中,执行以下命令创建一个App快捷方式:

sudo gedit /usr/share/applications/eclipse.desktop

在gedit中输入以下代码:

[Desktop Entry]
Name=Eclipse Platform
Comment=Eclipse IDE
Exec=/usr/local/eclipse/eclipse
Icon=/usr/local/eclipse/icon.xpm
Terminal=false
StartupNotify=true
Type=Application
Categories=Development;

这时进入到/usr/bin/eclipse中,双击eclipse相应图标,如果想在Lancher现实,则在Launch Panel右击程序对应程序点选Lock to Launcher。

鱼漂:客观的讲,这用户体验做得真是相当相当糟糕,创建个快捷方式还得手动编辑配置,一般人不google一下还真找不到方法。

http://www.liberiangeek.net/2012/04/install-adobe-flash-reader-air-in-ubuntu-12-04-precise-pangolin/

This brief tutorial is going to show you how to install Adobe Flash Player, Acrobat Reader and Adobe Air in Ubuntu 12.04 (Precise Pangolin). Having these three programs installed in Ubuntu makes your experience with Ubuntu better. You can watch flash videos, interact with rich applications online and open PDF documents easily. This tutorial is going to be short and easy, and without wasting anymore of your time let’s get going.

Objectives:

  • Install Adobe Flash / Reader / and Air in Ubuntu 12.04
  • Enjoy!

To get started, press Ctrl – Alt – T on your keyboard to open Terminal. When Terminal opens, run the commands below to enable Canonical Partner Repository.

sudo apt-add-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"

 

adobe_flash_acrobat_precise

 

Next, run the commands below to update your system and install Adobe Flash Player and Adobe Reader.

sudo apt-get update && sudo apt-get install flashplugin-installer acroread

 

adobe_flash_acrobat_precise_1

 

Next, run the commands below to download Adobe Air executable.

wget http://airdownload.adobe.com/air/lin/download/latest/AdobeAIRInstaller.bin

 

adobe_flash_acrobat_precise_2

 

Then run the commands below to change the permission on the file so that it’s executable.

sudo chmod +x AdobeAIRInstaller.bin

 

adobe_flash_acrobat_precise_3

 

Next, run the commands below to install Adobe Air.

sudo ./AdobeAIRInstaller.bin

 

adobe_flash_acrobat_precise_4

 

If everything works, all should be installed. If you run into problems with adobe Air about missing gnome-keyring or KDE Wallet, run the commands below to fix it, then re-run the air installer.

 

sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0
sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0

 

For 64-bit systems, run copy and past the commands below

sudo ln -s /usr/lib/x86_64-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0
sudo ln -s /usr/lib/x86_64-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0

 

Enjoy!

Ubuntu 12.04 – install sun jdk 6-7

[不指定 2012/07/28 10:31 | by ipaddr ]

Ubuntu GNU/Linux 12.04 LTS (Precise Pangolin) released. I wanted to manually install the Sun JDK 6 and 7 on Ubuntu.

Installing Sun JDK 6 on Ubuntu 12.04:

  • Make the bin file executeable:
chmod +x jdk-6u32-linux-x64.bin
  • Extract the bin file:
./jdk-6u32-linux-x64.bin
  • Move extracted folder to this location:
sudo mv jdk1.6.0_32 /usr/lib/jvm/
  • Install new java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_32/bin/javac 1 sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_32/bin/java 1 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_32/bin/javaws 1
  • Choose default java:
sudo update-alternatives --config javac sudo update-alternatives --config java sudo update-alternatives --config javaws
  • java version test:
java -version
  • Verify the symlinks all point to the new java location:
ls -la /etc/alternatives/java*
  • Enable Java plugin for Mozilla Firefox (even for Chrome)
#for 64-Bit jdk sudo ln -s /usr/lib/jvm/jdk1.6.0_32/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins #for 32-Bit jdk sudo ln -s /usr/lib/jvm/jdk1.6.0_32/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins

Installing Sun JDK 7 on Ubuntu 12.04:

  • Download the sun jdk 7 tar file from here
  • Extract the tar file:
tar -xvzf jdk-7u4-linux-x64.tar.gz
  • Move extracted folder to this location:
sudo mv jdk1.7.0_04 /usr/lib/jvm/
  • Install new java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_04/bin/javac 1 sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_04/bin/java 1 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_04/bin/javaws 1
  • Choose default java:
sudo update-alternatives --config javac sudo update-alternatives --config java sudo update-alternatives --config javaws
  • java version test:
java -version
  • Verify the symlinks all point to the new java location:
ls -la /etc/alternatives/java*
  • Enable Java plugin for Mozilla Firefox (even for Chrome)
#for 64-Bit jdk sudo ln -s /usr/lib/jvm/jdk1.7.0_04/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins #for 32-Bit jdk sudo ln -s /usr/lib/jvm/jdk1.7.0_04/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins

Update: I have added Java Web Start configuration (Thanks Jack).

Update: I have added Java Plugin configuration for Mozilla Firefox even for Chrome (Thanks shetty).

Update: JAVA_HOME configuration: Some tools require JAVA_HOME variable. You can set JAVA_HOME in Ubuntu so simple: Edit the file .bashrc under your home directory and add the following lines: (if .bashrc is hidden click in Nautilus Menu View > Show Hidden Files)

export JAVA_HOME=/path/your/jdk export PATH=$JAVA_HOME/bin:$PATH

CMAKE的使用

[不指定 2012/07/21 13:04 | by ipaddr ]

一、基本使用
安装:下载二进制包后可直接解压使用

从源码安装则执行命令:./bootstrap; make; make install——尝试执行bootstrap失败

使用:cmake dir_path,生成工程文件或makefile文件

二、概念
out-of-source build,与in-source build相对,即将编译输出文件与源文件放到不同目录中;

三、基本结构
1,依赖CMakeLists.txt文件,项目主目标一个,主目录中可指定包含的子目录;

2,在项目CMakeLists.txt中使用project指定项目名称,add_subdirectory添加子目录

3,子目录CMakeLists.txt将从父目录CMakeLists.txt继承设置(TBD,待检验)

四、语法
1.  #注释

2.  变量:使用set命令显式定义及赋值,在非if语句中,使用${}引用,if中直接使用变量名引用;后续的set命令会清理变量原来的值;

3.  command (args ...)  #命令不分大小写,参数使用空格分隔,使用双引号引起参数中空格

4.  set(var a;b;c) <=> set(var a b c)  #定义变量var并赋值为a;b;c这样一个string list

5.  Add_executable(${var}) <=> Add_executable(a b c)   #变量使用${xxx}引用

6.  条件语句:

if(var) #var 非empty 0 N No OFF FALSE... #非运算使用NOT
       …
else()/elseif() … endif(var)

7.  循环语句

Set(VAR a b c)
Foreach(f ${VAR})       …Endforeach(f)

8.  循环语句

WHILE() … ENDWHILE()

五、内部变量
CMAKE_C_COMPILER:指定C编译器

CMAKE_CXX_COMPILER:

CMAKE_C_FLAGS:编译C文件时的选项,如-g;也可以通过add_definitions添加编译选项

EXECUTABLE_OUTPUT_PATH:可执行文件的存放路径

LIBRARY_OUTPUT_PATH:库文件路径

CMAKE_BUILD_TYPE::build 类型(Debug, Release, ...),CMAKE_BUILD_TYPE=Debug

BUILD_SHARED_LIBS:Switch between shared and static libraries

内置变量的使用:

>> 在CMakeLists.txt中指定,使用set

>> cmake命令中使用,如cmake -DBUILD_SHARED_LIBS=OFF

六、命令
project (HELLO)   #指定项目名称,生成的VC项目的名称;

>>使用${HELLO_SOURCE_DIR}表示项目根目录

include_directories:指定头文件的搜索路径,相当于指定gcc的-I参数

>> include_directories (${HELLO_SOURCE_DIR}/Hello)  #增加Hello为include目录

link_directories:动态链接库或静态链接库的搜索路径,相当于gcc的-L参数

>> link_directories (${HELLO_BINARY_DIR}/Hello)     #增加Hello为link目录

add_subdirectory:包含子目录

>> add_subdirectory (Hello)

add_executable:编译可执行程序,指定编译,好像也可以添加.o文件

>> add_executable (helloDemo demo.cxx demo_b.cxx)   #将cxx编译成可执行文件——

add_definitions:添加编译参数

>> add_definitions(-DDEBUG)将在gcc命令行添加DEBUG宏定义;

>> add_definitions( “-Wall -ansi –pedantic –g”)

target_link_libraries:添加链接库,相同于指定-l参数

>> target_link_libraries(demo Hello) #将可执行文件与Hello连接成最终文件demo

add_library:

>> add_library(Hello hello.cxx)  #将hello.cxx编译成静态库如libHello.a

add_custom_target:

message( status|fatal_error, “message”):

set_target_properties( ... ): lots of properties... OUTPUT_NAME, VERSION, ....

link_libraries( lib1 lib2 ...): All targets link with the same set of libs

七、说明
1,CMAKE生成的makefile能够处理好.h文件更改时只编译需要的cpp文件;

八、FAQ
1)怎样获得一个目录下的所有源文件
>> aux_source_directory(<dir> <variable>)

>> 将dir中所有源文件(不包括头文件)保存到变量variable中,然后可以add_executable (ss7gw ${variable})这样使用。

2)怎样指定项目编译目标
>>  project命令指定

3)怎样添加动态库和静态库
>> target_link_libraries命令添加即可

4)怎样在执行CMAKE时打印消息
>> message([SEND_ERROR | STATUS | FATAL_ERROR] "message to display" ...)

>> 注意大小写

5)怎样指定头文件与库文件路径
>> include_directories与link_directories

>>可以多次调用以设置多个路径

>> link_directories仅对其后面的targets起作用

6)怎样区分debug、release版本
>>建立debug/release两目录,分别在其中执行cmake -DCMAKE_BUILD_TYPE=Debug(或Release),需要编译不同版本时进入不同目录执行make即可;

Debug版会使用参数-g;Release版使用-O3 –DNDEBUG

>> 另一种设置方法——例如DEBUG版设置编译参数DDEBUG

IF(DEBUG_mode)

    add_definitions(-DDEBUG)

ENDIF()

在执行cmake时增加参数即可,例如cmake -D DEBUG_mode=ON

7)怎样设置条件编译
例如debug版设置编译选项DEBUG,并且更改不应改变CMakelist.txt

>> 使用option command,eg:

option(DEBUG_mode "ON for debug or OFF for release" ON)

IF(DEBUG_mode)

    add_definitions(-DDEBUG)

ENDIF()

>> 使其生效的方法:首先cmake生成makefile,然后make edit_cache编辑编译选项;Linux下会打开一个文本框,可以更改,该完后再make生成目标文件——emacs不支持make edit_cache;

>> 局限:这种方法不能直接设置生成的makefile,而是必须使用命令在make前设置参数;对于debug、release版本,相当于需要两个目录,分别先cmake一次,然后分别make edit_cache一次;

>> 期望的效果:在执行cmake时直接通过参数指定一个开关项,生成相应的makefile——可以这样做,例如cmake –DDEBUGVERSION=ON

8)怎样添加编译宏定义
>> 使用add_definitions命令,见命令部分说明

9)怎样添加编译依赖项
用于确保编译目标项目前依赖项必须先构建好

>>add_dependencies

10)怎样指定目标文件目录
>> 建立一个新的目录,在该目录中执行cmake生成Makefile文件,这样编译结果会保存在该目录——类似

>> SET_TARGET_PROPERTIES(ss7gw PROPERTIES

                      RUNTIME_OUTPUT_DIRECTORY "${BIN_DIR}")

11)很多文件夹,难道需要把每个文件夹编译成一个库文件?
>> 可以不在子目录中使用CMakeList.txt,直接在上层目录中指定子目录

12)怎样设定依赖的cmake版本
>>cmake_minimum_required(VERSION 2.6)

13)相对路径怎么指定
>> ${projectname_SOURCE_DIR}表示根源文件目录,${ projectname _BINARY_DIR}表示根二进制文件目录?

14)怎样设置编译中间文件的目录
>> TBD

15)怎样在IF语句中使用字串或数字比较
>>数字比较LESS、GREATER、EQUAL,字串比STRLESS、STRGREATER、STREQUAL,

>> Eg:

set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

set(AAA abc)

IF(AAA STREQUAL abc)

    message(STATUS "true")   #应该打印true

ENDIF()

16)更改h文件时是否只编译必须的cpp文件
>> 是

17)机器上安装了VC7和VC8,CMAKE会自动搜索编译器,但是怎样指定某个版本?
>> TBD

18)怎样根据OS指定编译选项
>> IF( APPLE ); IF( UNIX ); IF( WIN32 )

19)能否自动执行某些编译前、后命令?
>> 可以,TBD

20)怎样打印make的输出
make VERBOSE=1

参考文献:
[1] CMake_Tutorial.pdf
[2] CMake使用总结,http://blog.csdn.net/keensword007/archive/2008/07/16/2663235.aspx
[3] http://www.cmake.org/
[4] 安装包中文档
[5] Andrej Cedilnik,HOWTO: Cross-Platform Software Development Using CMake,October, 2003
[6] Cjacker,CMake实践.PDF

Roundup on Parallel Connections

[不指定 2012/06/28 09:21 | by ipaddr ]

A lot of blogging and follow-up discussion ensued with the announcement that IE8 supports six connections per host. The blogs I saw:

It’s likely that Firefox 3 will support 6 connections per server in an upcoming beta release, which means more discussion is expected. I wanted to pull all the facts into one place and make several points that I think are important and interesting. Specifically I talk about:

  • the HTTP/1.1 RFC
  • settings for current browsers
  • upperbound of open connections (cool!)
  • effect of proxies
  • will this break the Internet?


The HTTP/1.1 RFC

Section 8.1.4 of the HTTP/1.1 RFC says a “single-user client SHOULD NOT maintain more than 2 connections with any server or proxy.” The key here is the word “should.” Web clients don’t have to follow this guideline. IE8 isn’t the first to exceed this guideline. Opera and Safari hold that honor supporting 4 connections per server.

It’s important to understand that this is on a per server basis. Using multiple domain names, such as 1.mydomain.com, 2.mydomain.com, 3.mydomain.com, etc., allows a web developer to achieve a multiple of the per server connection limit. This works even if all the domain names are CNAMEs to the same IP address.

Settings for Current Browsers

The table below shows the number of connections per server supported by current browsers for HTTP/1.1 as well as HTTP/1.0.

BrowserHTTP/1.1HTTP/1.0
IE 6,724
IE 866
Firefox 228
Firefox 366
Safari 3,444
Chrome 1,26?
Chrome 344
Chrome 4+6?
iPhone 24?
iPhone 36?
iPhone 44?
Opera 9.63,10.00alpha44
Opera 10.51+8?

I provide (some of) the settings for HTTP/1.0 in the table above because some of the blog discussions have confused the connections per server settings for HTTP/1.0 with those for HTTP/1.1. HTTP/1.0 does not have persistant connections so a higher number of connections per server is supported to achieve faster performance. For example, IE7 supports 4 connections per server in HTTP/1.0. In fact, AOL intentionally downgrades their responses to HTTP/1.0 to benefit from this increase in parallelization, although they do it at the cost of losing the benefits of persistent connections. They must have data that supports this decision, but I don’t recommend it.

It’s possible to reconfigure your browser to use different limits. How to configure Internet Explorer to have more than two download sessions describes how the MaxConnectionsPerServer and MaxConnectionsPer1_0Server settings in the Windows Registry control the number of connections per hostname for HTTP/1.1 and HTTP/1.0, respectively. In Firefox these values are controlled by the network.http.max-persistent-connections-per-server and network.http.max-connections-per-server settings in about:config.

Note that IE8 automatically drops back to 2 connections per server for users on dialup connections. Also, web developers can detect the number of connections per server currently in effect by accessing window.maxConnectionsPerServer and window.maxConnectionsPer1_0Server in JavaScript. These are read-only values.

Upperbound of Open Connections

What’s the maximum number of connections a browser will open?
This is relevant as server adminstrators prepare for spikes from browsers with increased parallelization.

This Max Connections test page contains 180 images split across 30 hostnames. That works out to 6 images per hostname. To determine the upperbound of open connections a browser supports I loaded this page and counted the number of simultaneous requests in a packet sniffer. Firefox 1.5 and 2.0 open a maximum of 24 connections (2 connections per hostname across 12 hostnames). This limit is imposed by Firefox’s network.http.max-connections setting which defaults to a value of 24.

In IE 6,7&8 I wasn’t able to determine the upperbound. At 2 connections per server, IE 6&7 opened 60 connections in parallel. At 6 connections per server, IE8 opened 180 connections in parallel. I’d have to create more domain names than the 30 I already have to try and find where IE maxes out. (If you load this in other browsers please post your results in a comment below and I’ll update this text.)

Effect of Proxies

Note that if you’re behind a proxy (at work, etc.) your download characteristics change. If web clients behind a proxy issued too many simulataneous requests an intelligent web server might interpret that as a DoS attack and block that IP address. Browser developers are aware of this issue and throttle back the number of open connections.

In Firefox the network.http.max-persistent-connections-per-proxy setting has a default value of 4. If you try the Max Connections test page while behind a proxy it loads painfully slowly opening no more than 4 connections at a time to download 180 images. IE8 drops back to 2 connections per server when it’s behind a proxy, so loading the Max Connections test page shows an upperbound of 60 open connections. Keep this in mind if you’re comparing notes with others – if you’re at home and they’re at work you might be seeing different behavior because of a proxy in the middle.

Will This Break the Internet?

Much of the debate in the blog comments has been about how IE8′s increase in the number of connections per server might bring those web servers to their knees. I found the most insightful comments in Mozilla’s Bugzilla discussion about increasing Firefox’s number of connections. In comment #22 Boris Zbarsky lays out a good argument for why this increase will have no effect on most servers. But in comment #23 Mike Hommey points out that persistent connections are kept open for longer than the life of the page request. This last point scares me. As someone who has spent many hours configuring Apache to find the right number of child processes across banks of servers, I’m not sure what impact this will have.

Having said that, I’m please that IE8 has taken this step and I’d be even happier if Firefox followed suit. This change in the client will improve page load times from the user’s perspective. It does put the onus on backend developers to watch closely as IE8 adoption grows to see if it affects their capacity planning. But I’ve always believed that part of the responsibility and joy of being a developer is doing extra work on my side that can improve the experience for thousands or millions of users. This is another opportunity to do just that.

分页: 5/57 第一页 上页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]