??xml version="1.0" encoding="utf-8" standalone="yes"?>国产av无码专区亚洲av毛片搜,国产午夜亚洲精品国产,亚洲精品卡2卡3卡4卡5卡区http://m.tkk7.com/killme2008/category/20771.html生活、程序、未?/description>zh-cnThu, 11 Dec 2014 01:02:38 GMTThu, 11 Dec 2014 01:02:38 GMT60Another URL Shortener using NodeJShttp://m.tkk7.com/killme2008/archive/2012/11/25/391936.htmldennisdennisSun, 25 Nov 2012 12:31:00 GMThttp://m.tkk7.com/killme2008/archive/2012/11/25/391936.html
Is is written in NodeJS,using express.js for MVC framework,and using MySQL for storage and Redis for caching.

A demo online: http://fnil.me/

The project is at https://github.com/killme2008/node-shorten

Feel free to modify and use it.Have fun.

dennis 2012-11-25 20:31 发表评论
]]>
Ring.velocity:render velocity templates for ring in clojurehttp://m.tkk7.com/killme2008/archive/2012/07/18/383354.htmldennisdennisTue, 17 Jul 2012 16:07:00 GMThttp://m.tkk7.com/killme2008/archive/2012/07/18/383354.htmlhttp://m.tkk7.com/killme2008/comments/383354.htmlhttp://m.tkk7.com/killme2008/archive/2012/07/18/383354.html#Feedback0http://m.tkk7.com/killme2008/comments/commentRss/383354.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/383354.htmlHome: https://github.com/killme2008/ring.velocity

A Clojure library designed to render velocity template for ring in clojure.

Usage

Adds dependency in leiningen project.clj:

  [ring.velocity "0.1.0-SNAPSHOT"] 

Create a directory named templates in your project directory to keep all velocity templates.

Create a template templates/test.vm:

  hello,$name,your age is $age. 

Use ring.velocity in your namespace:

  (use '[ring.velocity.core :only [render]]) 

Use render function to render template with vars:

  (render "test.vm" :name "dennis" :age 29) 

The test.vm will be interpreted equals to:

  hello,dennis,your age is 29. 

Use ring.velocity in compojure:

  (defroutes app-routes      
(GET "/" [] (render "test.vm" :name "dennis" :age 29))
(route/not-found "Not Found"))

Use ring.velocity in ring:

  (use '[ring.util.response])   
(response (render "test.vm" :name "dennis" :age 29))

Custom velocity properties,just put a file named ring-velocity.properties to your classpath or resource paths.The default velocity properties is in src/default/velocity.properties.

License

Copyright © 2012 dennis zhuang[killme2008@gmail.com]

Distributed under the Eclipse Public License, the same as Clojure.

Home: https://github.com/killme2008/ring.velocity



dennis 2012-07-18 00:07 发表评论
]]>
分布式消息中间gMetaq发布1.4.3http://m.tkk7.com/killme2008/archive/2012/06/04/379895.htmldennisdennisMon, 04 Jun 2012 02:03:00 GMThttp://m.tkk7.com/killme2008/archive/2012/06/04/379895.htmlhttp://m.tkk7.com/killme2008/comments/379895.htmlhttp://m.tkk7.com/killme2008/archive/2012/06/04/379895.html#Feedback1http://m.tkk7.com/killme2008/comments/commentRss/379895.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/379895.html我们在维护的淘宝开源消息中间g?a style="color: #006699; ">metaq?a style="color: #006699; ">github分支Q今天发布了1.4.2版本Q主要做了如下改q:

1.支持发送和订阅分离Q可以细_度地控制Broker或者某个Topic是否接收消息和接受订阅。服务端d新选项acceptPublish和acceptSubscribe?br />
2.更友好地关闭BrokerQ梳理关闭流Eƈ通过JMX调用Ҏ关闭替代原来单的kill?br />
3.更新python客户?/a>?.2版本Q可以通过pip安装:  pip install metaq

4.发布ruby语言客户?a style="color: #006699; ">meta-ruby
 0.1版本?br />
5.其他改q:升gecko?.1.1版本Q升Uquartz?.1.4版本Q添加集成测试工E和内部重构{?br />
6.新文?a >《用log4j扩展发送消息?/a>

介:https://github.com/killme2008/Metamorphosis/wiki/介绍
下蝲Q?a style="color: #006699; ">https://github.com/killme2008/Metamorphosis/downloads

文Q?a style="color: #006699; ">https://github.com/killme2008/Metamorphosis/wiki



dennis 2012-06-04 10:03 发表评论
]]>
clj.monitor : monitoring applications in clojure based on SSHhttp://m.tkk7.com/killme2008/archive/2012/05/12/378018.htmldennisdennisSat, 12 May 2012 14:38:00 GMThttp://m.tkk7.com/killme2008/archive/2012/05/12/378018.htmlhttp://m.tkk7.com/killme2008/comments/378018.htmlhttp://m.tkk7.com/killme2008/archive/2012/05/12/378018.html#Feedback5http://m.tkk7.com/killme2008/comments/commentRss/378018.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/378018.html
    My weekend project clj.monitor is beta release,it's a clojure DSL for monitoring system and applications based on SSH.

Home:https://github.com/killme2008/clj.monitor

An example:
(ns clj.monitor.example
  (:use [clj.monitor.core]
        [control.core]
        [clj.monitor.tasks]))

;;define a mysql cluster
(defcluster mysql
  :clients [{:user "deploy" :host "mysql.app.com"}])

;;define a monitor for mysql cluster
(defmonitor mysql-monitor
  :tasks [(ping-mysql "root" "password")
            (system-load :5 3)]
  :clusters [:mysql])

;;start monitors
(start-monitors
 :cron "* 0/5 * * * ?"
 :alerts [(mail :from "alert@app.com" :to "yourname@app.com")]
 :monitors [mysql-monitor])

API document: http://fnil.net/clj.monitor

It is just a beta release,if you have any questions or find issues ,please let me know,thanks.

