rpc

我开始抄代码来学编程

帅比萌擦擦* 提交于 2019-12-01 18:50:08
之前研究 Hadoop 源码,把 hadoop-common 模块下的 RPC 模块源码通读一遍,又花了 3 个月抄了一遍 Hadoop RPC 代码,学到很多东西。我觉得学习编程最有效的方式就是抄代码,我觉得这个过程对正在学编程的朋友很有帮助,所以想做成教程,以下是周末写的一个开头,后续教程的形式以及进展会发布在公众号,有兴趣的朋友欢迎文末关注 。 1. 起源 故事得从19年上半年说起,那时候我正打算研究一下Hadoop源码。 现在大家都听说过Hadoop,它是一个分布式存储和计算的框架。作为分布式系统,节点之间的通信、交互式必不可少的。Hadoop自己实现了RPC(Remote Procedure Call,远程过程调用)模块来满足这样的需求。带着好奇,我便阅读了整个Hadoop RPC模块的源代码,读完后发现这个模块设计的非常好,与其他模块无耦合,完全可以独立出来当成一个独立的框架。为了能够学习相关的编程知识,同时还可以看到Apache 顶级开源项目的代码如何编写的,因此我便把Hadoop RPC模块做成教程。 虽然这个项目是实现RPC功能,但我觉得我们重点不应该过多关注RPC本身,而应该重点学习RPC所涉及的客户端开发、服务端开发、网络编程、多线程、并发编程、设计模式等核心知识,尤其是对于刚学习Java没有接触线上实战项目的朋友,掌握好了这些知识,写其他项目也会更有思路。

GWT on Python App Engine

[亡魂溺海] 提交于 2019-12-01 18:01:19
I have a python app engine code (matured backend) - and we are now planning to have a front end for that code. I was wondering whether it is possible to implement GWT as the front end. Even though Alex Martelli in this post [1] mentions it is not possible, a comment to that post suggests that it is indeed possible using rpc over json for GWT. I was unable to understand how this is possible. In app.yaml file, we have to specify the language to be python, right? In that case, how can it compile GWT based on JAVA? Are there any examples on anyone doing that? Can someone help me out? It would be

GWT on Python App Engine

不羁岁月 提交于 2019-12-01 16:29:48
问题 I have a python app engine code (matured backend) - and we are now planning to have a front end for that code. I was wondering whether it is possible to implement GWT as the front end. Even though Alex Martelli in this post [1] mentions it is not possible, a comment to that post suggests that it is indeed possible using rpc over json for GWT. I was unable to understand how this is possible. In app.yaml file, we have to specify the language to be python, right? In that case, how can it compile

RabbitMQ之RPC(Remote procedure call )

自闭症网瘾萝莉.ら 提交于 2019-12-01 13:21:15
RPC(远程过程调用)   解决的问题:之前的模式都是基于一对一的发,另外端收到,不能继续发。   使用多个队列对多个消费者之间分配耗时的任务    客服端 1 #!/usr/bin/env python 2 # -*- coding:utf-8 -*- 3 4 import pika 5 import uuid 6 7 8 class FibonacciRpcClient(object): 9 10 def __init__(self): 11 self.credentials = pika.PlainCredentials('admin', 'admin123456') 12 self.connection = pika.BlockingConnection(pika.ConnectionParameters(host='192.168.1.6', credentials=self.credentials)) 13 self.channel = self.connection.channel() 14 15 result = self.channel.queue_declare(queue='', exclusive=True) 16 self.callback_queue = result.method.queue 17 18 self.channel.basic

GWT + GAE python: frameworks for COMET & RPC

拟墨画扇 提交于 2019-12-01 13:18:58
Let's say I want to use Google GWT on the client side and Google AppEngine Python on the server side. Furthermore, I want to be able to use RPC calls to the server as well as performing COMET based exchanges. What are my options in term of existing frameworks? I found this by googling "gwt python": http://code.google.com/p/python-gwt-rpc/ -- it appears to be unsupported, since App Engine supports Java now. And this, by googling "gwt comet": http://code.google.com/p/rocket-gwt -- which should work on your client-side to make hanging GETs to the server, which conceivably could be written in

分享一个简单易用的RPC开源项目—Tatala

