node.js - HBase:Thrift vs Rest 性能

标签 node.js rest hadoop hbase thrift

我知道 StackOverflow 上有几篇关于 HBase 的 REST 和 Thrift 的帖子,但我想稍微关注一下性能问题。

我一直在使用 Node.js 中的以下库来连接到 HBase 实例:

在弄清楚为什么我无法从 Thrift 网关获得响应的一些麻烦之后,我终于让两个脚本都运行了,结果如下(每个输出相当于完成了 1000 个操作):

┌─[mt@Marcs-MacBook-Pro]─[~/Sources/node-hbase]
└──╼ node hbase.js 
hbase-write: 99ms
hbase-write: 3412ms
hbase-write: 3854ms
hbase-write: 3924ms
hbase-write: 3808ms
hbase-write: 9035ms
hbase-read: 216ms
hbase-read: 4676ms
hbase-read: 3908ms
hbase-read: 3498ms
hbase-read: 4139ms
hbase-read: 3781ms
completed
┌─[mt@Marcs-MacBook-Pro]─[~/Sources/node-hbase]
└──╼ node thrift.js 
hbase-write: 4ms
hbase-write: 931ms
hbase-write: 1061ms
hbase-write: 988ms
hbase-write: 839ms
hbase-write: 807ms
hbase-read: 2ms
hbase-read: 435ms
hbase-read: 562ms
hbase-read: 414ms
hbase-read: 427ms
hbase-read: 423ms
completed
┌─[mt@Marcs-MacBook-Pro]─[~/Sources/node-hbase]
└──╼ 

使用的脚本可以在这里找到:https://github.com/stelcheck/node-hbase-vs-thrift

我的问题是,有没有人注意到 REST 和 Thrift 对于 HBase(或者甚至只是一般来说对于任何应用程序/语言)之间的巨大差异?

最佳答案

REST 以 XML 或 JSON 的形式提供,因此模式存在于数据本身中。 Thrift 不这样做:它只是一个字节负载,然后只能针对生成的实体进行反序列化(基于 thrift IDL 定义)。

因此,无论数据如何压缩,thrift 肯定会更快,因为它不携带任何架构,其“代价”是依赖其他对象来解释二进制数据。

关于node.js - HBase:Thrift vs Rest 性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16732082/

相关文章:

hadoop - 使用什么从 Spark 的 dynamodb 读取/写入?

hadoop - 索引谷歌数据的 Mapreduce

node.js - 捕获 hapi 17 中的插件问题

node.js - 使用 Twilio API 识别群聊中的所有号码

node.js - 谷歌 Adwords 和 Node.js : library or different way to access API?

Spring 数据休息 - _links

php://input 返回空

node.js - 如何在 Next.js 中获取 API 路由中的 URL 查询字符串?

web-services - REST 数组操作最佳实践

java - 如何在MapReduce作业中调用Reducer类,以便从reducer输出中不返回重复的键?