dennis 2012-05-12 22:38 发表评论
]]>
分布式消息中间gMetaq发布1.4.2http://m.tkk7.com/killme2008/archive/2012/05/09/377748.htmldennisdennisWed, 09 May 2012 14:47:00 GMThttp://m.tkk7.com/killme2008/archive/2012/05/09/377748.htmlhttp://m.tkk7.com/killme2008/comments/377748.htmlhttp://m.tkk7.com/killme2008/archive/2012/05/09/377748.html#Feedback1http://m.tkk7.com/killme2008/comments/commentRss/377748.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/377748.html     我们在维护的淘宝开源消息中间g?a >metaq的github分支Q今天发布了1.4.2版本Q主要做了如下改q:

    1.d了大量的使用和原理文,参见Wiki?br />    2.合ƈtools和server-wrapper工程Q提供统一的脚本来理BrokerQ管理Broker的工作变得非常容易,全部工作都可以通过metaServer.sh的脚本来执行。同时提供了bat启动脚本Q用于在windows上启动Broker做测试?br />    3.新功能:
   Q?Q新的客LAPI用来获取topic的分区列?br />   Q?Q新的客LAPI用来获取Broker的统计信?br />   Q?Q异步复制的Slave可以自动获取Master的配|变_例如Master在配|文件中新增或者删除了topicq利reload热加载成功后Qslave可自动复制或者移除变更的topicQ无需重启?br />   Q?Q新的统计项目,可以通过'stats config'协议获取Broker的配|文件?br />    4.dmeta-python目Q一个python的客LQ暂时仅支持发送消息功能?br />    5.其他改q,如统计信息的优化、构建工L整合{?br />
    更详l的发行日志LRelaseNotes?br />
    下蝲地址Q? https://github.com/killme2008/Metamorphosis/downloads
    入门指南Q? ?a >如何开?/a>?br />    更多文LWiki?img src ="http://m.tkk7.com/killme2008/aggbug/377748.html" width = "1" height = "1" />

dennis 2012-05-09 22:47 发表评论
]]>
淘宝开源MQ——metaq的详l文?/title><link>http://m.tkk7.com/killme2008/archive/2012/04/13/374110.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Fri, 13 Apr 2012 14:43:00 GMT</pubDate><guid>http://m.tkk7.com/killme2008/archive/2012/04/13/374110.html</guid><wfw:comment>http://m.tkk7.com/killme2008/comments/374110.html</wfw:comment><comments>http://m.tkk7.com/killme2008/archive/2012/04/13/374110.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://m.tkk7.com/killme2008/comments/commentRss/374110.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/killme2008/services/trackbacks/374110.html</trackback:ping><description><![CDATA[<br /> <span style="font-size: 10pt; ">    最q陆陆箋l补充了不少</span><a ><span style="font-size: 10pt; ">metaq</span></a><span style="font-size: 10pt; ">的文,部分是直接从官方文里摘抄出来,攑֜?/span><a ><span style="font-size: 10pt; ">github工程的wiki?/span></a><span style="font-size: 10pt; ">Q有兴趣了解甚至使用meta的可以仔l阅MQ一份目录:</span> <div class="yzwqgik" id="wiki-content" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; background-color: #ffffff; "> <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <div class="vukpxke" id="wiki-body" instapaper_body"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <ul style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">介绍</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">基础概念和术语定?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">消息的可靠性、顺序和重复</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">如何开?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">单例?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">服务端配|管?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">集群和负载均?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">高可用配|?异步复制和同步复?</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">路线?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">FAQ</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">最佛_?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">官方手册(word文)</span></a></li> </ul> <h1 style="line-height: 1.6; "><span style="font-size: 10pt; ">    Developer</span></h1> <ul style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">参与贡献</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">设计</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">通讯协议</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">消息的存?/span></a></li> </ul> <h1 style="line-height: 1.6; "><span style="font-size: 10pt; ">兌目</span></h1> <ul style="margin-top: 15px; margin-right: 0px; margin-bottom: 0px !important; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">metamorphosis-example</span></a><span style="font-size: 10pt; ">:CZ目</span></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">storm-metamorphosis-spout</span></a><span style="font-size: 10pt; ">:使用metamorphosis作ؓtwitter storm的spout?/span></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">meta-python</span></a><span style="font-size: 10pt; ">: metamorphosis的python语言客户端。目前只支持发送消息功能?/span></li> </ul> </div> </div> </div> </div> <div class="qwbgmir" id="gollum-footer" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; line-height: 19px; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; background-color: #ffffff; "></div>     <br /> <div><span style="font-size: 10pt; ">    后箋q会l箋补充?/span><br /> </div><img src ="http://m.tkk7.com/killme2008/aggbug/374110.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/killme2008/" target="_blank">dennis</a> 2012-04-13 22:43 <a href="http://m.tkk7.com/killme2008/archive/2012/04/13/374110.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>淘宝开源metaq的python客户?/title><link>http://m.tkk7.com/killme2008/archive/2012/03/21/372405.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Wed, 21 Mar 2012 11:08:00 GMT</pubDate><guid>http://m.tkk7.com/killme2008/archive/2012/03/21/372405.html</guid><wfw:comment>http://m.tkk7.com/killme2008/comments/372405.html</wfw:comment><comments>http://m.tkk7.com/killme2008/archive/2012/03/21/372405.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://m.tkk7.com/killme2008/comments/commentRss/372405.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/killme2008/services/trackbacks/372405.html</trackback:ping><description><![CDATA[    前面一博客介l了我在github上的一?a >metaq</a>分支Q今天下午写了个metaq的python客户端,目前仅支持发送消息功能,不过麻雀虽小Q五脏俱全,客户端和zookeeper的交互和q接理之类都还具备Q不出意外,我们会首先用上。第一ơ正儿八l地写python代码Q写的不好的地方请尽拍砖,多谢?br />    目叫meta-pythonQ仍然放在github上:<a >https://github.com/killme2008/meta-python<br /><br /></a>    使用需要先安装zkpythonq个库,具体安装<a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; color: #4183c4; text-decoration: none; font-family: Helvetica, arial, freesans, clean, sans-serif; line-height: 22px; background-color: #ffffff; ">q篇博客</a>Q用很单,发送消息:<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->    <span style="color: #0000FF; ">from</span> metamorphosis <span style="color: #0000FF; ">import</span> Message,MessageProducer,SendResult<br />    p=MessageProducer(<span style="color: #800000; ">"</span><span style="color: #800000; ">topic</span><span style="color: #800000; ">"</span>)<br />    message=Message(<span style="color: #800000; ">"</span><span style="color: #800000; ">topic</span><span style="color: #800000; ">"</span>,<span style="color: #800000; ">"</span><span style="color: #800000; ">message body</span><span style="color: #800000; ">"</span>)<br />    <span style="color: #0000FF; ">print</span> p.send(message)<br />    p.close()</div><br />    <div style="display: inline-block; ">MessageProducer是消息发送者,它的构造函数接受至一个topicQ默认的zk_servers为localhost:2181Q可以通过zk_servers参数指定你的zookeeper集群:<br /><br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->p=MessageProducer(<span style="color: #800000; ">"</span><span style="color: #800000; ">topic</span><span style="color: #800000; ">"</span>,zk_servers=<span style="color: #800000; ">"</span><span style="color: #800000; ">192.168.1.100:2191,192.168.1.101:2181</span><span style="color: #800000; ">"</span>)</div><span style="background-color: #eeeeee; "><br /></span><span style="background-color: #eeeeee; ">更多参数L接看源码吧。一个本机的性能试Qmeta和客L都跑在我的机器上Q机器是Mac MC700Qosx 10.7Q磁盘没有升U过Q:<br /></span><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">from</span> metamorphosis <span style="color: #0000FF; ">import</span> Message,MessageProducer<br /><span style="color: #0000FF; ">from</span> time <span style="color: #0000FF; ">import</span> time<br />p=MessageProducer(<span style="color: #800000; ">"</span><span style="color: #800000; ">avos-fetch-tasks</span><span style="color: #800000; ">"</span>)<br />message=Message(<span style="color: #800000; ">"</span><span style="color: #800000; ">avos-fetch-tasks</span><span style="color: #800000; ">"</span>,<span style="color: #800000; ">"</span><span style="color: #800000; ">http://www.taobao.com</span><span style="color: #800000; ">"</span>)<br />start=time()<br /><span style="color: #0000FF; ">for</span> i <span style="color: #0000FF; ">in</span> range(0,10000):<br />    sent=p.send(message)<br />    <span style="color: #0000FF; ">if</span> <span style="color: #0000FF; ">not</span> sent.success:<br />        <span style="color: #0000FF; ">print</span> <span style="color: #800000; ">"</span><span style="color: #800000; ">send failed</span><span style="color: #800000; ">"</span><br />finish=time()<br />secs=finish-start<br /><span style="color: #0000FF; ">print</span> <span style="color: #800000; ">"</span><span style="color: #800000; ">duration:%s seconds</span><span style="color: #800000; ">"</span> % (secs)<br /><span style="color: #0000FF; ">print</span> <span style="color: #800000; ">"</span><span style="color: #800000; ">tps:%s msgs/second</span><span style="color: #800000; ">"</span> % (10000/secs)<br />p.close()</div><span style="background-color: #eeeeee; "><br /> l果Q?br /><br /><br /></span><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->duration:1.85962295532 seconds<br />tps:5377.43415749 msgs/second</div></div><img src ="http://m.tkk7.com/killme2008/aggbug/372405.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/killme2008/" target="_blank">dennis</a> 2012-03-21 19:08 <a href="http://m.tkk7.com/killme2008/archive/2012/03/21/372405.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>xmemcached发布1.3.6http://m.tkk7.com/killme2008/archive/2012/03/19/372179.htmldennisdennisMon, 19 Mar 2012 02:51:00 GMThttp://m.tkk7.com/killme2008/archive/2012/03/19/372179.htmlhttp://m.tkk7.com/killme2008/comments/372179.htmlhttp://m.tkk7.com/killme2008/archive/2012/03/19/372179.html#Feedback3http://m.tkk7.com/killme2008/comments/commentRss/372179.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/372179.html    开源的memcached Java客户?#8212;—xmemcached发布1.3.6版本?/p>

    主要改进如下Q?/strong> 

1.  为MemcachedClientBuilderd两个新方法用于配|:

public void setConnectTimeout(long connectTimeout);  
public void setSanitizeKeys(boolean sanitizeKeys);

 

2.  用于hibernate的XmemcachedClientFactorydd了connectTimeout属性,感谢|友 Boli.Jiang的A献?/span>

3.  d新的枚Dcd net.rubyeye.xmemcached.transcoders.CompressionModeQ用于指定Transcoder的压~类型,默认是ZIP压羃Q可选择GZIP压羃。Transcoder接口dsetCompressionModeҎ?/p>

4.  修改心蟩规则Q原来是在连接空闲的时候发起心跻I现在变成固定每隔5U发起一ơ心x连接?/p>

5.  修改默认参数Q默认禁用nagle法Q默认将扚wget的合q因子下降到50?/p>

6.  修复bug和改q,包括Q?a target="_blank" style="color: #006699; ">161?a target="_blank" style="color: #006699; ">163?a target="_blank" style="color: #006699; ">165?a target="_blank" style="color: #006699; ">169?a target="_blank" style="color: #006699; ">172?73?a target="_blank" style="color: #006699; ">176?a target="_blank" style="color: #006699; ">179?a target="_blank" style="color: #006699; ">180?/p>

 

目主页Q?a target="_blank" style="color: #006699; ">http://code.google.com/p/xmemcached/

目文Q?a target="_blank" style="color: #006699; ">http://code.google.com/p/xmemcached/w/list

下蝲Q?a target="_blank" style="color: #006699; ">http://code.google.com/p/xmemcached/downloads/list

源码Q?a target="_blank" style="color: #006699; ">https://github.com/killme2008/xmemcached

 

Maven依赖Q?/strong>

 <dependency>  

    <groupId>com.googlecode.xmemcached</groupId>  
    <artifactId>xmemcached</artifactId>  
    <version>1.3.6</version>  
</dependency> 

    最后感谢所有提出issue和改q意见的朋友们?img src ="http://m.tkk7.com/killme2008/aggbug/372179.html" width = "1" height = "1" />

dennis 2012-03-19 10:51 发表评论
]]>
Clojure-Control 0.3.0 is outhttp://m.tkk7.com/killme2008/archive/2012/02/18/370260.htmldennisdennisSat, 18 Feb 2012 14:08:00 GMThttp://m.tkk7.com/killme2008/archive/2012/02/18/370260.htmlhttp://m.tkk7.com/killme2008/comments/370260.htmlhttp://m.tkk7.com/killme2008/archive/2012/02/18/370260.html#Feedback0http://m.tkk7.com/killme2008/comments/commentRss/370260.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/370260.htmlClojure-control is a clojure DSL for system admin and deployment with many remote machines via ssh. 
    
    I am pleased to annoucment that clojure-control 0.3.0 is out.It adds some  powerful features in this release ,includes:
  • ssh and scp both have a new option :sudo  to be executed as root on remote machines,for example:
    (ssh "/etc/init.d/ssh restart" :sudo true)
  • scp has a new  option :mode to change file modes copied from local: 
    (scp "start.sh" "/etc/init.d/start.sh" :sudo true :mode 755)
  • A  new function "exists?" to test if a file exists on remote machines:  
    (if (not (exists? (str "/home/deploy/.ssh")))
          (ssh (sudo (str "mkdir -p /home/deploy/.ssh"))))
  • Call other task in deftask with "call" function:
    (deftask :ps "A task to grep process" [process]
            (ssh (str "ps aux | grep " process)))
    (deftask :start_ha []
            (ssh "/etc/init.d/haproxy start")
            (call :ps "haproxy"))
  • A new function "append" to append a line to a file on remote machines:
    (ssh (append "/etc/hosts" "192.168.1.100 web" :sudo true))
  • A new function "sed" to replace lines in a file on remote machines,and comm/uncomm to comment/uncomment a line in a file:
          (sed <file> <before> <after> :flags <flags> :limit <limit> :backup <backup>)
    

    Equivalent to

          sed -i<backup> -r -e "<limit> s/<before>/<after>/<flags>g <filename>"
  • Limits max output line to 10000.
  • Adds more documents in wiki: https://github.com/killme2008/clojure-control/wiki 
   You can install the new version by :
    lein plugin install control 0.3.0           #For clojure 1.3
    lein plugin install control 0.3.1           #For clojure 1.2

    More information please visit it on github: https://github.com/killme2008/clojure-control


