03 2014 档案
摘要:murmurhash的c++版 1 //----------------------------------------------------------------------------- 2 // MurmurHash2, by Austin Appleby 3 4 // Note - This code makes a few assumptions about how your machine behaves - 5 6 // 1. We can read a 4-byte value from any address without crashing 7 // 2. size..
阅读全文
摘要:hash 是用于分配值到一或多个存储里,并且为了之后快速检索.如下图,需要插入一个新的item基于hash值,必须在一定时间(当然是越快越好)告知值在哪个块中保存这个是非常慢的hash检索逻辑12345for(i = 0; i in comp.lang.c , October, 1990." in Rich * Salz's USENIX 1992 paper about INN which can be found at * . * * The magic of number 33, i.e. why it works better than many ot...
阅读全文
摘要:jedis 的shard使用的是MurmurHash算法(一种非加密型哈希函数),该算法已在nginx,hadoop等开源上使用.回顾String的hashcode()方法//把char型数字转换成的int型数字,因为它们的ASCII码值恰好相差48 char val[] = "111".toCharArray(); int hcode=0; for (int i = 0; i < val.length; i++) { hcode = 31 * hcode + val[i]; }例如业界最好的字符串hash是tim...
阅读全文
摘要:# Redis configuration file example# http://blog.sina.com.cn/s/blog_636415010101970j.html# Note on units: when memory size is needed, it is possible to specify# it in the usual form of 1k 5GB 4M and so forth:## 1k => 1000 bytes# 1kb => 1024 bytes# 1m => 1000000 bytes# 1mb => 1024*1024 byt
阅读全文
摘要:http://redis.readthedocs.org/en/latest/启动服务器[root@ltzyerpeip /]# redis-server /opt/soft/redis-2.8.7/redis.conf停止服务器[zyerp@ltzyerpeip ~]$ redis-cli shutdown客户端连接[zyerp@ltzyerpeip ~]$ redis-cli
阅读全文
摘要:为什么用REDIS目前常有大批量数据ETL场景,比如给予一个合同号,可能涉及上千至万的面料同步(并且该接受到合同号请求的实例还必须把所有同步之后的新面料ID返回给rest客户端),按以往完全由一个EIP实例去完成的话,客户端等待时间过长,现考虑使用REDIS来辅助完成。实例1将获取到的需转换ID及其类型(可能是单据,基础资料,人员等等唯一类型标识),目标列表(目标列表名由发起实例1指定,实例1将从这里获取到所有新ID)提交到REC列表。其他EIP实例就可以通过REC列表获得ID,经过转换后把新ID放到目标列表中,实例1异步判断目标列表KEY值数量是否与需转换ID数量一致,当一致时,获取列表所有
阅读全文
摘要:Monday, 26 August 2013Lock-Based vs Lock-Free Concurrent AlgorithmsLast week I attended a review session of the newJSR166StampedLockrun byHeinz Kabutzat the excellentJCreteunconference. StampedLock is an attempt to address the contention issues that arise in a system when multiple readers concurrent
阅读全文
摘要:Netty 4 内存管理:sun.misc.Cleaner
阅读全文
摘要:参考sun.misc.Unsafe的源码sun.misc.Unsafe的APIJava Magic. Part 4: sun.misc.UnsafeNetty4 可以利用Unsafe来提高内存读写性能(作为可选项,如果系统参数io.netty.noUnsafe为true且JDK支持的话)。Unsafe不能直接使用(在java.nio.Bits中是// -- Unsafe access -- private static final Unsafe unsafe = Unsafe.getUnsafe();假如我们代码中也这样直接使用的话,会抛出异常java.lang.SecurityExce...
阅读全文
摘要:Netty at Twitter with FinagleThursday, February 13, 2014|By Jeff Smick (@sprsquish)[01:25 UTC]TweetFinagleis our fault tolerant, protocol-agnostic RPC framework built atopNetty. Twitter’s core services are built on Finagle, from backends serving user profile information, Tweets, and timelines to fro
阅读全文
摘要:jemalloc的创始人Jason Evanshttps://www.facebook.com/notes/facebook-engineering/scalable-memory-allocation-using-jemalloc/480222803919Jason Evans的论文http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf另外2个中文博客参考http://wangkaisino.blog.163.com/blog/static/1870444202011431112323846/http://www.
阅读全文
摘要:https://blog.twitter.com/2013/netty-4-at-twitter-reduced-gc-overheadhttp://www.infoq.com/news/2013/11/netty4-twitterReducing GC pressure and memory bandwidth consumptionA problem was Netty 3’s reliance on the JVM’s memory management for buffer allocations. Netty 3 creates a new heap buffer whenever
阅读全文

浙公网安备 33010602011771号