News for hackers. Stuff that matters.
Re:RethinkDB example apps by mercurial on Saturday February 02, 2013 @04:04AM (#5155574)
Thanks for taking the time to do this. I have only looked at the Python example, but I think it highlights a basic issue with the API:

    r.table('todos').get(todo_id).run(g.rdb_conn)
It would be more natural to have it go the other way:

    g.rdb_conn.run(r.table('todos').get(todo_id))
This way, the connection runs the request instead of the other way round.

Also, you are opening and closing DB connections with each HTTP request. I imagine this is for the purpose of simplifying the example. However, it does make me curious: how expensive is the creation of a new connection? Are connections thread-safe? Would it make sense to have connection pooling?

Re:RethinkDB example apps by wmrowan on Saturday February 02, 2013 @05:14AM (#5155676)
This is Bill @rethinkdb

The distinction between query.run(conn) and conn.run(query) is very fine indeed. There has been much discussion about this and there are both solutions have their merits. At one point we even supported both but decided the simplicity of having only one solution merited dropping the other.

Creating a new connection involves opening a TCP connection and sending a message to validate the driver to the server, altogether a few round trips. There is a small bit of per connection state stored on the server but since RethinkDB uses a custom coroutine implementation for concurrency support this does not amount to the overhead of an independent OS thread for each connection.

Invoking the query with a specific connection object is thread safe. There is a feature designed to help REPL users that stores the last connection in global state that is slated for removal in the upcoming release (1.4) that is obviously not re-entrant.

It would make sense to have connection pooling, especially in the python driver where connections block on requests. This is an idea we're exploring but is lower down on the priority list. As it is a fully client side feature there is nothing stopping 3rd party driver developers from implementing a solution though the official drivers will have to wait for other priorities.

Re:RethinkDB example apps by mercurial on Saturday February 02, 2013 @10:59AM (#5156253)
Thanks for the detailed answer. I completely agree wrt having only one solution. Looking forward to trying it out :)
Re:RethinkDB example apps by coffeemug on Saturday February 02, 2013 @04:52AM (#5155644)
This way, the connection runs the request instead of the other way round.

I don't know if I'd call it an issue with the API -- there is a pretty active debate going on about it: https://github.com/rethinkdb/rethinkdb/issues/256 Please chime in there with your POV, it would really help!

how expensive is the creation of a new connection?

Connections aren't thread safe on the clients. It's very efficient to open a connection to the server, but it still requires a TCP handshake. This is a good low-level API -- we'll build a connection pool on top of that soon (I just opened an issue for it here -- https://github.com/rethinkdb/rethinkdb/issues/281). People seem to want one because they're used to one, but it hasn't really been necessary in our testing.

Re:RethinkDB example apps by arethuza on Saturday February 02, 2013 @04:50AM (#5155638)
I actually prefer the first of those - I find it easy to read than the second one - probably because the calls are chained rather than being nested.
Re:RethinkDB example apps by mercurial on Saturday February 02, 2013 @05:16AM (#5155677)
Alternatively, you could do this:

    g.rdb_conn.table('todos').get(todo_id).run()
On the other hand, this form ties the request to the connection, which neither the current API or my original suggestion do.
Re:RethinkDB example apps by dkhenry on Friday February 01, 2013 @10:13PM (#5154983)
I would love to try out your DB, but your build system is garbage, and I mean that in the most constructive way possible. I know you guys put lots of effort into it, I can tell as I am reading through it trying to get it to compile on my Fedora system. Please for all that is good in this world take the time _now_ and switch to a sane build system. I know its cool that you scripted everything in Make, but this is stupid how hard it is to build on Fedora.

I am putting together a patch and instructions for fedora, but this is silly.

EDIT: https://gist.github.com/4696023 Turned out to not be too big of a change BTW.

Re:RethinkDB example apps by coffeemug on Friday February 01, 2013 @10:55PM (#5155088)
I would love to try out your DB, but your build system is garbage

If you only knew how much we agree with you :) We have an engineer working on that now, so it will soon be much, much nicer. Also, thanks for the instructions, I'll post them on the build page after I confirm everything.

Re:RethinkDB example apps by gnud on Saturday February 02, 2013 @10:25AM (#5156160)
I'm the maintainer of the archlinux AUR pkgbuild - a better build system would be much appreciated :) For now, I do 3-4 sed invocations over your various Makefiles.

If you want to have a look at what we need to hack our way around, take a look at https://aur.archlinux.org/packages/re/rethinkdb/PKGBUILD

Re:RethinkDB example apps by coffeemug on Saturday February 02, 2013 @06:41PM (#5157847)
Thanks -- I've opened an issue for the new build system https://github.com/rethinkdb/rethinkdb/issues/286 and posted this info. We'll try to take it into account as we develop the new one. Please comment if you have feedback/ideas!
Re:RethinkDB example apps by dkhenry on Saturday February 02, 2013 @03:26PM (#5157201)
I am excited to hear that. I know it means pulling resources away from developing features, but seeing the plumbing taken care of properly really lends confidence to those who might be early adopters of a young project.
Re:RethinkDB example apps by nlh on Saturday February 02, 2013 @09:32AM (#5156032)
I continue to be very psyched about RethinkDB - looks like an awesome product coming together nicely.

As a boring non-cutting-edge, non-expert Rails person, any word on projects a la Mongoid to give a nice ActiveRecord-style ODM to guys like us? Would LOVE to be able to play with Rethink in place of Mongo.

(Also, as an aside, if I were about 3 years more advanced in my ruby skills I'd totally volunteer to start that project. But I'm not. So I can't ;)

Keep up the good work guys.

Re:RethinkDB example apps by coffeemug on Saturday February 02, 2013 @06:29PM (#5157813)
There is a Python ORM already (https://github.com/nviennot/nobrainer) but no Ruby one yet. I suspect it would be pretty easy to port Mongoid to rethink, so I wouldn't be surprised if a port pops up soon.

Thanks for your interest -- we'd really love to get everything out ASAP, but the team has limited resources and we have some more low-hanging fruit to take care of first.

Re:RethinkDB example apps by daemon13 on Sunday February 03, 2013 @08:23AM (#5159590)
The link above is to Ruby ORM "nobrainer", may be edit your comment to clarify.

No Python ORM :-(

Re:RethinkDB example apps by a9entroy on Friday February 01, 2013 @11:18PM (#5155141)
Could you make a RethionkDB Heroku Add-On ? I would definitely try it out then.
Re:RethinkDB example apps by coffeemug on Saturday February 02, 2013 @04:53AM (#5155648)
Noted -- we'll try to get that up soon.
Re:RethinkDB example apps by dotmanish on Sunday February 03, 2013 @10:50PM (#5162333)
Heroku Add-Ons are essentially hosted services, just with an automated billing tie-up with Heroku.

What the other comment-er is asking for is a hosted instance.

Re:RethinkDB example apps by omervk on Saturday February 02, 2013 @06:08PM (#5157741)
I really like RethinkDB, but the lack of a driver for JVM languages (Java, Scala, etc.) is a showstopper for me. I read that you're revamping your driver architecture and am anxiously looking forward to a JVM driver (more than willing to write a Scala-friendly wrapper - let me know if you're interested).
Re:RethinkDB example apps by coffeemug on Saturday February 02, 2013 @06:25PM (#5157796)
Thanks -- helping with a Scala wrapper would be great. Only a few weeks left until the new API is out. I wish we got it right on the first release, but hey, better late than never (there was a lot we learned from the first version).
Re:RethinkDB example apps by omervk on Monday February 04, 2013 @05:27AM (#5163384)
Let me know via twitter: @omervk
Re:RethinkDB example apps by ovi256 on Saturday February 02, 2013 @12:44PM (#5156653)
For those interested, there's an Easter egg in the lower right corner, it's that very small lambda icon linking to this Youtube vid:

http://www.youtube.com/watch?v=2ZUNLV7e3vU

"Star Trek - Data asks his creator a question"

Re:RethinkDB example apps by taf2 on Friday February 01, 2013 @09:33PM (#5154876)
this looks great! thank you so much. This gives me what i needed to finally give rethinkdb a try.
[deleted]
Re:RethinkDB example apps by coffeemug on Friday February 01, 2013 @08:45PM (#5154746)
We had lots of people asking "how do I get started with RethinkDB and stack X". These familiar examples can be extremely helpful to people for getting started with a new technology, so we posted a couple based on existing code. Obviously they're not meant to be new or groundbreaking :)
Re:RethinkDB example apps by nkohari on Friday February 01, 2013 @08:45PM (#5154747)
Nice, a negative comment on Hacker News! We don't have enough of those either.
Re:RethinkDB example apps by mercurial on Saturday February 02, 2013 @03:53AM (#5155563)
It's a legitimate question (whatever you think about PHP) considering the size of the user base.
Re:RethinkDB example apps by nkohari on Saturday February 02, 2013 @10:57AM (#5156248)
I wasn't replying to that comment -- the one I was replying to was deleted.
Re:RethinkDB example apps by mercurial on Sunday February 03, 2013 @03:38AM (#5159103)
Ah, my bad. Carry on, then.
Re:RethinkDB example apps by StavrosK on Friday February 01, 2013 @08:45PM (#5154745)
We didn't have any to show off something based on RethinkDB. I'm looking forward to your example app that takes a program and tells you whether or not it will ever finish executing.
Re:RethinkDB example apps by mylittlepony on Saturday February 02, 2013 @12:25AM (#5155279)
Why not PHP? =/
Re:RethinkDB example apps by coffeemug on Saturday February 02, 2013 @04:52AM (#5155645)
It will take a bit of time to get a PHP driver going. Hang on!
Re:RethinkDB example apps by dkhenry on Saturday February 02, 2013 @05:06PM (#5157563)
While I don't know what they have planned. Might I say part of the issue might be PHP's _extremely_ poor protobuf support.
Re:RethinkDB example apps by coffeemug on Saturday February 02, 2013 @06:44PM (#5157853)
There are a few ways to deal with this issue -- contribute to the PHP protobuf library, or have an alternative layer on the server that accepts a more portable but less efficient serialization format. It's a little frustrating, but wouldn't be too difficult to solve.