dennis 2012-02-18 22:08 发表评论
]]>
Clojure世界Q?STM的统?/title><link>http://m.tkk7.com/killme2008/archive/2012/02/09/369694.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Thu, 09 Feb 2012 12:55:00 GMT</pubDate><guid>http://m.tkk7.com/killme2008/archive/2012/02/09/369694.html</guid><wfw:comment>http://m.tkk7.com/killme2008/comments/369694.html</wfw:comment><comments>http://m.tkk7.com/killme2008/archive/2012/02/09/369694.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://m.tkk7.com/killme2008/comments/commentRss/369694.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/killme2008/services/trackbacks/369694.html</trackback:ping><description><![CDATA[    q前一blog提过Q写了一个stm-profiler用于l计clojure STM的运行状况,攑֜了github上:<br /> <a >https://github.com/killme2008/stm-profiler</a><br /> <br />    STM的事务在遇到写冲H(多个事务写同一个ref的时候)׃回滚事务q试,通过stm-profiler你可以查看事务的重试ơ数Q重试原因,以及每个reference的用情c用很单,在lein的project.clj引用stm-profiler:<br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #000000; ">[stm-profiler "1.0.2-SNAPSHOT"]</span></div> <br /> 注意Q目前stm profiler仅支持clojure 1.3?br /> <br /> 我们写一个简单例子:<br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #000000;">(use 'stm)<br /> (def a (ref 1))<br /> (def b (ref 2))<br /> <br /> (dotimes [_ 100] (future (dosync (alter a + 1) (alter b - 1))))<br /> (Thread/sleep 1000)<br /> (prn @a)<br /> (prn @b)<br /> (Thread/sleep 1000)<br /> (prn "stm statistics" (stm-stats))<br /> (prn "reference a statistics" (ref-stats a))<br /> (prn "reference b statistics" (ref-stats b))<br /> </span></div> <br /> 定义了两个refQa和bQ然后用future启动100个线Eƈ发地发v同一个事务操作,对a加一Q对b减一。最后打印a和b的|使用stm-stats函数获取stm的统计信息ƈ打印Q用ref-stats获取a和b两个reference的统计信息ƈ打印?br /> <br /> q行q个例子Q在启动的时候会有些警告信息Q忽略即可(主要是因为stm profiler重新定义了一些跟STM相关的函数和宏,如dosync{,但是仅仅是添加了l计功能Qƈ没有修改他们原本的功能)?br /> <br /> 在我机器上的一ơ输出:<br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #000000; ">101<br /> -98<br /> "stm statistics" {"(alter a + 1)(alter b - 1)" {:not-running 11, :average-retry 5, :total-cost 1233, :get-fault 44, :barge-fail 224, :change-committed 227, :total-times 100, :average-cost 12}}<br /> "reference a statistics" {"(alter a + 1)(alter b - 1)" {:alter 609, :get-fault 44, :barge-fail 224, :change-committed 227}}<br /> "reference b statistics" {"(alter a + 1)(alter b - 1)" {:alter 114, :not-running 11}}</span></div> <br /> a和b的结果都没问题。重点看打印的统计信息,(stm-stats)的输出结果是Q?br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> <br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #000000; ">{"(alter a + 1)(alter b - 1)" {:not-running 11, :average-retry 5, :total-cost 1233, :get-fault 44, :barge-fail 224, :change-committed 227, :total-times 100, :average-cost 12}}</span></div> <br /> q个l果是一个map,key是事务的formQ而value是该form的统计信息,也是一个mapQ具体各的含义如下Q?br /> <table bgcolor="#C0C0C0" border="3" bordercolor="#000000" cellpadding="2" cellspacing="2" height="102" width="722"> <tbody> <tr> <td> total-cost<br /> </td> <td> 所有事务的总耗时<br /> </td> <td> 100个事务耗时1233毫秒<br /> </td> </tr> <tr> <td> total-times<br /> </td> <td> 事务q行ơ数<br /> </td> <td> 100?br /> </td> </tr> <tr> <td> average-cost<br /> </td> <td> q_每个事务耗时<br /> </td> <td> q_一个事务耗时12毫秒<br /> </td> </tr> <tr> <td>average-retry<br /> </td> <td>q_每个事务的重试次?/td> <td> q_每个事务重试?ơ才成功</td> </tr> <tr> <td>not-running</td> <td> 当前事务不处于running状态,可能是被其他事务打断Qbarge)Q需要重?/td> <td> 因ؓnot-running的原因重试了11?/td> </tr> <tr> <td>get-fault<br /> </td> <td> dref值的时候没有找到read point之前的|被认为是一ơ读错误Q需要重?br /> </td> <td> 因ؓ读ref错误重试?4?br /> </td> </tr> <tr> <td>barge-fail</td> <td> 打断其他事务p|ơ数Q需要重?/td> <td> 试打断其他事务p|而重试了224?/td> </tr> <tr> <td>change-committed</td> <td> 在本事务read point之后有refD得提交,则需要重?br /> </td> <td> 因ؓrefD其他事务提交而重试了227?/td> </tr> </tbody> </table> <br />     从输出结果来看,q么单的一个事务操作,每次事务要成功^均都需要经q?ơ的重试Q最大的原因是因为ref的值在事务中被其他事务更改了,或者尝试打断其他正在运行的事务p|而重试。关于clojure STM的具体原理推荐看q篇文章?a >Software transactional memory</a>》。STM不是完美的,事务重试和保存每个reference的历史版本的代h都不低?br /><br />    再看<span style="color: #000000;">(ref-stats a)的输出:<br /></span><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">{"(alter a + 1)(alter b - 1)" {:alter 609, :get-fault 44, :barge-fail 224, :change-committed 227}}</span></div>    可以看到a在所有事务中的统计信息,q回的结果同h个mapQkey是用了a的事务,value是具体的l计信息。各的含义cM上表Q不q这里精到了具体的reference。其中alterҎ指对a调用alter函数?09ơ。ref-stats会输出所有在事务中调用了a的函数的调用ơ数?br /><br />    通过stm profiler你可以分析具体每个事务的执行状况Q甚x个reference的运行状况,查找热点事务和热点reference{。stm-profilerq不完善Q目前还不支?.2Q?.4试是可以的Q。希望有兴趣的朋友加入进来一起完善?br /><br />转蝲h明出处:<a id="Editor_Edit_hlEntryLink" title="view: Clojure世界Q?STM的统? href="../archive/2012/02/09/369694.html" target="_blank">http://m.tkk7.com/killme2008/archive/2012/02/09/369694.html</a><img src ="http://m.tkk7.com/killme2008/aggbug/369694.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/killme2008/" target="_blank">dennis</a> 2012-02-09 20:55 <a href="http://m.tkk7.com/killme2008/archive/2012/02/09/369694.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>storm集群的监?/title><link>http://m.tkk7.com/killme2008/archive/2011/12/01/365329.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Thu, 01 Dec 2011 13:02:00 GMT</pubDate><guid>http://m.tkk7.com/killme2008/archive/2011/12/01/365329.html</guid><wfw:comment>http://m.tkk7.com/killme2008/comments/365329.html</wfw:comment><comments>http://m.tkk7.com/killme2008/archive/2011/12/01/365329.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/killme2008/comments/commentRss/365329.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/killme2008/services/trackbacks/365329.html</trackback:ping><description><![CDATA[<br />    所谓兵马未动,_草先行Q准备将<a >storm</a>用在某个目中做实时数据分析。无ZQ何系l,一定要有监控系lƈ存,当故障发生的时候你能第一个知道,而不是让别h告诉你,那处理故障就很被动了?br /><br />    因此我写了这么个目Q取名叫storm-monitorQ放在了github?br /><br />     <a >https://github.com/killme2008/storm-monitor</a><br /><br />    主要功能如下Q?br />1.监控supervisor数目是否正确Q当supervisor挂掉的时候会发送警告?br />2.监控nimbus是否正常q行Qmonitor会尝试连接nimbusQ如果连接失败就认ؓnimbus挂掉?br />3.监控topology是否正常q行Q包括它是否正常部vQ是否有q行中的d?br /><br />    当故障发生的时候通过alarmҎ警告用户Q开攑ևȝ只是单地打日志。因为每个公司的告警接口不一P所以你需要自己扩展,修改alarm.clj卛_。我们这儿就支持旺旺告警和手机短信告警?br /><br />    基本的原理很单,对supervisor和topology的监控是通过zookeeper来间接地监控Q通过定期查看path是否存在。对nimbus的监控是每次起一个短q接q上去,q不上去卌为挂掉?br /><br />    整个目也是用clojure写。你的机器需要安?a >lein</a>?a >exec</a>插gQ然后将你的storm.yaml拯到conf目录下,~辑monitor.yaml讑֮监控参数如检查间隔等Q最后启动start.sh脚本卛_。默认日志输出在logs/monitor.log?br /><img src ="http://m.tkk7.com/killme2008/aggbug/365329.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/killme2008/" target="_blank">dennis</a> 2011-12-01 21:02 <a href="http://m.tkk7.com/killme2008/archive/2011/12/01/365329.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>clj-xmemcached: memcached client for clojurehttp://m.tkk7.com/killme2008/archive/2011/10/30/362315.htmldennisdennisSun, 30 Oct 2011 05:03:00 GMThttp://m.tkk7.com/killme2008/archive/2011/10/30/362315.htmlhttp://m.tkk7.com/killme2008/comments/362315.htmlhttp://m.tkk7.com/killme2008/archive/2011/10/30/362315.html#Feedback0http://m.tkk7.com/killme2008/comments/commentRss/362315.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/362315.html

