摘要: 参考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... 阅读全文
posted @ 2014-03-14 15:24 tree.liang 阅读(2994) 评论(0) 推荐(1) 编辑
摘要: 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 阅读全文
posted @ 2014-03-13 16:30 tree.liang 阅读(736) 评论(0) 推荐(0) 编辑
摘要: 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. 阅读全文
posted @ 2014-03-13 15:54 tree.liang 阅读(1491) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2014-03-13 15:39 tree.liang 阅读(649) 评论(0) 推荐(0) 编辑
摘要: 可以使用du命令du -sh [dirname|filename]当前的大小du -sh .当前的目录里的文件或子目录大小du -sh *显示前10个占用空间最大的文件或目录du -s * | sort -nr |head*-h 以易读的格式显示指定目录或文件大小×-s 指定对于目录不详细显示每个子目录或文件大小 阅读全文
posted @ 2013-10-31 11:05 tree.liang 阅读(418) 评论(0) 推荐(0) 编辑
摘要: '''Created on 2013-10-22@author: Administrator'''class Subject(object): def __init__(self): self._observers=[] def attach(self,observer): if not observer in self._observers: self._observers.append(observer) def detach(self,observer): try: ... 阅读全文
posted @ 2013-10-22 15:23 tree.liang 阅读(1299) 评论(0) 推荐(0) 编辑
摘要: 模仿《python 3 patterns》写单例,我是python2.71、内部类实现方式class OnlyOne: class __OnlyOne: def __init__(self,arg): self.val=arg def __str__(self): return self.val instance =None def __init__(self,arg): if not OnlyOne.instance: OnlyOne.instance=OnlyOne... 阅读全文
posted @ 2013-10-21 14:59 tree.liang 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 安装MySQL-python的时候遇到“MySQL-python EnvironmentError: mysql_config not found”。原因是我使用mac自带的mysql.需要修改MySQL-python安装目录中的site.cfg,将mysql_config设置为mac的mysql中mysql_config路径# The path to mysql_config.# Only use this if mysql_config is not on your PATH, or you have some weird# setup that requires it.mysql_... 阅读全文
posted @ 2013-10-17 23:10 tree.liang 阅读(401) 评论(0) 推荐(0) 编辑
摘要: 此文主要参考《spring batch in action》的第10章controlling execution。在之前介绍了batch按step线性执行任务,实际上它也可以执行一定复杂的流程处理。设计一个简单流程,流程如下根据以上需求,我们只需要如此配置job ... 阅读全文
posted @ 2013-10-01 19:38 tree.liang 阅读(1901) 评论(0) 推荐(0) 编辑
摘要: 在LT eip里,springbatch是常用到的批处理框架。小批量简单数据结构可以直接用其加上rowmap做批量同步,大数据量复杂数据结构转换同步可以用batch+mq(分发到多个服务处理)+smooks。 以下是以erp600中海关3个基础资料(成品电子账册、料件电子账册、账册备案信息)批量同步到k3cloud系统为例 1、创建batch的job(任务)配置文件,参考RESTEipClient\src\main\resources\META-INF\spring\batch\customs.xml(因为erp600是LT自己开发的erp系统,命名规范是按拼音首字母,虽然不是正规的... 阅读全文
posted @ 2013-09-30 09:51 tree.liang 阅读(1854) 评论(0) 推荐(0) 编辑