Updates from 一月, 2008 Toggle Comment Threads | 键盘快捷键

  • bixuan 18:22 on 2008 年 01 月 30 日 链接地址 | 回复  

    linux 和unix下SAR命令的用法,对机器性能检测很有帮助

    dmesg可以直接查看cpu的主频,要查看CPU、内存的使用情况可以使用sar!

    sar 命令行的常用格式:
    sar [options] [-A] [-o file] t [n]

    在命令行中,n 和t 两个参数组合起来定义采样间隔和次数,t为采样间隔,是必须有
    的参数,n为采样次数,是可选的,默认值是1,-o file表示将命令结果以二进制格式
    存放在文件中,file 在此处不是关键字,是文件名。options 为命令行选项,sar命令
    的选项很多,下面只列出常用选项: (阅读全文 …)

     
  • bixuan 17:42 on 2008 年 01 月 30 日 链接地址 | 回复  

    安装balance
    该文是2006年整理的,现在跟大家一起分享,希望大家能多提建议和意见,谢谢!

    balance是一款负载均衡软件,具体信息可以去看其官方:http://www.inlab.de/balance.html

    系统:Centos4.3 i386(在x64上也测试成功过)

    1. 下载:

    [shell]
    wget -c http://www.inlab.de/balance-3.34.tar.gz
    [/shell]

    (阅读全文 …)

     
  • bixuan 22:27 on 2008 年 01 月 28 日 链接地址 | 回复  

    [更新]-一个测试的数据,嘿嘿 

    该服务器是DELL1950,跑的是PHP的程序,看图吧,哈哈^_^
    嘿嘿
    注意看ESTABLISHED的连接:)

     
  • bixuan 13:06 on 2008 年 01 月 28 日 链接地址 | 回复  

    blitz-templates(最快的 PHP 模板引擎) 

    Blitz Templates
    Extremely fast and powerfull template engine for very big internet projects

    Downloads: sourceforge, sources homepage, win32 binaries
    Other languages: russian

    Blitz project is in a quite active development stage, new releases may appear once a week. If you want to get new release announcements – please subscribe at freashmeat or sourceforge file releases RSS. If you like this project ant want to help it – i’m always open for any constructive suggestions. We’re still looking for people who could help us with international translation (mostly German, Spanish and French). Please, contact me at if you could help.

    Document by: Alexey Rybak, Lioubov Vereschagina, Vladimir Krivosheev
    Feedback: contact developers and users through the mailing list (blitz-subscribe aT alexeyrybak d0t com) or visit the BugTraker

    This is full documentation. Blitz also has a very short geek tutorial which can save you time.

    null

    看: http://alexeyrybak.com/blitz/blitz_en.html
    http://template-bench.iliakantor.ru/

     
  • bixuan 22:59 on 2008 年 01 月 26 日 链接地址 | 回复  

    增加 NFS 守护程序的数量。
    默认地,标准的 CSM 扇出值为 16。这意味着跨集群运行的命令会一次运行 16 个节点,节点安装也是如此。Red Hat Linux 的标准 NFS 设置是 8 个可同时运行的守护程序。您可以扩展 NFS,方法是增加 NFSD 线程数到 16 以匹配默认的 CSM 扇出值。如果增加扇出值,您可能也会想增加 NFS 的线程数。一般地,扇出值为 32、NFS 线程数为 32 对于保证速度和可靠性已经足够,而且还能允许同时安装具 32 节点的单个 rack。要实现这一目的,创建配置文件 /etc/sysconfig/nfs 并添加如下行:

    [conf]
    RPCNFSDCOUNT=16
    [/conf]

     
  • bixuan 22:56 on 2008 年 01 月 26 日 链接地址 | 回复  

    增加 ARP 表大小和超时设置 

    如果一个很大的网络的同一个子网上具有很多或全部集群,ARP 表就可能会过载,就会让人觉得网络请求的响应速度太慢。为了避免上述现象,需要对运行中的系统做如下更改,并将这些更改添加到 /etc/sysctl.conf 文件,以使更改能够持久有效:

    [conf]
    net.ipv4.conf.all.arp_filter = 1
    net.ipv4.conf.all.rp_filter = 1
    net.ipv4.neigh.default.gc_thresh1 = 512
    net.ipv4.neigh.default.gc_thresh2 = 2048
    net.ipv4.neigh.default.gc_thresh3 = 4096
    net.ipv4.neigh.default.gc_stale_time = 240
    [/conf]

     
  • bixuan 12:58 on 2008 年 01 月 25 日 链接地址 | 回复  

    msn人数 

    刚才统计了一下我MSN上的人数,除去我自己的另外2个MSN帐号,共:841,FT..

     
  • bixuan 14:05 on 2008 年 01 月 17 日 链接地址 | 回复  

    Linux内核参数-与磁盘IO子系统有关的 

    /proc/sys/vm/dirty_ratio

    这个参数控制文件系统的文件系统写缓冲区的大小,单位是百分比,表示系统内存的百分比,表示当写缓冲使用到系统内存多少的时候,开始向磁盘写出数据。增大之会使用更多系统内存用于磁盘写缓冲,也可以极大提高系统的写性能。但是,当你需要持续、恒定的写入场合时,应该降低其数值,一般启动上缺省是 10。下面是增大的方法:

    echo ’40′ > /proc/sys/vm/dirty_ratio

    (阅读全文 …)

     
  • bixuan 22:09 on 2008 年 01 月 16 日 链接地址 | 回复
    Tags: ip, mask,   

    一个php写的计算网段mask的函数 

    感谢钱同事!

    [php]
    < ?php
    $ipEnd="211.138.224.0";
    $ipStart="211.138.239.255";

    $res=getRegionIPV4($ipStart,$ipEnd);

    echo $ipStart,"/",$res;

    function getRegionIPV4(&$ipStart,&$ipEnd)
    {
    $ipStartL=ip2long($ipStart);
    $ipEndL=ip2long($ipEnd);
    $diff=$ipEndL-$ipStartL;

    if($diff<0)
    {
    $diff=abs($diff);
    $tmp=$ipStart;
    $ipStart=$ipEnd;
    $ipEnd=$tmp;
    }
    $diffMask=decbin($diff);
    return 32-strlen($diffMask);
    }
    ?>
    [/php]
    [shell]
    php t.php
    211.138.224.0/20
    [/shell]

     
  • bixuan 13:52 on 2008 年 01 月 08 日 链接地址 | 回复
    Tags: htaccess   

    在线的.htaccess文件编辑器 

    对于不熟编辑.htaccess文件的朋友有福了!
    见这里:http://www.htaccesseditor.com/ 而且有中文语言哦:)

     
  • bixuan 23:59 on 2008 年 01 月 04 日 链接地址 | 回复  

    TCP 接收窗口和 TCP 吞吐量 

    为了优化 TCP 吞吐量(假设为合理的无差错传输路径),发送端应该发送足够的数据包以填满发送端和接收端之间的逻辑管道。逻辑管道的容量可由以下公式计算:

    Capacity in bits = path bandwidth in bits per second * round-trip time (RTT) in seconds

    容量称为带宽延迟乘积 (BDP)。管道可以用粗(高带宽)和细(低带宽)或者长(高 RTT)和短(低 RTT)来表示。粗而长的管道的 BDP 最高。使用高 BDP 传输路径的示例包括卫星链接或带有洲际光缆链接的企业广域网 (WAN)。

    TCP 报头中的“窗口”字段大小为 16 位,允许 TCP 对等方通告最大为 65,535 字节的接收窗口。您可以根据以下公式计算给定 TCP 窗口的近似吞吐量:

    Throughput = TCP maximum receive windowsize / RTT

    例如,对于 65,535 字节的接收窗口,在 RTT 为 100 毫秒的路径上只能达到速度大约为每秒 65536 * 8/ 0.1=5.24 兆字节 (Mbps) 的吞吐量,而不管传输路径的实际带宽是多少。对于目前的高 BDP 传输路径,最初设计的 TCP 窗口大小即使达到最大值,仍然是吞吐量的瓶颈。

    注意:这里的延迟可以通过ping来获取!

    From: MicrosoftTechNet

     
    • gusingchen 14:57 on 2008 年 07 月 02 日 链接地址

      How big should I set the TCP window size?
      In theory the TCP window size should be set to the product of the available bandwidth of the network and the round trip time of data going over the network. For example if a network had a bandwidth of 100 Mbits/s and the round trip time was 5 msec, the TCP window should be 100×10^6 times 5×10^-3 or 500×10^3 bits (65 kilobytes).

      The easiest way to determine the round trip time is to use ping from one host to the another and use the response times returned by ping.

      Note that many architectures have limits on the size of the socket buffer and hence the TCP window size. Typically these are on the order of a megabyte

  • bixuan 21:25 on 2008 年 01 月 03 日 链接地址 | 回复  

    面向站长和网站管理员的Web缓存加速指南[翻译] 

    原文(英文)地址: http://www.mnot.net/cache_docs/  版权声明:署名-非商业性使用-禁止演绎 2.0

    这是一篇知识性的文档,主要目的是为了让Web缓存相关概念更容易被开发者理解并应用于实际的应用环境中。为了简要起见,某些实现方面的细节被简化或省略了。如果你更关心细节实现则完全不必耐心看完本文,后面参考文档和更多深入阅读部分可能是你更需要的内容。

    1. 什么是Web缓存,为什么要使用它?
    2. 缓存的类型:
      1. 浏览器缓存;
      2. 代理服务器缓存;
    3. Web缓存无害吗?为什么要鼓励缓存?
    4. Web缓存如何工作:
    5. 如何控制(控制不)缓存:
      1. HTML Meta标签 vs. HTTP头信息;
      2. Pragma HTTP头信息(为什么不起作用);
      3. 使用Expires(过期时间)HTTP头信息控制保鲜期;
      4. Cache-Control(缓存控制) HTTP头信息;
      5. 校验参数和校验;
    6. 创建利于缓存网站的窍门;
    7. 编写利于缓存的脚本;
    8. 常见问题解答;
    9. 缓存机制的实现:Web服务器端配置;
    10. 缓存机制的实现:服务器端脚本;
    11. 参考文档和深入阅读;
    12. 关于本文档;

    原文:http://www.chedong.com/tech/cache_docs.html

     
  • bixuan 10:26 on 2008 年 01 月 03 日 链接地址 | 回复  

    crc32,md5,sha1执行效率的比较 

    对3402285大小的字符串进行10000次执行sha1,md5,crc32这3个函数的测试,得出结果如下:
    字符串大小:3402285
    连续执行次数:10000
    执行结果:
    sha1: 288.353684秒
    md5: 157.227909秒
    crc32: 128.691496秒
    crc32的效率比md5要快22%
    执行:php test_sha1_md5_crc32.php crc32 file_nme 1000
    附上脚本:

    [php]
    < ?php
    /*
    * Name: test_sha1_md5_crc32.php
    * Date: 2008-01-03
    * Author: bixuan
    */
    if ($argc != 4)
    {
    echo "php test.php sha1|md5|crc32 file_name count\n";
    exit;
    }

    if (!file_exists($argv[2]))
    {
    echo $argv[2]." is not exists.\n";
    exit;
    }

    if(!is_numeric($argv[3]))
    {
    echo $argv[3]." is not int.\n";
    exit;
    }

    function microtime_float()
    {
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
    }

    $time_start = microtime_float();
    $file = $argv[2];
    $file_size = filesize($file);
    $fc = file_get_contents($file);
    $i=$argv[3];
    for($k=0;$k< $i;$k++)
    {
    if ($argv[1] == "sha1")
    {
    echo $k.":".sha1($fc)."\n";
    }elseif($argv[1] == "md5")
    {
    echo $k.":".md5($fc)."\n";
    }elseif($argv[1] == "crc32")
    {
    echo $k.":".crc32($fc)."\n";
    }else
    {
    echo "error.\n";
    break;
    }
    }
    $time_end = microtime_float();
    $time = $time_end - $time_start;
    //echo $time."
    ";
    $time = sprintf("%01.6f", $time);
    echo "\n";
    echo "Algorithm:\t".$argv[1]."\nFileName\t".$file."\nFileSize:\t".$file_size."Bytes\nCostTime:\t$time Sec.\n";
    unset($file_size);
    unset($fc);
    ?>
    [/php]

     
c
写新的
j
下一篇文章/下一个回复
k
前一篇文章/以前的回复
r
回复
e
编辑
o
显示/隐藏 回复
t
回到顶部
l
go to login
h
show/hide help
esc
取消