<?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"
	>
<channel>
	<title>Comments on: Great Concurrency -&gt; Better Webapps</title>
	<atom:link href="http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/feed/" rel="self" type="application/rss+xml" />
	<link>http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/</link>
	<description>Adventures in Open Source Erlang</description>
	<pubDate>Fri, 16 May 2008 04:18:48 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Yariv</title>
		<link>http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-58271</link>
		<dc:creator>Yariv</dc:creator>
		<pubDate>Sat, 10 Nov 2007 19:55:41 +0000</pubDate>
		<guid isPermaLink="false">http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-58271</guid>
		<description>I know it's not an optimally efficient solution, but it's good enough, at least for a site that doesn't get thousands of requests/sec.  Having a background process that listens for updates and executes queries only saves you 320 bytes or so of RAM (the size of an Erlang process) per request (Erlang processes are dirt-cheap). If the background process also batched updates, the efficiency would be greater because it would result in fewer queries. Instead of updating every N hits, I would make it update every N seconds. This way I would throttle the number of update queries while guaranteeing a time ceiling for persisting even low numbers of updates. However, this is an optimization that I don't think Vimagi requires right now.</description>
		<content:encoded><![CDATA[<p>I know it&#8217;s not an optimally efficient solution, but it&#8217;s good enough, at least for a site that doesn&#8217;t get thousands of requests/sec.  Having a background process that listens for updates and executes queries only saves you 320 bytes or so of RAM (the size of an Erlang process) per request (Erlang processes are dirt-cheap). If the background process also batched updates, the efficiency would be greater because it would result in fewer queries. Instead of updating every N hits, I would make it update every N seconds. This way I would throttle the number of update queries while guaranteeing a time ceiling for persisting even low numbers of updates. However, this is an optimization that I don&#8217;t think Vimagi requires right now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jherber</title>
		<link>http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-58221</link>
		<dc:creator>jherber</dc:creator>
		<pubDate>Sat, 10 Nov 2007 18:03:28 +0000</pubDate>
		<guid isPermaLink="false">http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-58221</guid>
		<description>this is a bad approach.  

it is terribly inefficient.  why not launch a persistent process that does nothing listen for update request messages and write to the db. messaging in erlang is asynchronous, so the code doesn't block.

*bonus*  the other thing you are doing wrong is updating the db on every hit.  you should update the database after say every N hits, where N is a small number who's precision you are comfortable with losing if you have a catastrophic failure (10? 100?).

please keep updating your blog.  erlang is looks very promising so there is building interest in your thoughts, prolbems, and solutions.</description>
		<content:encoded><![CDATA[<p>this is a bad approach.  </p>
<p>it is terribly inefficient.  why not launch a persistent process that does nothing listen for update request messages and write to the db. messaging in erlang is asynchronous, so the code doesn&#8217;t block.</p>
<p>*bonus*  the other thing you are doing wrong is updating the db on every hit.  you should update the database after say every N hits, where N is a small number who&#8217;s precision you are comfortable with losing if you have a catastrophic failure (10? 100?).</p>
<p>please keep updating your blog.  erlang is looks very promising so there is building interest in your thoughts, prolbems, and solutions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yariv</title>
		<link>http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-50992</link>
		<dc:creator>Yariv</dc:creator>
		<pubDate>Thu, 11 Oct 2007 05:56:40 +0000</pubDate>
		<guid isPermaLink="false">http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-50992</guid>
		<description>@Nathan, I've read of benchmarks where people ran 1-2 million Erlang processes on a single box. The 80,000 number came from Joe Armstrong's benchmark of Yaws, which showed Yaws can support ~80,000 mostly idle processes with relatively stable total throughput. However, that doesn't mean you can't run more than 80,000 processes on a server.</description>
		<content:encoded><![CDATA[<p>@Nathan, I&#8217;ve read of benchmarks where people ran 1-2 million Erlang processes on a single box. The 80,000 number came from Joe Armstrong&#8217;s benchmark of Yaws, which showed Yaws can support ~80,000 mostly idle processes with relatively stable total throughput. However, that doesn&#8217;t mean you can&#8217;t run more than 80,000 processes on a server.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bmert</title>
		<link>http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-49907</link>
		<dc:creator>bmert</dc:creator>
		<pubDate>Sat, 06 Oct 2007 18:59:22 +0000</pubDate>
		<guid isPermaLink="false">http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-49907</guid>
		<description>@Bryan, how do you handle sessions while updating facebook user profiles. Do you need a permanent session for that?</description>
		<content:encoded><![CDATA[<p>@Bryan, how do you handle sessions while updating facebook user profiles. Do you need a permanent session for that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan Youngman</title>
		<link>http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-48808</link>
		<dc:creator>Nathan Youngman</dc:creator>
		<pubDate>Mon, 01 Oct 2007 03:13:23 +0000</pubDate>
		<guid isPermaLink="false">http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-48808</guid>
		<description>@Yariv: But is it worth it to write a web application in a concurrent way? With a lot of traffic, it might be better to dedicate those 80,000 lightweight processes to individual requests, no?

I guess it depends on how much can be gained in response time. Perhaps on big reports with a lot of data fetching. If the queries can't run any faster, it could be fairly trivial to run them asynchronously.

I'm curious about a few things... like how Yaws compares to light-weight web servers like Lighttpd or Nginx.

Also, has anyone considered working with Flex/Flash/AMF3? LiveCycle Data Services has the idea of users concurrently editing data-grids and such, but it's pricey and from what I've heard, not the most stable yet. Erlang seems like a good fit for a server that handles the large number of connections... and could provide a full-stack from web server down to data store. Flash seems a little more well-suited for a lot of client-side concurrency, and open connections (Comet). Though perhaps that isn't desirable, since concurrency in Flash isn't as nice to work with as Erlang (mind you, neither is JavaScript).

- nathan.</description>
		<content:encoded><![CDATA[<p>@Yariv: But is it worth it to write a web application in a concurrent way? With a lot of traffic, it might be better to dedicate those 80,000 lightweight processes to individual requests, no?</p>
<p>I guess it depends on how much can be gained in response time. Perhaps on big reports with a lot of data fetching. If the queries can&#8217;t run any faster, it could be fairly trivial to run them asynchronously.</p>
<p>I&#8217;m curious about a few things&#8230; like how Yaws compares to light-weight web servers like Lighttpd or Nginx.</p>
<p>Also, has anyone considered working with Flex/Flash/AMF3? LiveCycle Data Services has the idea of users concurrently editing data-grids and such, but it&#8217;s pricey and from what I&#8217;ve heard, not the most stable yet. Erlang seems like a good fit for a server that handles the large number of connections&#8230; and could provide a full-stack from web server down to data store. Flash seems a little more well-suited for a lot of client-side concurrency, and open connections (Comet). Though perhaps that isn&#8217;t desirable, since concurrency in Flash isn&#8217;t as nice to work with as Erlang (mind you, neither is JavaScript).</p>
<p>- nathan.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yariv</title>
		<link>http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-48333</link>
		<dc:creator>Yariv</dc:creator>
		<pubDate>Sun, 30 Sep 2007 01:38:30 +0000</pubDate>
		<guid isPermaLink="false">http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-48333</guid>
		<description>The traffic numbers aren't very high. I don't know exactly why MySQL started timing out, but it may be because the VPS has little RAM and/or the MySQL server isn't well tuned. There was definitely a gradual degradation of response time from MySQL when the site went live, though.

I know, this captcha plugin sucks. I tried finding a better one but couldn't find one that worked well.</description>
		<content:encoded><![CDATA[<p>The traffic numbers aren&#8217;t very high. I don&#8217;t know exactly why MySQL started timing out, but it may be because the VPS has little RAM and/or the MySQL server isn&#8217;t well tuned. There was definitely a gradual degradation of response time from MySQL when the site went live, though.</p>
<p>I know, this captcha plugin sucks. I tried finding a better one but couldn&#8217;t find one that worked well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ajrw</title>
		<link>http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-48032</link>
		<dc:creator>ajrw</dc:creator>
		<pubDate>Fri, 28 Sep 2007 19:38:42 +0000</pubDate>
		<guid isPermaLink="false">http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-48032</guid>
		<description>Out of curiosity, how much traffic are we talking about here?

Your spam prevention input box keeps sending me back to the comment box when I try to type in it, I had to copy and paste the captcha.</description>
		<content:encoded><![CDATA[<p>Out of curiosity, how much traffic are we talking about here?</p>
<p>Your spam prevention input box keeps sending me back to the comment box when I try to type in it, I had to copy and paste the captcha.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yariv</title>
		<link>http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-47904</link>
		<dc:creator>Yariv</dc:creator>
		<pubDate>Fri, 28 Sep 2007 09:09:35 +0000</pubDate>
		<guid isPermaLink="false">http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-47904</guid>
		<description>@Nathan: I think you're on the right track. If your webpage has independent components that can be rendered in parallel, why not use concurrent processes to speed things up? It's certainly doable.

@Robin: Mnesia is great for datasets that fit in RAM, but it's not so great for high-volume data that should be stored on disc. The good thing about Erlang/ErlyWeb is that you can have the best of both worlds. Vimagi, for example, uses MySQL for persistent storage and Mnesia for storing session data.</description>
		<content:encoded><![CDATA[<p>@Nathan: I think you&#8217;re on the right track. If your webpage has independent components that can be rendered in parallel, why not use concurrent processes to speed things up? It&#8217;s certainly doable.</p>
<p>@Robin: Mnesia is great for datasets that fit in RAM, but it&#8217;s not so great for high-volume data that should be stored on disc. The good thing about Erlang/ErlyWeb is that you can have the best of both worlds. Vimagi, for example, uses MySQL for persistent storage and Mnesia for storing session data.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin</title>
		<link>http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-47552</link>
		<dc:creator>Robin</dc:creator>
		<pubDate>Thu, 27 Sep 2007 01:11:12 +0000</pubDate>
		<guid isPermaLink="false">http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-47552</guid>
		<description>Good point: Significant tasks that are not in the critical path should be executed concurrently, which is trivial in Erlang.

I am sure many ErlyWeb developers are facing a design decision: SQL or Mnesia.  

If  Great Concurrency -&#62; Better Webapps, then why does Vimagi opt for SQL, when Mnesia is there at your fingertips?</description>
		<content:encoded><![CDATA[<p>Good point: Significant tasks that are not in the critical path should be executed concurrently, which is trivial in Erlang.</p>
<p>I am sure many ErlyWeb developers are facing a design decision: SQL or Mnesia.  </p>
<p>If  Great Concurrency -&gt; Better Webapps, then why does Vimagi opt for SQL, when Mnesia is there at your fingertips?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan Youngman</title>
		<link>http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-47543</link>
		<dc:creator>Nathan Youngman</dc:creator>
		<pubDate>Thu, 27 Sep 2007 00:16:03 +0000</pubDate>
		<guid isPermaLink="false">http://yarivsblog.com/articles/2007/09/25/great-concurrency-better-webapps/#comment-47543</guid>
		<description>Yariv,

I haven't actually learned Erlang yet, just have been reading *about* it. I would be interested in your thoughts on implementing the above sort of things?

One could also spawn a task to load up the various templates (views). Could you then "block" until the model data was ready... do a quick variable substitution and return the response?

When a query finishes, it can message the main process, right? But how does it ensure that all tasks it sent off are done and ready?

- nathan.</description>
		<content:encoded><![CDATA[<p>Yariv,</p>
<p>I haven&#8217;t actually learned Erlang yet, just have been reading *about* it. I would be interested in your thoughts on implementing the above sort of things?</p>
<p>One could also spawn a task to load up the various templates (views). Could you then &#8220;block&#8221; until the model data was ready&#8230; do a quick variable substitution and return the response?</p>
<p>When a query finishes, it can message the main process, right? But how does it ensure that all tasks it sent off are done and ready?</p>
<p>- nathan.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