clj-xmemcached

    Clj-xmemcached is an opensource memcached client for clojure wrapping xmemcached. Xmemcached is an opensource high performance memcached client for java.

Leiningen Usage

To include clj-xmemcached,add:

     [clj-xmemcached "0.1.1"]

to your project.clj.

Usage

Create a client

(use [clj-xmemcached.core])
(def client (xmemcached 
"host:port"))
(def client (xmemcached 
"host1:port1 host2:port2" :protocol "binary"))

Then we create a memcached client using binary protocol to talk with memcached servers host1:port1 and host2:port2. Valid options including:

  :name       Client's name
  :protocol  Protocol to talk with memcached,a string value in text,binary or kestrel,default is text protocol.
  :hash          Hash algorithm,a string value in consistent or standard,default is standard hash.
  :timeout    Operation timeout in milliseconds,default is five seconds.
  :pool          Connection pool size,default is one.

Store items


(xset client "key" "dennis")
(xset client 
"key" "dennis" 100)
(xappend client 
"key" " zhuang")
(xprepend client 
"key" "hello,")

The value 100 is the expire time for the item in seconds.Store functions include xset,xadd,xreplace,xappend and xprepend.Please use doc to print documentation for these functions.

Get items

(xget client "key")
(xget client 
"key1" "key2" "key3")
(xgets client 
"key")

xgets returns a value including a cas value,for example:

  {:value "hello,dennis zhuang", :class net.rubyeye.xmemcached.GetsResponse, :cas 396}

And bulk get returns a HashMap contains existent items.

Increase/Decrease numbers


(xincr client "num" 1)
(xdecr client 
"num" 1)
(xincr client 
"num" 1 0)

Above codes try to increase/decrease a number in memcached with key "num",and if the item is not exists,then set it to zero.

Delete items

(xdelete client "num")

Compare and set

(xcas client "key" inc)

We use inc function to increase the current value in memcached and try to compare and set it at most Integer.MAX_VALUE times. xcas can be called as:

 (xcas client key cas-fn max-times)

The cas-fn is a function to return a new value,set the new value to

(cas-fn current-value)

Shutdown

(xshutdown client)

Flush

(xflush client)
(xflush client (InetSocketAddress. host port))

Statistics

(xstats client)

Example

Please see the example code in example/demo.clj

License

Copyright (C) 2011-2014 dennis zhuang[killme2008@gmail.com]

Distributed under the Eclipse Public License, the same as Clojure.



dennis 2011-10-30 13:03 发表评论
]]>
我写的这些opensource目http://m.tkk7.com/killme2008/archive/2011/10/09/360311.htmldennisdennisSun, 09 Oct 2011 12:23:00 GMThttp://m.tkk7.com/killme2008/archive/2011/10/09/360311.htmlhttp://m.tkk7.com/killme2008/comments/360311.htmlhttp://m.tkk7.com/killme2008/archive/2011/10/09/360311.html#Feedback15http://m.tkk7.com/killme2008/comments/commentRss/360311.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/360311.html    自己在googlecode和github上的所有项目过了一遍,整理一张列表,列下一些还有点价值和用处的项目,都不是什么great jobQ纯_ҎZ工作需要或者乐写的东西,看官要是有兴也可以瞧瞧?br />
 一 Java相关

1.XmemcachedQ还是比较多h使用的一个java memcached clientQ优Ҏ效率和易用性,~点是代码写的不怎么P两年前发展到现在的东西,以后q会l箋l护?br />
2.HS4JQ看handlersocket的时候顺手写的客LQ我们公司内部某些项目在用,可能q有其他公司外的朋友在用Q后来同事聚矌A献了一个扩展项?a >hs4j-kitQ更易于使用Q他写的代码很优雅漂亮,推荐一看。暂时没有精力维护?br />
3.AviatorQ一个很初的表辑ּ执行引擎Q行家看到肯定要W话我。不q语法上很符合我自己的口呻I我们自己的项目在用,也有几个朋友在用Q会l箋l护?br />
4.JeventQ一个玩P其实是模仿libevent的一个java实现Q对nio或者libevent的实现机制感兴趣的还可以看看?br />
5. KilimQ我fork的kilim实现Q修改了nio调度器,使用多个reactor做调度效率更高,q添加了一个HttpClient的实现?br />
?Android目

学习android完全是玩性质Q有3个项目,对初学android开发的可能有点参考h倹{?br />
1.WhetherWeatherQ一个天气预报和告警的widget插gQUI太丑了?br />2.UniqRecorderQ写来记录儿子体重变化的工P可以自定义项目和生成曲线图,我自p在用?br />3.UniqTaskQ最q写的杀q程工具Q绝对轻量Q没q告Q也是我自己在用?br />
?Clojure目

1.cschemeQ一个用clojure实现的scheme解释器,Zsicpq本书的解释器实现?br />2.clojure-controlQ类?a >node-control的分布式部v和管理的DSL实现Q挺好玩的,也有朋友在用Q我自己q用不上,sunny有写了个很方便的lein插gnode-control?br />
clojureq写了一堆烂N目,׃拿出来恶心h了?br />
?其他

1.node-zk-browserQ一个展现和理zookeeper的web应用Q我们自己在用,Znode.js实现?br />2.erlwshQ一个erlang的web shell实现Q可以在览器里做erlang~程Q被一些开源项目比如membase用到了?br />
    写这些东西对我自己最有好处,如果能顺便给他h带来好处Q那是额外的好处。最q正处于我自׃生中也许是最大的转折兛_Q不能更新blog了,最后,求诸天佛能带来奇qV?img src ="http://m.tkk7.com/killme2008/aggbug/360311.html" width = "1" height = "1" />

dennis 2011-10-09 20:23 发表评论
]]>
紧急发布xmemcached 1.3.5http://m.tkk7.com/killme2008/archive/2011/10/01/359898.htmldennisdennisSat, 01 Oct 2011 07:11:00 GMThttp://m.tkk7.com/killme2008/archive/2011/10/01/359898.htmlhttp://m.tkk7.com/killme2008/comments/359898.htmlhttp://m.tkk7.com/killme2008/archive/2011/10/01/359898.html#Feedback6http://m.tkk7.com/killme2008/comments/commentRss/359898.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/359898.html    xmemcached紧急发?.3.5版本Q主要是修复两个相对严重的bug:

Issue 154: 在重q本地memcached的时候,有可能出现重q无法成功的情况Q导致连接丢失,详情?a >q里?br />Issue 155: 重连D文g句柄数超q限制的bugQ这是由于重q失败情况下没有合理关闭socket引v的,详情?a >q里?br />
    如果你用mavenQ简单升U版本即可:
 <dependency>
      
<groupId>com.googlecode.xmemcached</groupId>
      
<artifactId>xmemcached</artifactId>
      
<version>1.3.5</version>
 
</dependency>


    下蝲地址Q?a >http://code.google.com/p/xmemcached/downloads/list

    此版本推荐升U,最后感谢两位老外开发者的帮助Q? ilkinulas?a >MrRubato

dennis 2011-10-01 15:11 发表评论
]]>
UniqTask for androidhttp://m.tkk7.com/killme2008/archive/2011/09/20/359033.htmldennisdennisMon, 19 Sep 2011 20:10:00 GMThttp://m.tkk7.com/killme2008/archive/2011/09/20/359033.htmlhttp://m.tkk7.com/killme2008/comments/359033.htmlhttp://m.tkk7.com/killme2008/archive/2011/09/20/359033.html#Feedback5http://m.tkk7.com/killme2008/comments/commentRss/359033.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/359033.html
    我一直很不爽android的ESd理器,它的q告讄的地斚w常恶心,放在kill键的下面Q而且每次都突然蟩出来Q让你很Ҏ错误点击。我很佩服他们能惛_q种提高点击率的办法Q但是又无比鄙视q种做法。今天(哦,不是昨天Q晚上在twitter上说了,我想自己写个d理器,cMESd理器,q且没有q告。那好吧Q说q就qԌ奋斗了一个晚上,l于搞出了成果,q就是隆重登场的UniqTaskQ先看看q行时截图:



    q是q行在我的GS2上的截图?br />
    UniqTask的功能跟ESd理器的功能完全一_可以记录kill的历Ԍ每次启动UniqTask的时候自动标记过去killq的q程。但是UniqTask完全l色无毒Q绝Ҏ有广告,咔咔?br />
    怹没写androidE序Q拿h来不是很利Q折腑ֈ现在才搞定,我将代码攑ֈ了github上,也提供了APK下蝲Q非常欢q试用啊?br />
    源码地址Q?br />    https://github.com/killme2008/UniqTask
    APK下蝲Q?br />    https://github.com/killme2008/UniqTask/blob/master/UniqTask.apk

    白天q有重要的事情要处理Q睡觉去了?img src ="http://m.tkk7.com/killme2008/aggbug/359033.html" width = "1" height = "1" />

dennis 2011-09-20 04:10 发表评论
]]>
xmemcached发布1.3.4http://m.tkk7.com/killme2008/archive/2011/09/08/358317.htmldennisdennisThu, 08 Sep 2011 10:55:00 GMThttp://m.tkk7.com/killme2008/archive/2011/09/08/358317.htmlhttp://m.tkk7.com/killme2008/comments/358317.htmlhttp://m.tkk7.com/killme2008/archive/2011/09/08/358317.html#Feedback3http://m.tkk7.com/killme2008/comments/commentRss/358317.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/358317.html

    开源的java memcached client—— xmemcached发布1.3.4版本Q主要改q如下:

 

1、修复一个相对严重的bugQ在解析二进制协议时如果遇到从服务端q回的错误信息,会导致连接异常断开Q如果你没有使用binary协议Q不会遇到此问题?strong>使用xmemcachedq且使用二进制协议的朋友升到此版本?/strong>

2、允许XMemcachedClientFactoryBean配置opTimeout选项?

