libevent

Libev on Windows

我的未来我决定 提交于 2020-01-01 05:17:06
问题 Considering libevent vs. libev . Does the libev library have native support of IOCP on Windows? 回答1: both libev and libevent use select on windows to detect and dispatch events (the event core doesn't do I/O, only events). libevent in addition has a socket handle abstraction, which uses iocps on windows to do reads and writes. libev doesn't have anything comparable. the benchmarks seen so far indicate that the iocp backend of libevent is not very fast though, so if you are looking for fast on

thrift编译安装

本秂侑毒 提交于 2019-12-30 23:55:42
关于thrift的介绍:http://www.ibm.com/developerworks/cn/java/j-lo-apachethrift/ Apache Thrift 是 Facebook 实现的一种高效的、支持多种编程语言的远程服务调用的框架。它采用接口描述语言定义并创建服务,支持可扩展的跨语言服务开发,所包含的代码生成引擎可以在多种语言中,如 C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk 等创建高效的、无缝的服务,其传输数据采用二进制格式,相对 XML 和 JSON 体积更小,对于高并发、大数据量和多语言的环境更有优势。本文将详细介绍 Thrift 的使用,并且提供丰富的实例代码加以解释说明,帮助使用者快速构建服务。   好了。身为一个死运维,开发提出需求让装一个这样开发框架,期间提示缺少各种openssl的安装包的库文件依赖。随着安装成功现总结安装过程如下: 安装软件准备:   thrift http://mirror.bit.edu.cn/apache/thrift/0.9.1/thrift-0.9.1.tar.gz   boost http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54

centos 7安装Memcache及其php拓展

我怕爱的太早我们不能终老 提交于 2019-12-30 00:51:52
Linux 下配置使用memcache功能,主要包括:安装libevent函数库、安装memcached、配置 PHP 扩展。 一、安装libevent函数库 libevent各版本地址: http://libevent.org/old-releases.html 在此我安装当前最稳定版本:libevent-2.0.21 1.下载并安装 [root@centos-7 ~]# wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz [root@centos-7 ~]# tar -zxvf libevent-2.0.21-stable.tar.gz [root@centos-7 ~]# cd libevent-2.0.21-stable [root@centos-7 libevent-2.0.21-stable]# ./configure --prefix=/usr/local/libevent [root@centos-7 libevent-2.0.21-stable]# make && make install (我安装到了/usr/local/libevent下) 2.检查是否安装成功: # ls -al /usr/local/libevent/lib | grep

lnmp centos7 memcache服务器端 和 memcache memcached扩展的安装

无人久伴 提交于 2019-12-27 19:10:40
在项目开发的时候有用到memcache,自己在本地需要搭建一个memcache环境,用于开发和测试; wget http://www.memcached.org/files/memcached-1.5.10.tar.gz tar zxvf memcached-1.5.10.tar.gz ./configure --prefix=/usr/local/libevent make && make install ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent https://blog.csdn.net/happyrabbit456/article/details/44680597 https://blog.csdn.net/21aspnet/article/details/6827316 http://pecl.php.net/package/memcache https://launchpad.net/libmemcached/+download https://blog.csdn.net/u011547570/article/details/78325556 1.memcache服务器端的安装 学习源头:https://blog.csdn.net/21aspnet

Windows平台编译libevent

a 夏天 提交于 2019-12-25 15:00:19
使用VisualStudio来编译,我的电脑上安装的是VS2013。 1、在开始菜单项里面(或者在VS安装路径中)打开Developer Command Prompt for VS2013.exe 2、在Developer Command Prompt for VS2013.exe命令行中进入你的libevent源码路径(例如d:\libevent) cd d:\libevent 3、执行编译命令: nmake -f makefile.nmake 4、最终生成libevent.lib、libevent_core.lib和libevent_extras.lib 3个静态库 ———————————————— 版权声明:本文为CSDN博主「江南烟雨梦」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/beyond0824/article/details/52120252 来源: https://www.cnblogs.com/isky0824/p/12096682.html

MHA部署

喜欢而已 提交于 2019-12-24 20:13:14
Memcached概述 一套开源的高性能分布式内存对象缓存系统 所有的数据都存储在内存中 支持任意存储类型的数据 提高网址访问的速度 Memcached缓存机制 当程序写入缓存数据请求时,Memcached的API接口将KEY输入路由算法模块路由到集群中的一台服务,之后由API接口与服务器进行通信,完成一次分布式缓存写入 Key索引建立在API中,值value数据存在后面的memcached中 Memcached分布式 要依赖于Memcached的客户端来实现 多个Memcached服务器是独立的 分布式数据如何存储是路由算法所决定 Memcached路由算法 求余数hash算法 先用key做hash运算的到一个整数,再去做hash算法,根据余数进行路由。不适合在动态变化的环境中 一致性hash算法 按照hash算法把对应key通过一定hash算法处理后映射形成一个首尾接闭合循环,然后通过使用与对象存储一样的hash算法将机器也映射到环中,顺时针方向计算将所有对象存储到离自己最近的机器中。适合在动态变化中使用 Memcached是danga.com(运营LiveJournal的技术团队)开发的一套分布式内存对象缓存系统,用于在动态系统中减少数据库负载,提升性能。关于这个东西,相信很多人都用过,本文意在通过对memcached的实现及代码分析,获得对这个出色的开源软件更深入的了解

write non-blocking event with with libevent in C programming

 ̄綄美尐妖づ 提交于 2019-12-24 19:29:54
问题 I am newbie in libevent and socket programming that's why I have question about how libevent working as asynchronous and non blocking. Here is the reference code. https://github.com/libevent/libevent/blob/master/sample/http-server.c static void dump_request_cb(struct evhttp_request *req, void *arg) { const char *cmdtype; struct evkeyvalq *headers; struct evkeyval *header; struct evbuffer *buf; printf("Request Start\n"); sleep(30); // delay to read request to check non blocking event. switch

libevent: is it allowed to free an event inside its callback function if the event is created by malloc

霸气de小男生 提交于 2019-12-24 13:37:21
问题 I need to create events using malloc , but I'm at a loss where to free them, I'm wondering whether it is allowed to free an event inside its callback function, like: struct event *pkt_ev = (struct event *)malloc(sizeof(struct event)); evtimer_set(&pkt_ev, timer_cb, &pkt_ev); event_base_set(base, &pkt_ev); event_add(&pkt_ev, timeout); the callback function timer_cb(): timer_cb(int fd, short ev, void* arg){ ....... free(arg); // here the arg is &pkt_ev } my initial thinking is: after the

缓存数据库Memcached——安装及管理数据库操作

瘦欲@ 提交于 2019-12-24 01:51:48
一、Memcached 简介: (1)介绍: Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载。它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态、数据库驱动网站的速度。Memcached基于一个存储键/值对的hashmap。其守护进程(daemon )是用C写的,但是客户端可以用任何语言来编写,并通过memcached协议与守护进程通信。 (2)特点: memcached作为高速运行的分布式缓存服务器,具有以下的特点: 1、协议简单; 2、基于libevent的事件处理; 3、内置内存存储方式; 4、memcached不互相通信的分布式。 (3)存储方式: 为了提高性能,memcached中保存的数据都存储在memcached内置的内存存储空间中。由于数据仅存在于内存中,因此重启memcached、重启操作系统会导致全部数据消失。另外,内容容量达到指定值之后,就基于LRU(Least Recently Used)算法自动删除不使用的缓存。memcached本身是为缓存而设计的服务器,因此并没有过多考虑数据的永久性问题。 二、memcached数据库配置: 1、准备安装所需源码包 [root@localhost ~]# mkdir /mnt/tools [root@localhost ~]# mount.cifs //192

libevent & signal handling (SIGCHLD specifically)

守給你的承諾、 提交于 2019-12-24 00:55:26
问题 This is somewhat of a followup to related question I found here. In the linked question there is a mention of using signalfd() and using that fd with libevent. In that question the OP does not list why he is using signalfd() as opposed to the libevent signal handling facilities. In both methods you would be processing the callback outside of the signal-handler. This documentation seems to warn about scheduling timer in the signal event callback. Which doesn't seem right (as we would be