C++11 网络库 handy

码农软件 · 软件分类 · 网络工具包 · 2019-02-26 22:44:29

软件介绍

handy

a HANDY network C++11 libray on linux.

reactor 模式

支持优雅退出

无锁日志系统,按时间间隔轮替

代码简短

参考muduo的实现,采用C++11简化代码

ubuntu14 64位/g++ 4.8.1上通过测试

性能

handy的http服务器性能对比

对比了libevent2.0.21的test下http_bench以及nginx的性能

测试环境为thinkpad t420笔记本上的ubuntu14 64位虚机

nginx使用agentzh的echo模块

worker_processes=1

location /hello {

echo "hello world!"

}

http_bench为默认参数

handy使用的程序为example下的http-echo

其中nginx的qps较低,主要原因为nginx的响应内容较多,包括了多个header,并且使用chunk编码

handy和libevent的性能不相上下

单机千万并发连接测试

安装

make

examples

#include <handy/handy.h>
using namespace handy;

int main(int argc, const char* argv[]) {
    EventBase base;
    Signal::signal(SIGINT, [&]{ base.exit(); });
    TcpServerPtr svr = TcpServer::startServer(&base, "", 99);
    exitif(svr == NULL, "start tcp server failed");
    svr->onConnRead([](const TcpConnPtr& con) {
        con->send(con->getInput());
    });
    base.loop();
}

本文地址:https://www.codercto.com/soft/d/211.html

Learning PHP & MySQL中文版

Learning PHP & MySQL中文版

车立红 / 中国电力出版社 / 2007-06 / 36.00元

《Learning PHP & MySQL中文版》将介绍程序、模板和数据库的工作原理,讲述如何应对其中的挑战,并彻底地探索这些技术。一起来看看 《Learning PHP & MySQL中文版》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具