Latest Entries »

两种高性能 I/O 设计模式 Reactor 和 Proactor(转) 原文链接 http://www.cnblogs.com/daoluanxiaozi/p/3274925.html
感谢分享

Reactor 和 Proactor 是基于事件驱动,在网络编程中经常用到两种设计模式。

曾经在一个项目中用到了网络库 libevent,也学习了一段时间,其内部实现所用到的就是 Reactor,所知道的还有 ACE;Proactor 模式的库有 Boost.Asio,ACE,暂时没有用过。但我也翻阅了一些文档,理解了它的实现方法。下面是我在学习这两种设计模式过程的笔记。

Reactor

View full article »

首先都是关于wireshark
遇到网络性能问题三板斧
1.Statistics-->Summary 看Avg.Mbit/sec 看流量,观察存储负载 //统计信息
2.Statistics-->Service Response Time -->xxxxx(比如:ONC-RPC->Program:NFS VERSION:3-->Create Stat) 看 SRT,观察是否过载 //读写相应时间
3.Analyze-->Expert Info Composite 从Error 和 Warning看报错 比如重传乱序 的现象 //重传统计和重置统计

//数据传输情况
Statistics->TCP Stream Graph(Stevens)

View full article »

js查看,清除cookie

查看cookie

<!DOCTYPE html>
<html>

    <head>
        <meta charset="utf-8">
        <title></title>
    </head>

    <body>
        <script>
            alert(document.cookie);
        </script>
    </body>

</html>

View full article »

字典结构

typedef struct dict{
    dictType *type;
    void *privdata;
    dictht ht[2]; //哈希表  使用ht[0],ht[1]用于rehash
    int rehashidx; //当rehash不在进行时,值为-1;记录rehash进度
}dict;

hash值计算公式: hash = dict->type->hashFunction(key);

View full article »

SDS simple dynamic string
redis 默认字符串

结构:

struct sdshdr{
    int len;
    int free;
    char buf[];
};

打印 printf("%s",s->buf);

View full article »

Powered by Typecho. Theme: Motion modified by changyuefeng.版权所有ICP证:浙ICP备20011766号