<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>CKAN: Ticket #1345: Investigate possible memory leak</title>
    <link>http://localhost/ticket/1345</link>
    <description>&lt;p&gt;
There is some evidence pointing to CKAN handling memory inefficiently or even leaking under certain conditions:
&lt;/p&gt;
&lt;p&gt;
When we migrated ckan.net/thedatahub.org from eu7.okfn.org (32bit) to s053.okserver.org (64bit) (&lt;a class="ext-link" href="http://trac.okfn.org/ticket/882"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;ticket&lt;/a&gt;) we experienced extraordinary memory usage peaks (&lt;a class="ext-link" href="http://trac.okfn.org/ticket/904"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;ticket&lt;/a&gt;). Here are the observed value with Apache default settings:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;eu7, mpm-prefork: base level ~0.6GB, peaks up to 2GB
&lt;/li&gt;&lt;li&gt;s055, mpm-prefork: base level ~1GB, peaks up to 4GB
&lt;/li&gt;&lt;li&gt;s055, mpm-worker: base level ~1.5GB, peaks up to 6GB
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
William reduced the life-time of a WSGI CKAN process from 500 requests down to 25 requests (&lt;a class="ext-link" href="https://bitbucket.org/okfn/sysadmin/changeset/126290aead28"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;changeset&lt;/a&gt;). This (together with two other tweaks) changed the situation drastically:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;s055, mpm-event: base level ~1.4GB, no peaks
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
This suggests that the more requests a CKAN processes serves over time, the more memory it consumes, aka bad memory management or a leak.
&lt;/p&gt;
&lt;p&gt;
To prove this theory, one could reduce the total number of WSGI CKAN processes as much as possible without killing the performance (e.g. down to &lt;em&gt;processes=3&lt;/em&gt;), and then observing the relation between &lt;em&gt;maximum-requests=25...500&lt;/em&gt; and memory consumption.
&lt;/p&gt;
&lt;p&gt;
On 14/09/11 17:49, David Read wrote:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
Someone to do a bit of top-down memory-use profiling would be very useful. Also useful would be something in the tests that reported what test cases use lots of memory - this could be in the nose plugin.
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
+1
&lt;/p&gt;
</description>
    <language>en-us</language>
    <image>
      <title>CKAN</title>
      <url>http://assets.okfn.org/p/ckan/img/ckan_logo_shortname.png</url>
      <link>http://localhost/ticket/1345</link>
    </image>
    <generator>Trac 0.12.3</generator>
    <item>
      
        <dc:creator>nils.toedtmann</dc:creator>

      <pubDate>Fri, 25 May 2012 15:55:53 GMT</pubDate>
      <title></title>
      <link>http://localhost/ticket/1345#comment:1</link>
      <guid isPermaLink="false">http://localhost/ticket/1345#comment:1</guid>
      <description>
        &lt;p&gt;
This becomes an actual problem on the CKAN farm s057, see &lt;a class="ext-link" href="http://trac.okfn.org/ticket/1245"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;http://trac.okfn.org/ticket/1245&lt;/a&gt;
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>nils.toedtmann</dc:creator>

      <pubDate>Fri, 01 Jun 2012 11:58:46 GMT</pubDate>
      <title></title>
      <link>http://localhost/ticket/1345#comment:2</link>
      <guid isPermaLink="false">http://localhost/ticket/1345#comment:2</guid>
      <description>
        &lt;p&gt;
See &lt;a class="new ticket" href="http://localhost/ticket/2485" title="defect: Encourage leak containment by limiting the number of requests a CKAN ... (new)"&gt;#2485&lt;/a&gt; for workarounds containing the leak(s).
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>ross</dc:creator>

      <pubDate>Wed, 20 Jun 2012 11:12:17 GMT</pubDate>
      <title>cc, owner, status changed</title>
      <link>http://localhost/ticket/1345#comment:3</link>
      <guid isPermaLink="false">http://localhost/ticket/1345#comment:3</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;cc&lt;/strong&gt;
              &lt;em&gt;thejimmyg&lt;/em&gt; removed
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;owner&lt;/strong&gt;
              changed from &lt;em&gt;dread&lt;/em&gt; to &lt;em&gt;kindly&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;new&lt;/em&gt; to &lt;em&gt;assigned&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Moved out of milestone so that it gets looked at again soon
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>amercader</dc:creator>

      <pubDate>Wed, 25 Jul 2012 11:24:49 GMT</pubDate>
      <title>status changed; resolution set</title>
      <link>http://localhost/ticket/1345#comment:4</link>
      <guid isPermaLink="false">http://localhost/ticket/1345#comment:4</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;assigned&lt;/em&gt; to &lt;em&gt;closed&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;resolution&lt;/strong&gt;
                set to &lt;em&gt;fixed&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
See &lt;a class="ext-link" href="https://github.com/okfn/ckan/pull/73"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;https://github.com/okfn/ckan/pull/73&lt;/a&gt;
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>