埃尔朗视图在沙发数据库 [英] Erlang Views in Couch DB

查看:119
本文介绍了埃尔朗视图在沙发数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在 Erlang 中查看Couch数据库。据说Erlang所写的观点比用JavaScript写的更快。这个 Article 显示了这种可能性。但是,它解释说,我们可以直接在 fun 作为临时视图rel =nofollow> futon :CouchDB Web界面

问题1:在哪里可以找到用Erlang编写的Couch DB视图的示例或者至少要介绍一下这样做所需要的教程(在你的答案中,我将会欣赏一下Erlang编写的一个视图的例子,它显示了Map和reduce的所有基本技术,以及从Couch中的文档中选择和过滤)。

问题2:另外,Erlang Couch DB客户端称为悬停工具据说更快,因为它避免了HTTP开销以及JSON转换开销的。如何避免HTTP开销?

Its possible to write views in Erlang to query Couch DB. The views written in Erlang are said to be faster than those written in JavaScript. This Article shows this possibility. However, it explains that we can type an Erlang fun as a temporary view directly in the futon: CouchDB Web interface

Question 1: Where can i find examples of Couch DB views written in Erlang, or atleast a tutorial of whats required in doing so ( In your answer, i would appreciate an example of a view written in Erlang which shows all basic techniques for map and reduce as well as selecting and filtering from documents in Couch ) ?

Question 2: Also, the Erlang Couch DB client, called Hover craft is said to be very much faster because it avoids HTTP overhead as well as JSON conversion overheads. How does it avoid HTTP overheads ?

推荐答案

答案1
这里是链接到教程如何设置 http://wiki.apache.org/couchdb/EnableErlangViews
最重要的是在您设置为使用此查询服务器的local.ini文件中
[native_query_servers]
erlang = {couch_native_process,start_link,[]}

Answer 1: Here is the link to "tutorial" how to set it up http://wiki.apache.org/couchdb/EnableErlangViews Most important thing is [native_query_servers] erlang = {couch_native_process, start_link, []} in local.ini file where you set it to use this query server.

答案2
它避免了http开销,因为常规查询服务器只是一个独立的进程,在json中获取数据并处理它。因此,Couchdb必须将其序列化为json,然后通过使用嵌入式erlang视图来反序列化回答过程,您只需跳过此阶段。这就是更快背后的主要原因。我不知道他是否存储内部编译的视图,但无论如何它更快。

Answer 2: It avoids http overhead because regular Query Server is just a standalone process that gets data in json and process it. So Couchdb has to serialize it to json and then deserialize answer from process by using embedded erlang views you simply skip this phase. And this is the main reason behind "faster". I don't know if he is storing internally compiled views but anyway it is much faster.

这篇关于埃尔朗视图在沙发数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