3、添加RoundRobinMemcachedSessionLocatorQ轮询的q接选择器,仅用于kestrel或者memcacheq集群Q这些应用都不要求同一个key要保存在固定的服务器上,而仅是作为集分担负载?/p>

4?a >KetamaMemcachedSessionLocatord额外选项Q允讔R|是否兼?nginx-upstream-consistentQ这个是|友 wolfg1969贡献的patch。如果要使得xmc的一致性哈希算法兼?/span>nginx-upstream-consistentQ只要设|cwNginxUpstreamConsistent为true卛_Q示范代码:

    MemcachedClientBuilder builder = new XMemcachedClientBuilder(  
                    AddrUtil.getAddresses(servers));  
      
    builder.setSessionLocator(
new KetamaMemcachedSessionLocator(  
                    
true)); 

5、修复bugQ包?a class="closed_ref" title="Typo in INFO message: log.info("Creating " + selectorPoolSize + " rectors...");" >issue 132 , issue 142 , issue 133 , issue 139 , issue 142 , issue 145 ,issue 150{?/p>

 

如果你用mavenQ只要简单升U版本即可: 

  <dependency>  
         
<groupId>com.googlecode.xmemcached</groupId>  
         
<artifactId>xmemcached</artifactId>  
         
<version>1.3.4</version>  
    
</dependency> 

下蝲地址Q?/p>

http://code.google.com/p/xmemcached/downloads/list



dennis 2011-09-08 18:55 发表评论
]]>
A clojure DSL for system admin and deployment with many remote machineshttp://m.tkk7.com/killme2008/archive/2011/07/24/354938.htmldennisdennisSun, 24 Jul 2011 13:48:00 GMThttp://m.tkk7.com/killme2008/archive/2011/07/24/354938.htmlhttp://m.tkk7.com/killme2008/comments/354938.htmlhttp://m.tkk7.com/killme2008/archive/2011/07/24/354938.html#Feedback0http://m.tkk7.com/killme2008/comments/commentRss/354938.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/354938.htmlupdate: Allow passing command line arguments to task now.

1.What is clojure-control?

    The idea came from node-control.
    Define clusters and tasks for system administration or code deployment, then execute them on one or many remote machines.
    Clojure-control depends only on OpenSSH and clojure on the local control machine.Remote machines simply need a standard sshd daemon.

2.Quick example

Get the current date from the two machines listed in the 'mycluster'  config with a single command:

     (ns samples
     (:use [control.core :only [task cluster scp ssh begin]]))
     ;;define clusters
     (cluster :mycluster
                 :clients [
                               { :host 
"a.domain.com" :user "alogin"}
                               { :host 
"b.domain.com" :user "blogin"}
                             ])
     ;;define tasks
     (task :date 
"Get date"
              []
              (ssh 
"date"))
    ;;start running
    (begin)

    If saved in a file named "controls.clj",run with   

java -cp clojure.jar:clojure-contrib.jar:control-0.1-SNAPSHOT.jar clojure.main controls.clj mycluster date

    Each machine execute "date" command ,and the output form the remote machine is printed to the console.Exmaple console output

 

    Performing mycluster
    Performing date 
for a.domain.com
    a.domain.com:ssh: date
    a.domain.com:stdout: Sun Jul 
24 19:14:09 CST 2011
    a.domain.com:exit: 
0
    Performing date 
for b.domain.com
    b.domain.com:ssh: date
    b.domain.com:stdout: Sun Jul 
24 19:14:09 CST 2011
    b.domain.com:exit: 
0

    Each line of output is labeled with the address of the machine the command was executed on. The actual command sent and the user used to send it is displayed. stdout and stderr output of the remote process is identified as well as the final exit code of the local ssh command.


3.How to scp files?
    Let's define a new task named deploy

  (task :deploy "scp files to remote machines"
        []
        (scp (
"release1.tar.gz" "release2.tar.gz""/home/alogin/"))

    Then it will copy release1.tar.gz and release2.tar.gz to remote machine's /home/alogin directory.

4.Where is it?

    It's on github,https://github.com/killme2008/clojure-control

    Any suggestion or bug reports welcomed.

dennis 2011-07-24 21:48 发表评论
]]>
轻量U高性能的表辑ּ求值器——aviator发布2.0http://m.tkk7.com/killme2008/archive/2011/07/13/354296.htmldennisdennisWed, 13 Jul 2011 14:34:00 GMThttp://m.tkk7.com/killme2008/archive/2011/07/13/354296.htmlhttp://m.tkk7.com/killme2008/comments/354296.htmlhttp://m.tkk7.com/killme2008/archive/2011/07/13/354296.html#Feedback0http://m.tkk7.com/killme2008/comments/commentRss/354296.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/354296.html 

    aviator是一个轻量的、高性能的Java表达式求值器Q主要应用在如工作流引擎节点条g判断、MQ中的消息qo以及某些特定的业务场景?/p>

    自从上次发布1.0后,q发q?.01版本Q不q都没怎么宣传。这ơ发布一?.0的里E碑版本Q主要改q如下:


1、完整支持位q算W,与java完全一致。位预算W对实现bit set之类的需求还是非常必ȝ?

2、性能优化Q^均性能提升100%Q函数调用性能提升200%Q最新的与groovy和JEXL的性能试看这?/p>

http://code.google.com/p/aviator/wiki/Performance

3、添加了新函敎ͼ包括long、double、str用于cd转换Q添加了string.indexOf函数?/p>

4、完善了用户手册Q更新性能试?/p>

 

下蝲地址Q?nbsp; http://code.google.com/p/aviator/downloads/list

目主页Q?nbsp; http://code.google.com/p/aviator/

用户指南Q?nbsp; http://code.google.com/p/aviator/w/list

性能报告Q?nbsp; http://code.google.com/p/aviator/wiki/Performance

源码Q?nbsp;         https://github.com/killme2008/aviator

 

Maven引用Q感谢许老大的帮助)Q?/p>

    <dependency>
            
<groupId>com.googlecode.aviator</groupId>
            
<artifactId>aviator</artifactId>
                        
<version>2.0</version>
    
</dependency>

     q个目目前用在我们的MQ产品中做消息qoQ也有几个公司外的用户告诉我他们也在用,不过估计不会很多。有q种需求的场景q是比较的。这个项目实际上是ؓ我们的MQ定制的,我主要想做到q么几点Q?/p>

Q?Q控制用戯够用的函数Q不允许调用M不受控制的函数?/p>

Q?Q轻量Q不需要嵌入groovyq么大的脚本引擎Q我们只需要一个剪裁过的表辑ּ语法卛_?/p>

Q?Q高性能Q最l的性能在某些场景比groovy略差Q但是已l非常接q?/p>

Q?Q易于扩展,可以Ҏ地添加函数扩展功能。语法相对固定?/p>

Q?Q函数的调用避免使用反射。因此没使用dotq算W的函数调用方式Q而是更类似c语言和lua语言的函数调用风根{函数是一{公民,seq库的风格很符合我的喜好?/p>

  seqq概忉|自clojureQ我实Cjava.util.Collection接口的类和数l都UCؓseq集合Q可以统一使用seq库操作。例如假设我有个list:

        Map<String, Object> env = new HashMap<String, Object>();
        ArrayList
<Integer> list = new ArrayList<Integer>();
        list.add(
3);
        list.add(
100);
        list.add(
-100);
        env.put(
"list", list);

   可以做这么几个事情,度量大小Q?br />
count(list)
   判断元素是否存在Q?br />
include(list,3)
   qo元素Q返回大?的元素组成的seqQ?br />
filter(list,seq.gt(0))
   寚w合里的元素求和,应用reduce:
reduce(list,+,0)
   遍历集合元素q打华ͼ
map(list,println)
   最后,你还可以排序:
sort(list)

    q些函数cMFP里的高阶函数Q用v来还是非常爽的?br />
    对函数调用的优化Q其实只q了一个事情,原来函数调用我是所有参数收集到一个list里面Q然后再转成数组元素交给AviatorFunction调用。这里创Z两个临时对象Qlist和数l。这其实是没有必要的Q我只要在AviatorFunction里定义一pd重蝲ҎQ如Q?br />
   public AviatorObject call(Map<String, Object> env);


    
public AviatorObject call(Map<String, Object> env, AviatorObject arg1);


    
public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2);


    
public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3);

    

   ׃需要收集参敎ͼ而是直接invokeinterface调用AviatorFunction相应的重载方法即可。我看到在JRuby和Clojure里的Ҏ调用都这样干的。过ȝ思\走岔了。最l也不需要区分内部的method和外部的functionQ统一Z个对象即可,q一步减了对象创徏的开销?img src ="http://m.tkk7.com/killme2008/aggbug/354296.html" width = "1" height = "1" />

dennis 2011-07-13 22:34 发表评论
]]>
Java NIO~程的技巧和陷阱http://m.tkk7.com/killme2008/archive/2011/06/30/353422.htmldennisdennisThu, 30 Jun 2011 03:07:00 GMThttp://m.tkk7.com/killme2008/archive/2011/06/30/353422.htmlhttp://m.tkk7.com/killme2008/comments/353422.htmlhttp://m.tkk7.com/killme2008/archive/2011/06/30/353422.html#Feedback4http://m.tkk7.com/killme2008/comments/commentRss/353422.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/353422.html d做的分nQ一直上传slidesharep|Q今天又试了下,成功了。这个主题主要介lJava NIO~程的技巧和陷阱Q解M一些NIO框架的源码,以及~写高性能NIO|络框架所需要注意的技巧和~陷。关注这斚w的朋友可以看一下。去q写了篇blog提供了pdf版本的下载,?a href="http://m.tkk7.com/killme2008/archive/2010/11/22/338420.html">q里?br />


