Skip to content

Instantly share code, notes, and snippets.

ZeroRPC简介 - 轻量级分布式通信框架

概述

分布式系统的核心是分布式通信,而传统上开发一套支持上千台规模集群,可靠性非常高的分布式通信框架,需要不少的精力投入。而在多数情景下,我们(特别是时间宝贵的OP)并不是非常关注技术实现的细节,而是希望有一套成熟、轻量、可靠性高、使用方便而且易于调试的分布式通信框架,可以直接使用,从而把时间放在具体业务逻辑上。

在PyCon 2012大会上,dotcloud公司开源了一套基于ZeroMQ和MessagePack的分布式通信框架(或者说是协议+Python实现)。该框架因为基于ZeroMQ,使用方法是RPC,所以被命名为ZeroRPC。ZeroRPC的特点在其官网的介绍中一目了然[1]:

ZeroRPC is a light-weight, reliable and language-agnostic library for distributed communication between server-side processes.

@dirts
dirts / dabblet.css
Created February 20, 2013 15:33
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
import sublime
import sublime_plugin
import re
class CompactExpandCssCommand(sublime_plugin.TextCommand):
def run(self, edit, action='compact'):
rule_starts = self.view.find_all('\{')
rule_ends = self.view.find_all('\}')
import sublime
import sublime_plugin
import re
class CompactExpandCssCommand(sublime_plugin.TextCommand):
def run(self, edit, action='compact'):
rule_starts = self.view.find_all('\{')
rule_ends = self.view.find_all('\}')
@dirts
dirts / gist:4563840
Created January 18, 2013 10:52 — forked from snowman-repos/gist:3820387
JavaScript: Get Object Size (number of keys)
function objectSize(the_object) {
/* function to validate the existence of each key in the object to get the number of valid keys. */
var object_size = 0;
for (key in the_object){
if (the_object.hasOwnProperty(key)) {
object_size++;
}
}
return object_size;
}
@dirts
dirts / klass_lab.html
Created September 6, 2012 09:20
jQuery_learning
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="jq18.js"></script>
</head>
<style type="text/css">
.c1 {border:2px solid #c00; margin-bottom: 5px; min-height:5px }
</style>
@dirts
dirts / themes
Created July 26, 2012 11:45
themes
/*artTemplate - Template Engine*/var template=function(d,h){return template["object"===typeof h?"render":"compile"].apply(template,arguments)};(function(d,h){d.version="1.1";d.openTag="<%";d.closeTag="%>";d.parser=null;d.render=function(a,c){var b;b=g[a];void 0===b&&!v?((b=document.getElementById(a))&&d.compile(a,b.value||b.innerHTML),b=g[a]):b=g.hasOwnProperty(a)?b:void 0;return void 0===b?m({id:a,name:"Render Error",message:"Not Cache"}):b(c)};d.compile=function(a,c,b){function j(b){try{return(new n(b)).template}catch(e){if(!f)return d.compile(a,c,!0)(b);e.id=a||c;e.name="Render Error";e.source=c;return m(e)}}var f=b;"string"!==typeof c&&(f=c,c=a,a=null);try{var n=w(c,f)}catch(k){return k.id=a||c,k.name="Syntax Error",m(k)}j.prototype=n.prototype;j.toString=function(){return n.toString()};a&&(g[a]=j);return j};d.helper=function(a,c){r[a]=c};var g={},p="".trim,v=p&&!h.document,s={},q=function(){var a=Array.prototype.forEach||function(a,b){for(var d=this.length>>>0,f=0;f<d;f++)f in this&&a.call(b,this[f],f,th
@dirts
dirts / jQuery plugins
Created July 26, 2012 11:45
jQeury Plugins
/* 839199005 - t47 15.8.z - 323/ */
jQuery.foo = function() {
// body...
}
jQuery.bar = function(param){
// body...
}
@dirts
dirts / jQeury learning
Created July 25, 2012 07:10
jQuery learning
(function(w,undefined) {
var jQuery = (function(){
var jQuery = function(selector,context){
return new jQuery.fn.init(selector,context,rootJQuery);
}
jQuery.fn = jQuery.prototype = {
constructor : jQuery,
init : function(selector,context,rootJQuery){
@dirts
dirts / cookie.js
Created July 6, 2012 11:06
cookie.js