Google Groups Home
Help | Sign in
threading the Gateway.publish method
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Adam Greene  
View profile
 More options Jun 4, 12:37 am
From: Adam Greene <adam.gre...@gmail.com>
Date: Tue, 3 Jun 2008 21:37:18 -0700 (PDT)
Local: Wed, Jun 4 2008 12:37 am
Subject: threading the Gateway.publish method
hey guys,
is there any reason why not to thread/fork within the Gateway/publish
method?

I'm using aSQS, and there is a noticeable latency, especially if the
retry logic is engaged.  I'm wrapping my publish calls with a fork
(using spawn), but the fact that this wasn't already done makes me
wonder if I'm missing a 'gotcha'.

Is there any reason why it isn't threaded at the publish call?  If
not, should I submit a patch?
Thanks folks,
Adam

----
SweetSpot.dm -- Diabetes Wellness for the Family
http://www.SweetSpot.dm
http://blog.SweetSpot.dm


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cliff Moon  
View profile
 More options Jun 4, 12:47 am
From: "Cliff Moon" <anti.god.bothe...@gmail.com>
Date: Tue, 3 Jun 2008 21:47:53 -0700
Local: Wed, Jun 4 2008 12:47 am
Subject: Re: threading the Gateway.publish method

Forking there is an exceptionally bad idea, since you're creating two copies
of your mongrel, and copy-on-write semantics are effectively broken in
ruby.  So after you fork your mongrel, if the forked copy runs a GC it will
force the OS to make a copy of it's memory, which is somewhere north of 50
megs (probably a good bit more.)

Threading inside of publish may not be the best strategy.  One thing you
could do is spin up two threads and call join on them.  One thread can call
publish and another can do any rendering/database/other work that needs to
happen.  Probably one of the simplest ways to mitigate the latency, however,
is to move the call to an asynchronous XHR from the client, so that users
don't notice it as much.  However that isn't always possible.  Hope that
helps.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adam Greene  
View profile
 More options Jun 4, 12:54 am
From: Adam Greene <adam.gre...@gmail.com>
Date: Tue, 3 Jun 2008 21:54:14 -0700 (PDT)
Local: Wed, Jun 4 2008 12:54 am
Subject: Re: threading the Gateway.publish method
thanks Cliff for the input!  I *completely* forgot about the forking
issue; there was the 'gotcha' I was looking for!

XHR is a good idea; it isn't applicable for all parts, but the main
one I'm worried about will fit this model quite well.

cheers!
Adam

On Jun 3, 9:47 pm, "Cliff Moon" <anti.god.bothe...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google