<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>source code bean &#187; Mono</title>
	<atom:link href="http://sourcecodebean.com/archives/category/mono/feed" rel="self" type="application/rss+xml" />
	<link>http://sourcecodebean.com</link>
	<description>giving you tricks and tips of good coding</description>
	<lastBuildDate>Sun, 06 Jun 2010 16:40:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>An update on the mono memory issue</title>
		<link>http://sourcecodebean.com/archives/an-update-on-the-mono-memory-issue/184</link>
		<comments>http://sourcecodebean.com/archives/an-update-on-the-mono-memory-issue/184#comments</comments>
		<pubDate>Wed, 13 May 2009 13:21:16 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=184</guid>
		<description><![CDATA[The workaround I tested a few weeks ago did not really solve my problem – actually it made it worse. The autorestart caused mono to hang and not restart at all, so my site stopped responding every 6th hour. I quickly had to disable this. Still I had the memory consumption problems. From various sources [...]]]></description>
			<content:encoded><![CDATA[<p>The workaround I tested a <a href="http://sourcecodebean.com/archives/mod-mono-server2-memory-consumption-problems">few weeks ago</a> did not really solve my problem – actually it made it worse. The autorestart caused mono to hang and not restart at all, so my site stopped responding every 6th hour. I quickly had to disable this. Still I had the memory consumption problems. From various sources I was told that the memory issues would be fixed in the recently released mono 2.4. Also I found a <a href="https://bugzilla.novell.com/show_bug.cgi?id=472732">bug report</a> regarding AutoRestart, which also should have been fixed in 2.4. So I decided to give Mono 2.4 a try.<br />
The problem was that there were no packages for Ubuntu 8.10, so I had to download the sources and build my own deb packages. I found this great <a href="http://go-mono.com/forums/#nabble-p22841086">blog post</a> that describes the process of building and installing Mono 2.4. </p>
<p>So far it seems to be working, but it is too early to say if the memory consumption issues are resolved. </p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/an-update-on-the-mono-memory-issue/184/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>mod-mono-server2 memory consumption problems</title>
		<link>http://sourcecodebean.com/archives/mod-mono-server2-memory-consumption-problems/121</link>
		<comments>http://sourcecodebean.com/archives/mod-mono-server2-memory-consumption-problems/121#comments</comments>
		<pubDate>Tue, 31 Mar 2009 21:21:49 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=121</guid>
		<description><![CDATA[Lately I have been experiencing that the mod-mono-server2 process running on the server hosting the video upload web-service (I blogged about this in my last post) has been consuming a lot of memory. Once, it even reached the point where all memory (1.5GB) of the server was consumed and the Linux OOM-killer killed the mod-mono-server2 [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I have been experiencing that the mod-mono-server2 process running on the server hosting the video upload web-service (I blogged about this in my last post) has been consuming a lot of memory. Once, it even reached the point where all memory (1.5GB) of the server was consumed and the Linux OOM-killer killed the mod-mono-server2 process. At this point apache failed to restart it. If you are interested you can see the kernel log <a href='http://sourcecodebean.com/wp-content/uploads/2009/03/kern.log'>here</a> and the apache log <a href='http://sourcecodebean.com/wp-content/uploads/2009/03/apache.log'>here</a>. The mono version I am using is mono-apache-server2 1.9.1-2 (Ubuntu 8.10 Intrepid).</p>
<p>I googled the issue and found some information on the <a href="http://www.mono-project.com/Mod_mono">mod_mono</a> page:</p>
<blockquote><p><strong>Under high load, mono process consumes a lot of memory, website stops responding</strong><br />
These symptoms have been reported, but their underlying causes are not known. Set the MonoAutoRestartMode, MonoAutoRestartRequests, MonoMaxActiveRequests, and MonoMaxWaitingRequests directives as described earlier to limit the lifetime of the mono process and to restrict the concurrency happening in the server. </p></blockquote>
<p>The above describes my issue pretty well, except for the &#8220;under high load&#8221; part. The video transcoding service is still in beta and is only used by one customer so far. It serves around 500 requests a day, which is not a lot, so I wouldn&#8217;t expect this kind of behavior. My guess is that every time a file is uploaded using the UploadFile webmethod additional memory is allocated, but not properly released/reused by mono. </p>
<p><del datetime="2009-05-13T13:26:11+00:00">As a workaround for this I will have the mod-mono-server2 process restart restart every 6th hour. This can be done by adding the following lines to <code>/etc/apache2/mods-enabled/mod_mono.conf</code>:</del> Update: This did not work, caused my site to hang entirely every 6th hour. </p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">MonoAutoRestartMode <a href="http://www.php.net/time"><span class="kw3">Time</span></a></div>
</li>
<li class="li1">
<div class="de1">MonoAutoRestartRequests <span class="nu0">00</span>:<span class="nu0">06</span></div>
</li>
</ol>
</div>
<p>Hopefully this will limit the memory usage, for now. I would appreciate feedback from anyone who have experienced similar problems on mono. </p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/mod-mono-server2-memory-consumption-problems/121/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Building a distributed web service using Amazon Web Services</title>
		<link>http://sourcecodebean.com/archives/building-a-distributed-web-service-using-amazon-web-services/93</link>
		<comments>http://sourcecodebean.com/archives/building-a-distributed-web-service-using-amazon-web-services/93#comments</comments>
		<pubDate>Sun, 22 Mar 2009 18:18:08 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Amazon Web Services]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=93</guid>
		<description><![CDATA[A few months ago my employer asked me if it would be possible to create a web service for encoding videos. I had been playing around with Amazon&#8217;s web services for a while, and it seemed like the perfect foundation for building this.
I decided to build the backend in Python and use ffmpeg for encoding [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago my employer asked me if it would be possible to create a web service for encoding videos. I had been playing around with Amazon&#8217;s web services for a while, and it seemed like the perfect foundation for building this.</p>
<p>I decided to build the backend in Python and use ffmpeg for encoding movies. I looked into building the web service frontend in Python as well, but the SOAP libraries I could find for Python did not seem very mature or maintained. Instead I started thinking about building it in ASP.NET (I had previous experiences from building web services in ASP.NET). After some research and testing with Apache and Mono (I wanted to use Linux VMs only) I decided to develop the frontend in ASP.NET but host it on Apache.</p>
<p>To make the service scalable I decided to break it down into several parts and use message passing between the different parts. The parts I broke it down into are:</p>
<ul>
<li>Web service frontend – what the user calls to encode a movie. Implemented in ASP.NET, hosted on Apache/Mono on Linux.</li>
<li>Encode Worker – A python process managing the encoding of videos.</li>
<li>Encode Master – Manages number of running Encode Workers. Implemented in Python.</li>
</ul>
<p>When a movie gets uploaded to the web service frontend it gets placed into the encode queue. The encode workers periodically checks if there is anything in the queue, and if it is encodes it. The Encode Master manages the number of running Encode Workers (based on the current length of the encode queue). If the queue growes to long, we just fire up a few new VMs running the worker. </p>
<p> This is a schematic view of how the service has been implemented and how the different components are related to the Amazon services:</p>
<p><img class="size-large wp-image-92" title="Video Encoding Service" src="http://sourcecodebean.com/wp-content/uploads/2009/03/dqcvideo-1024x535.png" alt="Video Encoding Service" width="650" /></p>
<p>Right now we are implementing the solution for our first customer, pretty existing I must say! In an upcoming post I will discuss the different libraries for Python and ASP.NET I used for communicating with the Amazon Web Services.</p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/building-a-distributed-web-service-using-amazon-web-services/93/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
