Contrast to Python's gevent

23 views
Skip to first unread message

Martin Konecny

unread,
Feb 1, 2015, 9:35:02 PM2/1/15
to golia...@googlegroups.com
I've been doing some research on Goliath, and seems like something I will want to migrate over to soon. My question is, one of the promises of Goliath is that it "preserves the look and feel of a synchronous API!". 

However from the examples, I see that I still need to use em-synchrony, em-http etc. One of the reasons I'm looking into moving away from thin, is because of the poor official evented library support for some databases (i.e mongo)

When working with gevent in Python, the gevent library will monkey-patch all socket calls and automatically cause the current fiber/greenlet to yield to another fiber/greenlet anytime a blocking network operation initiates. This causes it to work with almost every database driver without any work required from said driver's authors. Am I correct that goliath does not work like this?

Is it correct that Goliath still needs em-* libraries/drivers for any blocking network operations, but it's advantage over thin is that you don't need to write callbacks for these, instead it is code that can be linearly written?

Regards,
Martin

Eric Marden

unread,
Feb 2, 2015, 11:43:03 AM2/2/15
to golia...@googlegroups.com
You can use Goliath with blocking i/o libs — but it does defeat some of the performance gain (over say something like Sinatra). You’ll still be able to take advantage of the asynchronous middleware layer which has it’s own benefits even when your db calls block the reactor. I’ve used both Mongoid (v2) and em-mongo (https://github.com/igrigorik/em-synchrony/blob/master/lib/em-synchrony/em-mongo.rb) with Goliath and while it was a bit more work to use em-mongo, the results were better enough, in terms of throughput, to put up with the extra effort. YMMV, of course.


--
Eric Marden
http://ericmarden.com
--------------------------------
PGP Public Key: http://xentek.net/xentek.gpg
> --
> You received this message because you are subscribed to the Google Groups "Goliath.io (http://Goliath.io)" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to goliath-io+...@googlegroups.com (mailto:goliath-io+...@googlegroups.com).
> For more options, visit https://groups.google.com/d/optout.



Reply all
Reply to author
Forward
0 new messages