rpc

How to share global sequential number generator in Hadoop?

[亡魂溺海] 提交于 2020-01-05 09:49:06
问题 Now I am using Hadoop to process the data that will finally be loaded into the same table. I need to a shared sequential number generator to generate id for each row. Now I am using the following approach to generate the unique number: 1) Create a text file, e.g., test.seq, in HDFS for saving the current sequential number. 2) I use a lock file ".lock" to control concurrency. Suppose we have two tasks to processing the data in parallel. If task1 wants to get the number, it will check if the

服务之间的调用为啥不直接用 HTTP 而用 RPC?

寵の児 提交于 2020-01-03 22:41:58
什么是 RPC?RPC原理是什么? 什么是 RPC? RPC(Remote Procedure Call)—远程过程调用,它是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术的协议。比如两个不同的服务 A、B 部署在两台不同的机器上,那么服务 A 如果想要调用服务 B 中的某个方法该怎么办呢?使用 HTTP请求 当然可以,但是可能会比较慢而且一些优化做的并不好。 RPC 的出现就是为了解决这个问题。 RPC原理是什么? 服务消费方(client)调用以本地调用方式调用服务; client stub接收到调用后负责将方法、参数等组装成能够进行网络传输的消息体; client stub找到服务地址,并将消息发送到服务端; server stub收到消息后进行解码; server stub根据解码结果调用本地的服务; 本地服务执行并将结果返回给server stub; server stub将返回结果打包成消息并发送至消费方; client stub接收到消息,并进行解码; 服务消费方得到最终结果。 下面再贴一个网上的时序图: RPC 解决了什么问题? 从上面对 RPC 介绍的内容中,概括来讲RPC 主要解决了: 让分布式或者微服务系统中不同服务之间的调用像本地调用一样简单。 常见的 RPC 框架总结? RMI(JDK自带): JDK自带的RPC,有很多局限性,不推荐使用

RPC Framework in C++ utilizing ZeroMQ

那年仲夏 提交于 2020-01-03 19:01:30
问题 I need to write a client-server application in C++ using ZeroMQ push-pull socket pattern. The client has to make RPC calls to the functions specified in the server interface. I wonder if there is an open source and commercially usable library/framework for this purpose primarily in C++. I made some googling and there seem to be things written in python but I prefer something in C++ that comes handy with ZeroMQ if possible. Any suggestion/guidance is appreciated. Thanks. 回答1: Google protobuf

Is EJB middleware? Or is middleware used in EJB?