dennis 2011-06-30 11:07 发表评论
]]>
xmemcached发布1.3.3版本——支持touch和GAThttp://m.tkk7.com/killme2008/archive/2011/06/12/352120.htmldennisdennisSun, 12 Jun 2011 05:32:00 GMThttp://m.tkk7.com/killme2008/archive/2011/06/12/352120.htmlhttp://m.tkk7.com/killme2008/comments/352120.htmlhttp://m.tkk7.com/killme2008/archive/2011/06/12/352120.html#Feedback2http://m.tkk7.com/killme2008/comments/commentRss/352120.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/352120.htmlxmemcached发布1.3.3Q主要改q如下:

1、memcached 1.6d了不新Ҏ,具体可以参考《what's new in memcached?1) (2)q两个帖子。xmemcached及时跟q这些新Ҏ?.3.3q个版本实现了二q制协议中新的两个命令touch和GATQget and touch)。这两个功能可以说是千呼万唤始出来,l于可以不用get-set来重新设|数据的时旉Q利用touch或者GAT可以单地更新数据的超时时间?.3.3新增加四个方法:
    public boolean touch(final String key, int exp, long opTimeout)
            
throws TimeoutException, InterruptedException, MemcachedException;
    
public boolean touch(final String key, int exp) throws TimeoutException,
            InterruptedException, MemcachedException;
        
public <T> T getAndTouch(final String key, int newExp, long opTimeout)
            
throws TimeoutException, InterruptedException, MemcachedException;
    
public <T> T getAndTouch(final String key, int newExp)
            
throws TimeoutException, InterruptedException, MemcachedException;

其中touch用于讄数据新的时旉QgetAndTouch则是在获取数据的同时更新时旉。例如用memcached存储sessionQ可以在每次get的时候更C数据的超时时间来保活?strong>h意,q四个方法仅在用memcached 1.6q且使用二进制协议的时候有?/strong>?br />
2、setLoggingLevelVerbosityҎ可以作用于二q制协议?/strong>

3、重构错误处理模块,使得异常信息更友好?/strong>

4、将KeyIterator和getKeyIterator声明为deprecatedQ?/strong>因ؓmemached 1.6移除stats cachedump协议Qƈ且stats cachedumpq回数据有大限Ӟ遍历功能不具实用性?br />
5、修复BugQ包?a title="Error getting memcached Detail Statistics" class="closed_ref" >issue 126 ,issue 127,issue 128,issue 129?br />
下蝲地址Q?a >http://code.google.com/p/xmemcached/downloads/list
源码Q?nbsp; https://github.com/killme2008/xmemcached
maven引用Q?br />
 <dependency>
      
<groupId>com.googlecode.xmemcached</groupId>
      
<artifactId>xmemcached</artifactId>
      
<version>1.3.3</version>
 
</dependency>


dennis 2011-06-12 13:32 发表评论
]]>
Zookeeper的web理应用http://m.tkk7.com/killme2008/archive/2011/06/06/351793.htmldennisdennisSun, 05 Jun 2011 17:13:00 GMThttp://m.tkk7.com/killme2008/archive/2011/06/06/351793.htmlhttp://m.tkk7.com/killme2008/comments/351793.htmlhttp://m.tkk7.com/killme2008/archive/2011/06/06/351793.html#Feedback2http://m.tkk7.com/killme2008/comments/commentRss/351793.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/351793.htmlhttps://github.com/killme2008/node-zookeeper

    我们已经开始在产品使用zookeeper了,那么l护工具也必焉要,所谓兵马未动,_草先行。请同事帮忙看过几个开源项目后Qƈ没有特别让h满意的?br />    我想要的功能比较单。首先,希望能将zookeeper集群的数据展CZؓ树Şl构Q跟zookeeper模型保持一致。可以逐步展开每层的节点,每次展开都是延迟加蝲从zk里取数据Q这样不会对zk造成太大压力。其ơ,除了展示树Şl构外,我还希望它能展示每个path的属性和数据Q更q一步,如果数据是文本的Q我希望它可~辑。当Ӟ因ؓ~辑功能是比较危险的行ؓQ我q希望这个管理工h个简单的授权验证机制?br />
    最l,我自己写了这么个东西Q取名ؓnode-zk-browserQ基于node.js?a >express.js框架?a >node-zookeeper客户端实现的。我它攑֜了github?br />
    https://github.com/killme2008/node-zk-browser

    你可以自己搭个小appQ?npm几乎能帮你搞定大部分工作。界面不观Q实用ؓ主,几张q行时截?br />








dennis 2011-06-06 01:13 发表评论
]]>
node-leveldb的memcached adapterhttp://m.tkk7.com/killme2008/archive/2011/05/31/351447.htmldennisdennisTue, 31 May 2011 08:45:00 GMThttp://m.tkk7.com/killme2008/archive/2011/05/31/351447.htmlhttp://m.tkk7.com/killme2008/comments/351447.htmlhttp://m.tkk7.com/killme2008/archive/2011/05/31/351447.html#Feedback1http://m.tkk7.com/killme2008/comments/commentRss/351447.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/351447.htmlleveldb是google最q开源的一个实玎ͼ但是它仅是个libQ还需要包装才能用?a >node-leveldb是一个用node.js包装leveldb的项目,你可以用javascript讉Kleveldb?a >node-leveldb仅提供APIQ不提供|络接口供外部访问。我fork了个分支Q搞了个memcached的adapterQ将node-leveldb的API暴露为memcached的文本协议,q样一来你可以直接用现有的memcached client甚至直接telnet上去q行试。感兴趣的朋友可以测试下。adpater׃个文?a >memcached.js?br />    
    fork的分支在Q?br />    https://github.com/killme2008/node-leveldb

    ~译node-leveldb之后Q执?br />
node memcached-adpater/memcached.js

    卛_启动memcached adapter?1211端口Q你可以telnet上去试。目前仅支持get/set/delete/quit协议Q不支持flag和exptime?br />

dennis 2011-05-31 16:45 发表评论
]]>
HandlerSocket client for java——hs4j正式发布0.1版本http://m.tkk7.com/killme2008/archive/2011/03/29/347160.htmldennisdennisMon, 28 Mar 2011 22:55:00 GMThttp://m.tkk7.com/killme2008/archive/2011/03/29/347160.htmlhttp://m.tkk7.com/killme2008/comments/347160.htmlhttp://m.tkk7.com/killme2008/archive/2011/03/29/347160.html#Feedback3http://m.tkk7.com/killme2008/comments/commentRss/347160.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/347160.html
    HandlerSocket是一个mysql插gQ可以将mysql作ؓNoSQL来用,具体可以看我q去写的q篇Blog?a >hs4j是HandlerSocket的一个java客户端,自认为它比日本h写的那个客户端更实用和易用一些。写完好久,l过不少朋友使用和测试,现在正式发一?.1版本Qƈ已同步到maven中心仓库?br />
    目主页Q?a title="http://code.google.com/p/hs4j/" >http://code.google.com/p/hs4j/
    目描述Qhs4j is a practical java client for HandlerSocket,it is nio based and turned to get better performance.
    使用文档Q?a >http://code.google.com/p/hs4j/w/list
    下蝲地址Q?a title="http://code.google.com/p/hs4j/downloads/list" >http://code.google.com/p/hs4j/downloads/list
    源码仓库Q?a rel="nofollow">https://github.com/killme2008/hs4j

     如果你用maven2Q可以直接引用:
<dependency>
  
<groupId>com.googlecode.hs4j</groupId>
  
<artifactId>hs4j</artifactId>
  
<version>0.1</version>
</dependency>

     有疑问和bug误pL?br />

dennis 2011-03-29 06:55 发表评论
]]>
xmemcached发布1.3.2版本http://m.tkk7.com/killme2008/archive/2011/03/27/347102.htmldennisdennisSun, 27 Mar 2011 06:06:00 GMThttp://m.tkk7.com/killme2008/archive/2011/03/27/347102.htmlhttp://m.tkk7.com/killme2008/comments/347102.htmlhttp://m.tkk7.com/killme2008/archive/2011/03/27/347102.html#Feedback1http://m.tkk7.com/killme2008/comments/commentRss/347102.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/347102.html     Xmemcached是一个开源的java memcached clientQ具有高性能、更易用、功能完善等优点Q距Mơ发?.3.1已经过两个月,现在正式发布1.3.2q个新版本,主要的改q如下:


1、Bug修复Q从1.3.1版本以来发现的bugq修复,包括Q?

issue 112:: 新引入的failure模式在启动的时候,如果memcached故障Q运行不W合预期的bug.

issue 113: 新增加一个deleteҎQ可以设|操作超?/p>

public boolean delete(final String key, long opTimeout)
            
throws TimeoutException, InterruptedException, MemcachedException;

2、性能调优Q存储操?set/add/replace/prepend/append/cas)的性能提升5%?/p>

3、修复pom.xmlQ得xmemcached可以在其他机器上~译?/p>

4、用github作ؓ源码仓库Q版本管理用git替换svnQ源码{Ud

      https://github.com/killme2008/xmemcached

新版本下载地址Q?/p>     http://code.google.com/p/xmemcached/downloads/list

使用maven可以直接引用Q?nbsp;

<dependency>
      <groupId>com.googlecode.xmemcached</groupId>
      
<artifactId>xmemcached</artifactId>
      
<version>1.3.2</version>
 
</dependency>

目文Q?/p>

http://code.google.com/p/xmemcached/w/list



dennis 2011-03-27 14:06 发表评论
]]>
Scheme interpreter in clojurehttp://m.tkk7.com/killme2008/archive/2011/01/24/343423.htmldennisdennisMon, 24 Jan 2011 02:42:00 GMThttp://m.tkk7.com/killme2008/archive/2011/01/24/343423.htmlhttp://m.tkk7.com/killme2008/comments/343423.htmlhttp://m.tkk7.com/killme2008/archive/2011/01/24/343423.html#Feedback0http://m.tkk7.com/killme2008/comments/commentRss/343423.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/343423.html
Feature Supported Comment
define yes
lambda yes
variable lookup yes
primitive procedure evaluation yes
compound procedure evaluation yes no tail recursion yet
if yes
cond yes
let yes

let* yes
no named let* yet
letrec no
begin yes

set! yes