走远了吗. 提交于 2019-12-01 12:16:07
这个项目最早(2008年)是用于一个网络游戏的Cache Server,以及一个电子商务的Web Session服务。后来不断增加新的功能,除了Java还支持C#,到现在已经可以用它来开发网络游戏的服务器。等过些日子我还会开源网络游戏的服务器源码。 关于性能,当时后台相应请求的效率是每秒10W次,现在我在自己的笔记本上测,只有一个客户端与服务器都在一个物理机上(CPU: i7-3610QM; RAM: 8G; OS: Win7-64),每秒相应12000个请求。 tatala-client-csharp已经上传,同样在笔记本上测试,一个c#客户端一个Java服务端都在一台机器上,每秒响应22000个请求。c#客户端除了性能测试的例子还有一个演示Server推送的聊天室例子。 Tatala最大的特点是简单,性能是第二考虑能够满足大部分应用就行。因为性能可以通过增加机器得到提升,而代码简单意味着雇更少的人更快的开发。老板省钱,程序员轻松才是最重要的。 开源地址: https://github.com/zijan/Tatala 下面是简单介绍。 概述 Tatala是一个简单易用的RPC中间件,并且跨语言跨平台。它将调用方法转变成字节数组(包括被调用类名,目标方法名,参数序列和返回值),在socket基础上实现客户端和服务器之间的互相通信。 目前,Tatala支持Java的客户端与服务器端

Wordpress XML-RPC and featured images

China☆狼群 提交于 2019-12-01 11:53:13
I'm currently developing a plugin for a client that takes an xml feed hourly and posts it into wordpress and I'm having trouble sending the featured image to the post. I can post to wordpress fine but all my attempts to post the featured image have failed. <?php class XMLRPClientWordPress { var $XMLRPCURL = ""; var $UserName = ""; var $PassWord = ""; // Constructor public function __construct($xmlrpcurl, $username, $password) { $this->XMLRPCURL = $xmlrpcurl; $this->UserName = $username; $this->PassWord = $password; } function send_request($requestname, $params) { $request = xmlrpc_encode

Wordpress XML-RPC and featured images

时光怂恿深爱的人放手 提交于 2019-12-01 11:35:08
问题 I'm currently developing a plugin for a client that takes an xml feed hourly and posts it into wordpress and I'm having trouble sending the featured image to the post. I can post to wordpress fine but all my attempts to post the featured image have failed. <?php class XMLRPClientWordPress { var $XMLRPCURL = ""; var $UserName = ""; var $PassWord = ""; // Constructor public function __construct($xmlrpcurl, $username, $password) { $this->XMLRPCURL = $xmlrpcurl; $this->UserName = $username; $this

http接口、api接口、RPC接口、RMI、webservice、Restful等概念

人盡茶涼 提交于 2019-12-01 10:52:48
在这之前一定要好好理解一下接口的含义,我觉得在这一类中接口理解成规则很恰当。 http接口 :基于HTTP协议的开发接口.这个并不能排除没有使用其他的协议。 api接口 :API(Application Programming Interface)应用程序编程接口,应用也包括网络应用程序,就像api文档基本上就是使用说明书,API接口可以简单理解成“应用程序使用接口”。 RPC接口 :Remote Procedure Calls 远程过程调用 (RPC) 是一种协议,程序可使用这种协议向网络中的另一台计算机上的程序请求服务。由于使用 RPC 的程序不必了解支持通信的网络协议的情况,因此 RPC 提高了程序的互操作性。在 RPC 中,发出请求的程序是客户程序,而提供服务的程序是服务器。 RPC(远程过程调用)是一项广泛用于支持分布式应用程序(不同组件分布在不同计算机上的应用程序)的技术。RPC 的主要目的是为组件提供一种相互通信的方式,使这些组件之间能够相互发出请求并传递这些请求的结果。 没有语言限制。 RMI :RMI(Remote Method Invocation,远程方法调用)RMI是针对于java语言的, RMI 允许您使用Java编写分布式对象 Webservice接口: Webservice是系统对外的接口,比如你要从别的网站或服务器上获取资源或信息

Java实现简单的RPC过程

纵然是瞬间 提交于 2019-12-01 10:51:27
RPC是远程过程调用(Remote Procedure Call)的缩写,常用于分布式结构系统中。在分布式系统中,一般将系统组件根据需求进行分解,部署在不同服务器上,系统组件间即可通过RPC进行相互连接调用。 RPC可以实现系统功能间的耦合度降低,系统各服务组件分布在不同服务器上,可独立进行升级和维护; RPC可以提高系统扩展性和健壮性,通过统一接口控制,实现功能的复用和扩展; 设计案例:设计一个计算器,实现计算器内部方法通过远程调用来获得计算结果 设计实现计算机接口及实现类; 设序列化对象封装计算器操作数和运算方法; 计算器实现类内部将封装对象序列化发送至Server端并等待获取Server端返回的执行结果; Server端通过反序列化封装对象获取操作数和运算方法进行本地对应方法调用; Server端将本地方法执行结果封装后返回Client端; Client端接收Server端执行结果返回至计算器方法调用处完成计算。 Client端构造类: 1、面向用户类 public class Client { public static void main(String[] args) throws ClassNotFoundException { //创建计算器 Calculator calculator=new CalculatorRemoteImpl(); //调用计算器加方法