Has anybody built anything solid with RethinkDB? If so, comments on learning curve / performance ?

agolangf · · 639 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<hr/>**评论:**<br/><br/>dancannon: <pre><p>Hey, I maintain the Go driver for RethinkDB and while I havnt got anything running in production I hope I have useful information.</p> <p>Regarding the learning curve as mentioned RethinkDB itself is very beginner friendly for both developers and sysadmins, I find that RethinkDB abstracts away much of the complexity and provides an easy interface through both the query language and the web UI. This is more of an opinion but I also find the functional query language great for working with and the basic compile time checks have helped catch many errors.</p> <p>The performance of RethinkDB is not quite as good as other similar databases but this is rapidly improving and from what I have seen these performance improvements are not impacting the quality of the rest of the system. I think this is probably a more important point as other databases have tried to focus on performance over data consistency initially and had problems later down the line.</p> <p>I have also tried to make the Go driver as easy to use as possible, it has come a long way since the initial version (and its predecessor rethinkgo) and now includes some pretty useful features for connecting to RethinkDB clusters of any size. For people who are new to Go the driver can be quite different to the other drivers as Go is statically typed which means that API is slightly different, however once you get used to this difference it is in opinion easier to use than the other drivers.</p> <p>I hope my answers help, if you (or anybody else) has any other questions let me know!</p></pre>anonxgh: <pre><p>Hi, <a href="/u/dancannon">/u/dancannon</a>. Any plans to make the driver more type safe? Now all <a href="https://godoc.org/github.com/dancannon/gorethink#Term"><code>Term</code></a> methods expect <code>args ...interface{}</code> as arguments. <a href="https://godoc.org/github.com/dancannon/gorethink#DB">E.g.</a>: <code> func DB(args ...interface{}) Term </code>.</p> <p>While that may be the most straightforward way of implementing RQL, I have a feeling this approach doesn&#39;t use the advantage Golang provides: static typing.</p></pre>dancannon: <pre><blockquote> <p>Hey dan I&#39;m currently trying it it and it&#39;s quite fantastic and easy to use, I just have one quick question I can&#39;t really find on the docs, when doing an update, is it possible to get the value of the thing that was updated?</p> </blockquote> <p>Hey thats a good question, I initially implemented the driver with stricter types however after some testing I realised that due to the fact that ReQL was designed for loosely typed languages that wouldnt really work. </p> <p>For example the following query is actually valid (I am not saying you should ever do this, it is just valid):</p> <pre><code>r.DB(r.Expr(&#34;tAbleNaMe.&#34;).Downcase()) </code></pre> <p>If I can ever think of a good way of supporting both use cases I will definitely update the driver to be more type safe.</p></pre>anonxgh: <pre><p>Since Golang <a href="https://golang.org/doc/faq#overloading" rel="nofollow">doesn&#39;t support</a> function/method overloading, the only solution I can think of is to have a separate method for every type. I.e.:</p> <ul> <li><code>func DB(string) Term</code></li> <li><code>func DBTerm(Term) Term</code></li> </ul> <p>P.S.: I have looked into the official Java driver and got a little disappointed.</p> <pre><code>public Db(Object arg) { this(new Arguments(arg), null); } public Db(Arguments args){ this(args, null); } public Db(Arguments args, OptArgs optargs) { super(TermType.DB, args, optargs); } </code></pre> <p>If I understand correctly, it accepts any type and make all checks on runtime (just as JS driver) throwing exceptions if input arguments are of incorrect type:</p> <pre><code>// RethinkDB Admin Console: Data Explorer e: Expected type STRING but found OBJECT in: r.db({&#34;test&#34;: &#34;xxx&#34;}) e: Expected type STRING but found NUMBER in: r.db(123) </code></pre> <p>That&#39;s pretty sad.</p></pre>Gacnt: <pre><p>Hey dan I&#39;m currently trying it it and it&#39;s quite fantastic and easy to use, I just have one quick question I can&#39;t really find on the docs, when doing an update, is it possible to get the value of the thing that was updated?</p> <p>I&#39;m updating something then wanting to use data from the row, but I&#39;d rather just have it returned from the update rather than 1 from update and 1 from find</p></pre>dancannon: <pre><p>Unfortunately I don&#39;t believe it is possible to read the updated document as part of the same operation, this is a limitation of the RethinkDB query language.</p></pre>beefsack: <pre><p>I&#39;ve built a board gaming by email service using Go and RethinkDB. <a href="https://github.com/dancannon/gorethink">dancannon&#39;s driver</a> is very ergonomic and well maintained.</p> <p>I found it really easy to step into, the RethinkDB web admin is beginner friendly and adding nodes to the cluster is a piece of piss. Performance has been very good for me but we haven&#39;t hit crazy scale yet.</p></pre>bmatsuo: <pre><p>Thanks for the review. </p> <p>TIL &#34;piece of piss&#34; is a good thing. That is a confusing regionalism.</p> <p>Adding nodes is easy, if people didn&#39;t get that.</p></pre>bastawhiz: <pre><p>What kind of data do you think Rethink handles best? I.e., compared to Redis or Couch, or another nontraditional database. </p></pre>codekoala: <pre><p>I used rethinkdb for about a year on a project at work (back in 2013, I think). It&#39;s extremely easy to setup and use, and the admin interface is superb. Truly a pleasure to use.</p> <p>Honestly, though, performance wasn&#39;t stellar at the time. We weren&#39;t using anything complex in it--we really just wanted a place to keep schemaless metadata. It handled data just fine, but basic retrieval queries took several hundred milliseconds to complete. Eventually we just ditched it and started using postgresql and its fancy json datatype (still using that same setup, just with jsonb now).</p> <p>Another thing that turned us off of rethinkdb was disk usage. Compared to an un-normalized mysql table with only a primary key index, rethinkdb took almost exactly 32x space on disk (iirc) for the exact same data (irc logs). That got out of hand very quickly.</p> <p>I&#39;m 100% certain they&#39;ve made performance improvements since we parted ways. I also know they&#39;ve made great improvements in the data storage. I&#39;ve tinkered with rethinkdb since we stopped using it at work. It&#39;s really great. But I haven&#39;t done any benchmarks since we switched to postgresql. I want to, just haven&#39;t had time.</p> <p>I say try it out!</p></pre>NeilHanlon: <pre><p>Much, much better performance now. I&#39;d check it out again :)</p></pre>dewey4iv: <pre><p>I know we are using it where I work to hold about 80GB of Geo-spatial data and it handles it all like a champ! Is it the fastest thing out there? Nope. But when it comes to managing the DB, scaling, sharding, and recovering from outages I can say it&#39;s been the best for us so far. I&#39;ve found it REALLY useful when I&#39;m starting out a project that may not have a solid DB structure - or one that may well need to evolve over time (though this can be said for other DBs like MongoDB). dancannon (maintainer of gorethink) has been really helpful in helping my sort out a few issues as well and responded SUPER quick (so I think you can expect he&#39;ll continue to maintain the driver). I DID have a few little issues (mostly of my own doing) when I wanted to start doing nested queries (joins) but I can show you some of my easy solutions for this if you&#39;d like. Cheers! _G</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

639 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传