quote yes
quasiquote no
unquote no
delay no
define-syntax no

       支持的primitive procedure包括常见的四则运、car/cdr、list以及display、newline{。代码放在了github上:https://github.com/killme2008/cscheme,有兴的可以玩玩吧?br />

dennis 2011-01-24 10:42 发表评论
]]>
Xmemcached 1.3.0正式发布http://m.tkk7.com/killme2008/archive/2011/01/04/342287.htmldennisdennisTue, 04 Jan 2011 12:10:00 GMThttp://m.tkk7.com/killme2008/archive/2011/01/04/342287.htmlhttp://m.tkk7.com/killme2008/comments/342287.htmlhttp://m.tkk7.com/killme2008/archive/2011/01/04/342287.html#Feedback0http://m.tkk7.com/killme2008/comments/commentRss/342287.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/342287.htmlXmemcached是一个开源的memcached的Java客户端,最q引入了一些关键特性,因此版本L接从1.2.6.2升?.3.0。主要的更改如下Q?br />

1、引入了failure模式Q所谓failure模式是指在当一个memcached׃各种原因不可用的情况下,发往q个节点的请求将直接抛出异常Q而非使用下一个可用的节点。具体可以看memached?a >q个文档。默认不启用Q启用failure模式很简单:

MemcachedClientBuilder builder=……
//启用failure模式?/span>
builder.setFailureMode(true);

也可以采用spring配置?br />

2、在启用failure模式的情况下Q允ؓ每个memcached讄一个备份节点,当主节点挂掉的情况下Q会请求{交给备䆾节点Q主节点恢复后又自动切换C节点。请注意Q要讄备䆾节点的前提是启用failure模式。假设我们已l有两个memcached节点Qhost1:port和host2:portQؓhost1:port讄一个备份节点host3:port可以实现为:
MemcachedClientBuilder builder=new XmemcachedClientBuilder(AddrUtil.getAddressMap("host1:port,host3:port host2:port"))
……

d节点之间用逗号隔开Q不同分l之间用I格隔开Q完全兼?.2。ƈ且当备䆾节点q接意外断开的情况下Qxmemcached也会自动修复备䆾节点的连接ƈ加入映射?br />

关于failure模式和standby节点更多内容可以参?a href="http://m.tkk7.com/killme2008/archive/2010/12/28/341731.html">q篇blog.

3、修正BUG和新功能Q包?a >issue 104,issue 105,issue 107{?br />

目主页 http://code.google.com/p/xmemcached/

下蝲地址 http://code.google.com/p/xmemcached/downloads/list

用户指南 http://code.google.com/p/xmemcached/wiki/TableOfContents

     如果你用maven构徏Q可以直接引用:

<dependency>
<groupId>com.googlecode.xmemcached</groupId>
<artifactId>xmemcached</artifactId>
<version>1.3.1</version>
</dependency>


    更新Q发?.3.1了,如果你还在?.3.0Q徏议升U?.3.0因ؓ改变了memcached地址服务器顺序,可能D原有的缓存失效?br />




dennis 2011-01-04 20:10 发表评论
]]>
Xmemcached 1.3预览Qfailure模式和standby节点http://m.tkk7.com/killme2008/archive/2010/12/28/341731.htmldennisdennisTue, 28 Dec 2010 02:47:00 GMThttp://m.tkk7.com/killme2008/archive/2010/12/28/341731.htmlhttp://m.tkk7.com/killme2008/comments/341731.htmlhttp://m.tkk7.com/killme2008/archive/2010/12/28/341731.html#Feedback5http://m.tkk7.com/killme2008/comments/commentRss/341731.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/341731.html     Xmemcached在元旦左叛_备发1.3q个版本Q这个版本新增加的一个关键特性就是所谓的failure模式。关于这个,可以看下memcached官方文的解?br />            XMemcachedClientBuilder builder =……
               
//讄使用failure模式
           builder.setFailureMode(true);       在此模式下,某个节点挂掉的情况下Q往q个节点的请求都直接抛出MemcachedException的异常?br />
      不仅如此Qxmemcached 1.3q将引入standby node的概念,你可以设|某个memached节点的备份节点,当这个节Ҏ掉的时候会请求{发给q个备䆾节点Q不会简单地抛出异常Q也不会转发l其他节炏V要使用standby nodeQ必首先设|用failure modeQ一个例子:

XMemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil
                .getAddressMap(
"192.168.1.99:11211,192.168.1.100:11211 192.168.1.101:11211,192.168.1.102:11211"));
builder.setFailureMode(
true);

     可以看到Q新的服务器字符串格式变化ؓhost:port,host:port host:port,host:port的格式,以空格隔开的是两个节点l成的一个分l,以逗号隔开的是主节点和备䆾节点Q以上面的例子来_我们讄客户端用的节点?92.168.1.99?92.168.1.101Q其?9对应的备份节Ҏ100Q?01的备份节Ҏ102。ƈ且我们需要设|用failure mode为true?br />    
     Failure mode加上standby节点可以比较好的解决新旧数据的问题,q且也可以防止请求穿透缓存到DBQ但是主备两个节点之间的数据同步Qxmemcached不准备帮你做Q我的徏议是可以使用repcachedq个patch做复制?br />     有的朋友可能希望Q在使用备䆾节点之前先flush掉备份节点的数据Q防止用到老的数据Q请求还是可以穿透缓存去DB查找Qƈ存储到备份节点,我仔l考虑了这个方案,衡量之下q是不准备做自动flushQ主要是q发上很隑֤理,q且flush数据q个事情可以手工来搞Q根据我的经验,做的太透明太自动不一定是好事。你可以在主节点恢复之后Q手工flush下备份节点的数据?br />

    目前Qxmemcached 1.3已经整装待发Q对q些Ҏ有兴趣的朋友可以先?a >svn下蝲?/a>码尝鲜,有Q何改q的请发邮gl我。我的邮件地址在博客的右上角?br />




  


dennis 2010-12-28 10:47 发表评论
]]>
HandlerSocket client for java——MySql as NoSQLhttp://m.tkk7.com/killme2008/archive/2010/11/30/339386.htmldennisdennisTue, 30 Nov 2010 05:51:00 GMThttp://m.tkk7.com/killme2008/archive/2010/11/30/339386.htmlhttp://m.tkk7.com/killme2008/comments/339386.htmlhttp://m.tkk7.com/killme2008/archive/2010/11/30/339386.html#Feedback4http://m.tkk7.com/killme2008/comments/commentRss/339386.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/339386.html     HandlerSocket是日本h akira higuchi 写的一个MySql的插Ӟ通过q个插gQ你可以直接跟MySql后端的存储引擎做key-value式的交互Q省MMySql上层的SQL解释、打开关闭表、创建查询计划等CPU消耗型的开销Q按照作者给出的数据可以在数据全部在内存的情况下可以辑ֈ75W的QPS查询。具体信息可以看q篇BlogQ中文介l可以看q篇文章?a >HandlerSocket in action》?br />
    q个东西Z么让我很Ȁ动呢Q首先性能是程序员的G点,一听高性能你不由地Ȁ动,其次Q这也解决了~存跟数据库的一致性问题,因ؓ~存在数据库里面,W三Q这个东西不仅仅是NoSQLQ简单的CRUD你可以通过HandlerSocketQ但是复杂的查询你仍然可以走MySqlQ完全符合我们应用的场景Qƈ且从实际试来看Q性能实非常优秀。但是呢Q这个东西的代h也少不了Q例如没有权限检查(未来可能dQ;不能启用MySql的查询缓存,否则会导致数据的不一_协议设计也不合理Q用\t做分隔符Q用\n做换行符Q那么你插入或者更新的字段数据׃能含有这些字W,否则行ؓ不如预期?/strike>

   HandlerSocket有一个日本h的java客户端实玎ͼ我去试了下Q结果发现这玩意完全不具实用性,装的层ơ非常原始。因此我自己写了个新的客LQ这是本文要介l的HandlerSocket Client for JavaQ简U?a >hs4jQ项目放在了googlecodeQ代码的|络层复用xmemcachedQ重新实C协议和上层接口,目前的状态完全可用,也希望有需要的朋友参与试?br />
   目地址Q?a >http://code.google.com/p/hs4j/

    HS4J的用很单,所有的操作都通过HSClientq个接口q行Q如我们创徏一个客L对象Q?br />
import com.google.code.hs4j.HSClient;
import com.google.code.hs4j.impl.HSClientImpl;

   HSClient hsClient 
= new HSClientImpl(new InetSocketAddress(9999));

   假设HandlerSocketq行在本地的9999端口Q默认的9998是只ȝQ?999才是允许d写。HSClient是线E安全的?br />
   在执行操作前需要先open indexQ?br />
import com.google.code.hs4j.IndexSession;

      IndexSession session 
= hsClient.openIndexSession(db, table,
                                
"PRIMARY", columns);

   其中db是数据库?table是表名,"PRIMARY"表示使用主键索引Qcolumns是一个字W串数组代表你要查询的字D名U。这里没有指定indexidQ默认会产生一个indexidQ你也可以指定indexidQ返回表CZơopen-index会话对象QIndexSession同样是线E安全的?br />
IndexSession session = hsClient.openIndexSession(indexid,db, table,
                                
"PRIMARY", columns);

   查询操作通过findҎ:
import java.sql.ResultSet;

                
final String[] keys = { "dennis""killme2008@gmail.com" };
                ResultSet rs 
= session.find(keys);
                
while(rs.next()){
                   String name
=rs.getString(1);
                   String mail
=rs.getString(2);
                }

   findq回的是java.sql.ResultSetQ你完全可以像用jdbc那样L作结果集。当然我的简单实现ƈ不符合JDBC规范Q只实现了最常见的一些方法,如getStrng、getLong{。find(keys)Ҏ默认使用的op?="。其他重载方法可以设|其他类型的opQ统一装为枚丄型FindOperator?br />
   更新操作Q?br />
import com.google.code.hs4j.FindOperator;

   
int result=session.update(keys, new String[] { "1""dennis",
                                
"test@163.com""109" }, FindOperator.EQ);

   keys表示索引的字D列表对应的值数l,通过FindOperator.EQ比较q些值和索引Q第二个参数values表示要更新的字段|q些D你在open-index的时候传入的columns一一对应Q最后返回作用的记录数?br />
    删除操作Q?br />
   int result= session.delete(new String[] { "dennis" },
                                FindOperator.EQ)

    HS4J同样支持q接池,可以在构建客L的时候传入连接池大小Q?br />
  //100-connections pool
   HSClient hsClient = new HSClientImpl(new InetSocketAddress(9999),100);

   在open index的时候,会在q接池里所有的q接上都open。ƈ且在q接因ؓ意外情况Q如|络错误Q断开的时候,HS4J会自动重q,q在重连成功的情况下自动发送已lopen的indexQ保证应用的操作不受重连影响?br />
    因ؓHS4J是我在两天内写就的一个东西,可能q有不少隐藏的bugQƈ且HandlerSocket本n也是个新东西Q如果有什么问题或者改q徏议,随时Ƣ迎告诉我,多谢?br />

  
  



dennis 2010-11-30 13:51 发表评论
]]>
Java NIO trick and traphttp://m.tkk7.com/killme2008/archive/2010/11/22/338420.htmldennisdennisMon, 22 Nov 2010 10:22:00 GMThttp://m.tkk7.com/killme2008/archive/2010/11/22/338420.htmlhttp://m.tkk7.com/killme2008/comments/338420.htmlhttp://m.tkk7.com/killme2008/archive/2010/11/22/338420.html#Feedback18http://m.tkk7.com/killme2008/comments/commentRss/338420.htmlhttp://m.tkk7.com/killme2008/services/trackbacks/338420.html      上周在内部做的一个Java NIO框架的实现技巧和陷阱的分享,对编写NIO|络框架有兴的朋友可能有点帮助Q上传slideshare.net一直出错,直接提供下蝲吧?br />     
     下蝲地址Q?a href="http://m.tkk7.com/Files/killme2008/NIO%20trick%20and%20trap.pdf.zip">Nio Trick and Trap.pdf.zip