妖精的绣舞 提交于 2020-01-03 05:29:07
问题 I am confused between these two nuances: Is EJB itself middleware, or is there any middleware used in the deployment of EJB? Same goes for RMI- is RMI itself middleware or is middleware used in RMI? 回答1: Define Middleware, if it is in the middle what is it between? I agree with the basic idea of this Wikipedia definition: Middleware is a computer software that provides services to software applications beyond those available from the operating system. It can be described as "software glue".[1

RPC和HTTP的理解以及不同之处

人走茶凉 提交于 2020-01-02 19:40:52
RPC协议:远程过程调用协议(Remote Procedure Call Protocol),是一种计算机通讯协议。 如何理解远程过程调用? 假设有两台服务器A和B,一个应用部署在A服务器上,想要调用B服务器上应用提供的函数或者方法,由于不在一个内存空间,所以不能直接调用,需要通过网络来表达调用的语义和传达调用的数据。 简要的步骤 解决通讯问题。主要是客户端和服务器建立TCP连接,远程调用所有交换的数据都在这个连接里面进行交换,连接可以是按需连接,数据交换完毕之后就关闭连接;也可以是长连接,多个远程调用都共享同一个连接。 解决寻址问题。服务器A想要调用服务器B的应用,那么A应该告知RPC框架B服务器(主机名或IP地址)以及特定的端口,然后指定调用的方法或者函数的名称以及入参出参等信息,这样才能完成服务的一个调用。比如基于Web服务协议栈的RPC,就需要提供一个endpoint URI,或者是从UDDI服务上进行查找。如果是RMI调用的话,还需要一个RMI Registry来注册服务的地址。 当A服务器上的应用发起远程过程调用时,方法的参数需要通过底层的网络协议如TCP传递到B服务器,由于网络协议是基于二进制的,内存中的参数的值要序列化成二进制的形式,也就是序列化(Serialize)或编组(marshal),通过寻址和传输将序列化的二进制发送给B服务器。 B服务器收到请求后

How to Implement progressbar with GWT?

眉间皱痕 提交于 2020-01-02 07:20:37
问题 In a GWT application, I have a long process that runs server side and invoked using rpc(GWT dispatcher) and I want to have a feedback to the Client as a progress bar showing messages and the total progress. My question is how to recover messages and the progress dynamically from the server? I'm interested in any solution thank you in advance for your help. 回答1: Have a look at the get progress bar in the incubator. Here is another example of someone using it. UPDATE If you want to display the

How do I make an async call to Hive in Java?

只愿长相守 提交于 2020-01-02 07:19:06
问题 I would like to execute a Hive query on the server in an asynchronous manner. The Hive query will likely take a long time to complete, so I would prefer not to block on the call. I am currently using Thirft to make a blocking call (blocks on client.execute()), but I have not seen an example of how to make a non-blocking call. Here is the blocking code: TSocket transport = new TSocket("hive.example.com", 10000); transport.setTimeout(999999999); TBinaryProtocol protocol = new TBinaryProtocol

How to structure communication between Nodejs server and rails?

ε祈祈猫儿з 提交于 2020-01-02 04:51:14
问题 I am currently using rails to serve static web pages and I am experimenting with NodeJs to handle some real time aspect of my application. I have been able to have do a one way communication between Nodejs to my Rails server by having Nodejs write to a db and my rails server reading from it. Now I want to do the other way, aka an action in Rails will trigger an action in Nodejs. Obviously I can be dumb and have a node continually polling the database server. What are my options? Set up RPC

网络协议 21 - RPC 协议(中)- 基于 JSON 的 RESTful 接口协议

微笑、不失礼 提交于 2020-01-02 01:59:20
原文: 网络协议 21 - RPC 协议(中)- 基于 JSON 的 RESTful 接口协议     上一节我们了解了基于 XML 的 SOAP 协议,SOAP 的 S 是啥意思来着?是 Simple,但是好像一点儿都不简单啊! 传输协议问题     对于 SOAP 来讲,比如我创建一个订单,用 POST,在 XML 里面写明动作是 CreateOrder;删除一个订单,还是用 POST,在 XML 里面写明了动作是 DeleteOrder。其实创建订单完全可以使用 POST 动作,然后在 XML 里面放一个订单的信息就可以了,而删除用 DELETE 动作,然后在 XML 里面放一个订单的 ID 就可以了。     于是上面的那个 SOAP 就变成下面这个简单的模样。 POST /purchaseOrder HTTP/1.1 Host: www.cnblog.com Content-Type: application/xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <order> <date>2018-07-01</date> <className> 板栗焖鸡 </className> <price>58</price> </order>     而且 XML

架构风格之比较

ⅰ亾dé卋堺 提交于 2020-01-02 01:39:59
转至InfoQ上的《理解本真的REST架构风格》一文 从架构风格的抽象高度来看,常见的分布式应用架构风格有三种: 分布式对象(Distributed Objects,简称DO) 架构实例有CORBA/RMI/EJB/DCOM/.NET Remoting等等 远程过程调用(Remote Procedure Call,简称RPC) 架构实例有SOAP/XML-RPC/Hessian/Flash AMF/DWR等等 表述性状态转移(Representational State Transfer,简称REST) 架构实例有HTTP/WebDAV DO和RPC这两种架构风格在企业应用中非常普遍,而REST则是Web应用的架构风格,它们之间有非常大的差别。 REST与DO的差别在于: REST支持抽象(即建模)的工具是资源,DO支持抽象的工具是对象。在不同的编程语言中,对象的定义有很大差别,所以DO风格的架构通常都是与某种编程语言绑定的。跨语言交互即使能实现,实现起来也会非常复杂。而REST中的资源,则完全中立于开发平台和编程语言,可以使用任何编程语言来实现。 DO中没有统一接口的概念。不同的API,接口设计风格可以完全不同。DO也不支持操作语义对于中间组件的可见性。 DO中没有使用超文本,响应的内容中只包含对象本身。REST使用了超文本,可以实现更大粒度的交互,交互的效率比DO更高。