Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
To: Rainbows! list <rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org>
Subject: Re: rainbows for 3rd party api
Date: Fri, 6 Nov 2009 19:20:20 +0000	[thread overview]
Message-ID: <20091106192020.GA11050@dcvr.yhbt.net> (raw)
In-Reply-To: <2007122a0911060240j105c1fcfgfebb2c5757cf7fd1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Giovanni Lion <giovanni.lion-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Fri, Nov 6, 2009 at 12:06 AM, Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org> wrote:
> > Giovanni Lion <giovanni.lion-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >> 4) I write the response to memcached
> >> 5) I call the rails app who now fetches from cache the friend list
> >> 6) The rails app renders the partial and everybody is happy
> >>
> >> Do you think this is a good flow? Should I create a specific method instead?
> >
> > Depends on the rest of your app, I guess.  Is your Rails app
> > reentrant?  If so, definitely go for it.  If you're dealing
> > with DB connections in there, compatibility will probably be
> > better with the ThreadPool or ThreadSpawn models unless somebody
> > writes Revactor-enabled DB libraries.
> 
> Well, I do have a db in there but it's just one users table, which i
> really need only to pair the facebook id to the oauth tokens to make
> the api calls. Unfortunately it's a 3-legged oauth so i'm kinda stuck
> with having my own db. I'm testing now something like this:
> 
> map("/3rd_party/friends") do
>   use Rack::Facebook #checking the fb signature
>   run lambda { |env|
>     request = Rack::Request.new(env)
>     return Rack::Response.new(["Invalid Facebook signature"],
> 400).finish unless request.POST['fb_sig']
>     user = User.find_by_fb_id(request.POST['fb_sig_user']) #db query
>     ...
>     oauth_stuff_i_am_still_working_on
>     ....
>   }
> end
> 
> Will rails connection pool mess things up if used in an actor? Right
> now I'm really much more worried about the app being blocked in the
> http call as the third party is acting wonky lately. Db load is not a
> worry for now.
> 
> Let me know your thoughts while I get the oauth - revactor http going.

I don't think there's any need to worry if your DB queries are fast and
predictable in performance.  Let us know how everything goes.  3rd-party
API calls often pose a scalability issue that Rainbows! is designed to
solve.

-- 
Eric Wong

      parent reply	other threads:[~2009-11-06 19:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04 18:49 rainbows for 3rd party api Giovanni Lion
     [not found] ` <2007122a0911041049u2b4376dbpd3b1f727e315ea88-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-11-04 21:40   ` Eric Wong
     [not found]     ` <20091104214018.GA25942-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2009-11-05 13:03       ` Giovanni Lion
     [not found]         ` <2007122a0911050503x5740cf3ei4f1185b4cb895298-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-11-05 23:06           ` Eric Wong
     [not found]             ` <20091105230638.GA7131-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2009-11-06 10:40               ` Giovanni Lion
     [not found]                 ` <2007122a0911060240j105c1fcfgfebb2c5757cf7fd1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-11-06 19:20                   ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/rainbows/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091106192020.GA11050@dcvr.yhbt.net \
    --to=normalperson-rmlxzr9ms24@public.gmane.org \
    --cc=rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/rainbows.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).