dennis 2010-11-22 18:22 发表评论
]]>
对kilim nio模块的改q?/title><link>http://m.tkk7.com/killme2008/archive/2010/11/19/338504.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Fri, 19 Nov 2010 10:40:00 GMT</pubDate><guid>http://m.tkk7.com/killme2008/archive/2010/11/19/338504.html</guid><wfw:comment>http://m.tkk7.com/killme2008/comments/338504.html</wfw:comment><comments>http://m.tkk7.com/killme2008/archive/2010/11/19/338504.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://m.tkk7.com/killme2008/comments/commentRss/338504.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/killme2008/services/trackbacks/338504.html</trackback:ping><description><![CDATA[<br />     前段旉对kilim的当前版本做了一些改q,集中在nio调度器这一块。Kilim新版本引入了nio调度器,可以跟非dIOl合在一P从这个版本开始,kilim才真正具有实用性。协E只有跟非阻塞IOl合h才能发挥威力啊。但是Kilim的默认的nio调度器还只是使用一个nio worker做调度,q跟现有的NIO框架采用多个nio worker来提升效率比较v来相对落伍。我改进?a >NioSelectorScheduler</a>Q引入了cMNetty3的boss和woker的概念,boss负责q接接入Q而worker负责q接的IOdQƈ且默认设|worker数目为CPU个数的两倍。经q我的测试,改进后的NIO调度器的效率q远过了现有的调度器,有兴可以用netty的benchmark跑一下example里的<a title="EchoServer" >EchoServer</a>?br /> <br />     Kilim默认q提供了一个简易Http Server框架Q但是没有提供Http Client的实玎ͼ我的另一个改q是提供了一个简易的Http Client实现Q也是利用Ragel做协议解析,一个简单的使用例子如下Q?br /> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #0000ff;">package</span><span style="color: #000000;"> kilim.examples;<br /> <br /> </span><span style="color: #0000ff;">import</span><span style="color: #000000;"> kilim.Pausable;<br /> </span><span style="color: #0000ff;">import</span><span style="color: #000000;"> kilim.Task;<br /> </span><span style="color: #0000ff;">import</span><span style="color: #000000;"> kilim.http.HttpClient;<br /> </span><span style="color: #0000ff;">import</span><span style="color: #000000;"> kilim.http.HttpResponse;<br /> <br /> <br /> </span><span style="color: #0000ff;">public</span><span style="color: #000000;"> </span><span style="color: #0000ff;">class</span><span style="color: #000000;"> SimpleHttpClient {<br />     </span><span style="color: #0000ff;">static</span><span style="color: #000000;"> </span><span style="color: #0000ff;">class</span><span style="color: #000000;"> SimpleTask </span><span style="color: #0000ff;">extends</span><span style="color: #000000;"> Task {<br />         @Override<br />         </span><span style="color: #0000ff;">public</span><span style="color: #000000;"> </span><span style="color: #0000ff;">void</span><span style="color: #000000;"> execute() </span><span style="color: #0000ff;">throws</span><span style="color: #000000;"> Pausable, Exception {<br />             HttpClient client </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">new</span><span style="color: #000000;"> HttpClient();<br /> <br />             HttpResponse resp </span><span style="color: #000000;">=</span><span style="color: #000000;"> client.get(</span><span style="color: #000000;">"</span><span style="color: #000000;">http://www.google.com.hk/</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br />             System.out.println(resp.status());<br />             System.out.println(resp.content());<br />         }<br />     }<br /> <br /> <br />     </span><span style="color: #0000ff;">public</span><span style="color: #000000;"> </span><span style="color: #0000ff;">static</span><span style="color: #000000;"> </span><span style="color: #0000ff;">void</span><span style="color: #000000;"> main(String[] args) {<br />         SimpleTask task </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">new</span><span style="color: #000000;"> SimpleTask();<br />         task.start();<br />     }<br /> <br /> }<br /> </span></div> <br /> <br />     q个陋的HttpClient目前只支持GET/POSTQ同时支持Http chunk~码Q得益于kilim原有代码Q,做一些简单的HTTP调用已经_。我试在一个项目里使用q个HttpClientL代java默认的HttpURLConnectionQ效率有部分提升Q但是同时由于大量协E存在占用了很大部分的内存,lGC也带来了不小的压力?br /> <br />     我的代码直接从kilim的主qfork出来Q有兴趣可以直接git clone下来玩玩,地址 <a title="https://github.com/killme2008/kilim" > https://github.com/killme2008/kilim</a><br /><img src ="http://m.tkk7.com/killme2008/aggbug/338504.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/killme2008/" target="_blank">dennis</a> 2010-11-19 18:40 <a href="http://m.tkk7.com/killme2008/archive/2010/11/19/338504.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://m.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> վ֩ģ壺 <a href="http://gzjing365.com" target="_blank">av뾫ƷϼӰ </a>| <a href="http://www-091w.com" target="_blank">޹һ</a>| <a href="http://gxshenquan.com" target="_blank">޹Ʒպav</a>| <a href="http://yulongfilm.com" target="_blank">91߲</a>| <a href="http://9156892.com" target="_blank">޸mv</a>| <a href="http://wwkk3.com" target="_blank">Ʒһʽֱ</a>| <a href="http://djllgs.com" target="_blank">޻ɫ߹ۿƵ</a>| <a href="http://www9k832.com" target="_blank">ëƬһAPP</a>| <a href="http://zaideqin.com" target="_blank">޹Ѽһ</a>| <a href="http://zzmm88.com" target="_blank">þ99ྫƷѹۿ</a>| <a href="http://jst-hosp.com" target="_blank">ÿ޻ɫ</a>| <a href="http://dukane1688.com" target="_blank">Ʒһ24Ƶ</a>| <a href="http://cn-taoqigui.com" target="_blank">޳AVƬ߹ۻ</a>| <a href="http://mp4888.com" target="_blank">Ļһ</a>| <a href="http://wo93xyz.com" target="_blank">޾ƷƬ</a>| <a href="http://yuyang0752.com" target="_blank">Ʒѹۿ</a>| <a href="http://av56cc.com" target="_blank">ۺ߳һ</a>| <a href="http://yw835.com" target="_blank">91ֻƬ</a>| <a href="http://yw5168.com" target="_blank">޾Ʒ</a>| <a href="http://llyysp.com" target="_blank">ձһձһ岻</a>| <a href="http://gyjinzheng.com" target="_blank">AVɫ߹ۿ </a>| <a href="http://118762.com" target="_blank">Aһ</a>| <a href="http://c2277.com" target="_blank">Ʒާv벥</a>| <a href="http://dstbxg.com" target="_blank">պƷһůů</a>| <a href="http://gbn21.com" target="_blank">ƵС˵ͼƬ</a>| <a href="http://hzsprfm.com" target="_blank">ҹɫƵվ</a>| <a href="http://linmh.com" target="_blank">ѸԴվƵ</a>| <a href="http://eddiekidd.com" target="_blank">͵͵ͼƬ</a>| <a href="http://yctbhb.com" target="_blank">þó˹Ʒ</a>| <a href="http://519vip.com" target="_blank">ձ</a>| <a href="http://mangaou.com" target="_blank">߹ۿһ</a>| <a href="http://jisuanq.com" target="_blank">Ƶ߹ۿ</a>| <a href="http://ee45987.com" target="_blank">ձvaһ</a>| <a href="http://deyingwh.com" target="_blank">޹ƷۺϾþ</a>| <a href="http://416164.com" target="_blank">ѹ18߹ۿ</a>| <a href="http://963315.com" target="_blank">˳77777߲վ</a>| <a href="http://www55xx.com" target="_blank">ձɫַ</a>| <a href="http://www73234.com" target="_blank">ڵƵ</a>| <a href="http://xzdlgp.com" target="_blank">ɫۺϾþþƷ޹</a>| <a href="http://hkcdk.com" target="_blank">޾ƷþþþþҲ </a>| <a href="http://binz132.com" target="_blank">պɫѹۿ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>