08 2013 档案

摘要:beanstalk中两种重要的数据结构就是集合和最小堆。 1. 集合 集合struct ms { size_t used, cap, last; void **items; ms_event_fn oninsert, onremove;};voidms_init(ms a, ms_event_fn oninsert, ms_event_fn onremove){ a->us... 阅读全文
posted @ 2013-08-24 15:55 blockcipher 阅读(329) 评论(0) 推荐(0)
摘要:1. tube定义 在beanstalk中,tube只是一个消息队列的名字,本身只是作为job的容器,因此不具有复杂的操作。 由于job具有优先级,这里采用最小堆保存job job具有ready和delay两种状态,因此每个tube采用两个最小堆对job进行管理。 tube结构struct tube { uint refs; char name[MAX_TUBE_NAME_LEN]; ... 阅读全文
posted @ 2013-08-24 15:49 blockcipher 阅读(1057) 评论(0) 推荐(0)
摘要:在beanstalk中,网络处理模块没有使用第三方库,而是作者自己实现的一个模块,总计代码不到100行。是epoll的使用典范。1. epoll_eventstruct epoll_event结构如下:struct epoll_event { __uint32_t events; /* Epoll events */ epoll_data_t data; /* User data variable */};typedef union epoll_data { void ptr; int fd; __uint32_t u32; __uint64_t u64; }... 阅读全文
posted @ 2013-08-24 15:07 blockcipher 阅读(357) 评论(0) 推荐(0)
摘要:1. 文件结构组织beanstalk的源码文件物理组织如下:makefile文件:Makefile 数据结构定义: dat.h 主程序: main.c Server实例: serv.c 协议处理: prot.c 连接管理: conn.c tube管理: tube.c job管理: job.c 集合管理: ms.c daemon监听端口: net.c epoll抽象: linux.c 堆操作: heap.c daemon框架: sd-daemon.h sd-daemon.c binlog处理: file.c walg.c 系统时间: tim... 阅读全文
posted @ 2013-08-24 12:32 blockcipher 阅读(537) 评论(0) 推荐(0)
摘要:http://oldblog.antirez.com/post/autocomplete-with-redis.htmlHello! This isn't just a blog post, it is actually the Redis weekly update number eight, but we can't tell this to Google: naming posts likeRedis Weekly update #...will not play well with Google indexing, so I'm starting to use 阅读全文
posted @ 2013-08-18 20:41 blockcipher 阅读(345) 评论(0) 推荐(0)
摘要:http://highscalability.com/blog/2013/5/13/the-secret-to-10-million-concurrent-connections-the-kernel-i.htmlNow that we have theC10K concurrent connection problemlicked, how do we level up and support 10 million concurrent connections? Impossible you say. Nope, systems right now are delivering 10 mil 阅读全文
posted @ 2013-08-18 20:38 blockcipher 阅读(265) 评论(0) 推荐(0)
摘要:https://github.com/blog/542-introducing-resqueResqueis our Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later.Background jobs can be any Ruby class or module that responds toperform. Your existing classes can easily be converted to bac 阅读全文
posted @ 2013-08-18 20:36 blockcipher 阅读(211) 评论(0) 推荐(0)
摘要:http://justjavac.com/nosql/2012/04/13/redis-persistence-demystified.html本文内容来源于Redis 作者博文,Redis作者说,他看到的所有针对Redis的讨论中,对Redis持久化 的误解是最大的,于是他写了一篇长文来对Redis的持久化进行了系统性的论述。什么是持久化,简单来讲就是将数据放到断电后数据不会丢失的设备中。也就是我们通常理解的硬盘上。写操作的流程首先我们来看一下数据库在进行写操作时到底做了哪些事,主要有下面五个过程。客户端向服务端发送写操作(数据在客户端的内存中)数据库服务端接收到写请求的数据(数据在服务端的 阅读全文
posted @ 2013-08-18 20:35 blockcipher 阅读(206) 评论(0) 推荐(0)
摘要:http://blog.sina.com.cn/s/blog_998c49430101883d.html一、Redis的Replication:这里首先需要说明的是,在Redis中配置Master-Slave模式真是太简单了。相信在阅读完这篇Blog之后你也可以轻松做到。这里我们还是先列出一些理论性的知识,后面给出实际操作的案例。下面的列表清楚的解释了Redis Replication的特点和优势。1). 同一个Master可以同步多个Slaves。2). Slave同样可以接受其它Slaves的连接和同步请求,这样可以有效的分载Master的同步压力。因此我们可以将Redis的Replica 阅读全文
posted @ 2013-08-18 20:31 blockcipher 阅读(336) 评论(0) 推荐(0)
摘要:http://www.oschina.net/translate/redis-latency-problems-troubleshooting?cmpThis document will help you understand what the problem could be if you are experiencing latency problems with Redis.In this contextlatencyis the maximum delay between the time a client issues a command and the time the reply 阅读全文
posted @ 2013-08-18 20:29 blockcipher 阅读(1702) 评论(0) 推荐(0)
摘要:http://inventwithpython.com/hacking/chapters/Chapter 1 - Making Paper Cryptography Tools[related content]Chapter 2 - Downloading and Installing Python[related content]Chapter 3 - The Interactive Shell[related content]Chapter 4 - Strings and Writing Programs[related content]Chapter 5 - The Reverse Ci 阅读全文
posted @ 2013-08-18 20:12 blockcipher 阅读(302) 评论(0) 推荐(0)
摘要:http://www.woqutech.com/?p=769MYSQL数据丢失讨论1. 概述很多企业选择MySQL都会担心它的数据丢失问题,从而选择Oracle,但是其实并不十分清楚什么情况下,各种原因导致MySQL会丢失部分数据。本文不讨论Oracle和MySQL的优劣,仅仅关注MySQL丢失数据的几种情况。希望能够抛砖引玉,让各位MySQL大牛们梳理出MySQL最安全或者性价比合适的适合各种应用场景的方案。2. 问题定义一般我们希望把一系列的数据作为一个原子操作,这样的话,这一系列操作,要么提交,要么全部回滚掉。当我们提交一个事务,数据库要么告诉我们事务提交成功了,要么告诉我们提交失败。数 阅读全文
posted @ 2013-08-18 20:06 blockcipher 阅读(212) 评论(0) 推荐(0)
摘要:本文写的非常好,但是翻译的质量不是很好,因此本文基于翻译做了修改。转自http://www.oschina.net/translate/what-every-programmer-should-know-about-memory-part1[Editor's introduction: Ulrich Drepper recently approached us asking if we would be interested in publishing a lengthy document he had written on how memory and software intera 阅读全文
posted @ 2013-08-11 11:16 blockcipher 阅读(5998) 评论(0) 推荐(0)
摘要:转自http://diy.zol.com.cn/21/218965_all.html#p218965本文导航第1页:序:不得不说的话第2页:SDRAM与内存基础概念(一)第3页:SDRAM与内存基础概念(二)第4页:SDRAM与内存基础概念(三)第5页:SDRAM与内存基础概念(四)第6页:SDRAM与内存基础概念(五)第7页:SDRAM与内存基础概念(六)第8页:SDRAM的结构、时序与性能的关系(上)第9页:SDRAM的结构、时序与性能的关系(下)第10页:如日中天——DDR SDRAM(上)第11页:如日中天——DDR SDRAM(下)第12页:昔日贵族——Rambus DRAM(一)第 阅读全文
posted @ 2013-08-10 17:17 blockcipher 阅读(1334) 评论(0) 推荐(0)
摘要:奥地利符号计算研究所(Research Institute for Symbolic Computation,简称RISC)的Christoph Koutschan博士在自己的页面上发布了一篇文章,提到他做了一个调查,参与者大多数是计算机科学家,他请这些科学家投票选出最重要的算法,以下是这次调查的结果,按照英文名称字母顺序排序。A* 搜索算法——图形搜索算法,从给定起点到给定终点计算出路径。其中使用了一种启发式的估算,为每个节点估算通过该节点的最佳路径,并以之为各个地点排定次序。算法以得到的次序访问这些节点。因此,A*搜索算法是最佳优先搜索的范例。集束搜索(又名定向搜索,Beam Search 阅读全文
posted @ 2013-08-03 10:44 blockcipher 阅读(161) 评论(0) 推荐(0)