欢迎来到天天文库
浏览记录
ID:34417242
大小:263.88 KB
页数:8页
时间:2019-03-05
《java版的各种thriftserver实现的比较》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、(翻译)Java版的各种Thriftserver实现的比较2012年8月4日由learnhard留言»转载请注明出处:http://www.codelast.com/本文是我对这篇文章的翻译:ThriftJavaServersCompared,为了便于阅读,我将原文附于此处,翻译穿插在其中。此外,为了防止原链接在未来某一天失效后,文中的图片再也看不到的问题,我将原文中的图片也保存到了本站的服务器上,我不知道github或原作者是否允许这样做,但我翻译本文仅在于传播知识的目的,在此向原作者和github表
2、示深深的感谢:感谢你们分享了这样好的文章。 ThriftJavaServersComparedThisarticletalksonlyaboutJavaservers.See thispage ifyouareinterestedinC++servers.本文仅讨论Java版的Thriftserver.如果你对C++版的感兴趣,请参考 这个 页面。Thrift isacross-languageserialization/RPCframeworkwiththreemajorcomp
3、onents,protocol,transport,andserver.Protocoldefineshowmessagesareserialized.Transportdefineshowmessagesarecommunicatedbetweenclientandserver.Serverreceivesserializedmessagesfromthetransport,deserializesthemaccordingtotheprotocolandinvokesuser-definedmess
4、agehandlers,andserializestheresponsesfromthehandlersandwritesthembacktothetransport.ThemodulararchitectureofThriftallowsittooffervariouschoicesofservers.HerearethelistofserveravailableforJava:Thrift 是一个跨语言的序列化/RPC框架,它含有三个主要的组件:protocol,transport和server,其
5、中,protocol定义了消息是怎样序列化的,transport定义了消息是怎样在客户端和服务器端之间通信的,server用于从transport接收序列化的消息,根据protocol反序列化之,调用用户定义的消息处理器,并序列化消息处理器的响应,然后再将它们写回transport。Thrift模块化的结构使得它能提供各种server实现。下面列出了Java中可用的server实现:· TSimpleServer· TNonblockingServer· THsHaServer· TThreadedSe
6、lectorServer· TThreadPoolServerHavingchoicesisgreat,butwhichserverisrightforyou?Inthisarticle,I'lldescribethedifferencesamongallthoseserversandshowbenchmarkresultstoillustrateperformancecharacteristics(thedetailsofthebenchmarkisexplainedinAppendixB).Let'
7、sstartwiththesimplestone:TSimpleServer.有多个选择很好,但是哪个适合你呢?在本文中,我将描述这些server之间的区别,并展示测试结果,以说明它们的性能特点(测试的细节在附录B中)。下面,我们就从最简单的开始:TSimpleServer。文章来源:http://www.codelast.com/TSimpleServerTSimpleServer acceptsaconnection,processesrequestsfromtheconnectionuntilth
8、eclientclosestheconnection,andgoesbacktoacceptanewconnection.Since itisalldoneinasinglethreadwithblockingI/O,itcanonlyserveoneclientconnection,andalltheotherclientswillhavetowaituntiltheygetaccepted.TSimpleServerismainlyus
此文档下载收益归作者所有