<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Erlang Pattern: The Router</title>
	<atom:link href="http://weblog.hypotheticalabs.com/?feed=rss2&#038;p=528" rel="self" type="application/rss+xml" />
	<link>http://weblog.hypotheticalabs.com/?p=528</link>
	<description>Improving the world, hypothetically</description>
	<lastBuildDate>Thu, 19 Aug 2010 15:28:34 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: kevin</title>
		<link>http://weblog.hypotheticalabs.com/?p=528&#038;cpage=1#comment-2831</link>
		<dc:creator>kevin</dc:creator>
		<pubDate>Mon, 19 Oct 2009 21:47:25 +0000</pubDate>
		<guid isPermaLink="false">http://weblog.hypotheticalabs.com/?p=528#comment-2831</guid>
		<description>@Dizzy - I&#039;ll have to think about this a bit. I knew going into this that we&#039;d get bogus timeout messages but for what we were doing that was acceptable. We have fairly robust logging so between the data in the message and the log output we can debug timeouts.

@Hunter - The lookup was a simple ETS table which contained some metadata about the service (interface version, acceptable messages, etc). We used monitors to determine when to remove a service and judicious use of pg2 to sync up information across the cluster.</description>
		<content:encoded><![CDATA[<p>@Dizzy &#8211; I&#8217;ll have to think about this a bit. I knew going into this that we&#8217;d get bogus timeout messages but for what we were doing that was acceptable. We have fairly robust logging so between the data in the message and the log output we can debug timeouts.</p>
<p>@Hunter &#8211; The lookup was a simple ETS table which contained some metadata about the service (interface version, acceptable messages, etc). We used monitors to determine when to remove a service and judicious use of pg2 to sync up information across the cluster.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hunter Morris</title>
		<link>http://weblog.hypotheticalabs.com/?p=528&#038;cpage=1#comment-2830</link>
		<dc:creator>Hunter Morris</dc:creator>
		<pubDate>Mon, 19 Oct 2009 21:14:41 +0000</pubDate>
		<guid isPermaLink="false">http://weblog.hypotheticalabs.com/?p=528#comment-2830</guid>
		<description>I like this.

What was the lookup mechanism in the recent implementation you talked about?  I&#039;m interested in how the &quot;target&quot; processes notify the lookup bookkeeping about their deaths.</description>
		<content:encoded><![CDATA[<p>I like this.</p>
<p>What was the lookup mechanism in the recent implementation you talked about?  I&#8217;m interested in how the &#8220;target&#8221; processes notify the lookup bookkeeping about their deaths.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dizzy</title>
		<link>http://weblog.hypotheticalabs.com/?p=528&#038;cpage=1#comment-2829</link>
		<dc:creator>Dizzy</dc:creator>
		<pubDate>Mon, 19 Oct 2009 19:49:48 +0000</pubDate>
		<guid isPermaLink="false">http://weblog.hypotheticalabs.com/?p=528#comment-2829</guid>
		<description>I&#039;ll admit that this pattern bugs me a bit.  The root of my discomfort is the fact that you&#039;re doing a gen:call on the router process, which causes the caller to setup a monitor on that (router) process. However, what we REALLY want to monitor is the target process. After all, if the target crashes, we&#039;ll never know how/why -- we&#039;ll just get a timeout from the router, which is misleading to say the least. 

So there are two options, I suppose:
1. Do a call to get the target PID, followed by a call to that process
2. Do a cast to the router which in turn does a cast to the target

The downside with 1 is increased latency (likely). However, you get more meaningful errors, which in my book, is worth a bit of latency. Option 2 makes it impossible to know if the router or target actually recv&#039;d the message.

A third option would be to split the difference like so:
1. Setup monitor on router
2. Cast request to router
3. Recv status notif from router with target pid
4. Setup monitor on target (delete router monitor)
5. Recv completion notice from target

This way you would know where the message fails, with slightly better concurrency. But you&#039;d have to show me a pretty convincing chunk o&#039; profiling to justify that over option 1. :)

My $0.02. :)

D.</description>
		<content:encoded><![CDATA[<p>I&#8217;ll admit that this pattern bugs me a bit.  The root of my discomfort is the fact that you&#8217;re doing a gen:call on the router process, which causes the caller to setup a monitor on that (router) process. However, what we REALLY want to monitor is the target process. After all, if the target crashes, we&#8217;ll never know how/why &#8212; we&#8217;ll just get a timeout from the router, which is misleading to say the least. </p>
<p>So there are two options, I suppose:<br />
1. Do a call to get the target PID, followed by a call to that process<br />
2. Do a cast to the router which in turn does a cast to the target</p>
<p>The downside with 1 is increased latency (likely). However, you get more meaningful errors, which in my book, is worth a bit of latency. Option 2 makes it impossible to know if the router or target actually recv&#8217;d the message.</p>
<p>A third option would be to split the difference like so:<br />
1. Setup monitor on router<br />
2. Cast request to router<br />
3. Recv status notif from router with target pid<br />
4. Setup monitor on target (delete router monitor)<br />
5. Recv completion notice from target</p>
<p>This way you would know where the message fails, with slightly better concurrency. But you&#8217;d have to show me a pretty convincing chunk o&#8217; profiling to justify that over option 1. :)</p>
<p>My $0.02. :)</p>
<p>D.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
