If you create an instance with an object with a __del__ method and a self 
reference (of if a module that you use creates an instance of such object), 
Python cannot collect it. Python uses reference counting and it cannot 
collect objects with self references and a del method. Depending on how big 
the object is, the memory would pile up. Even our explicit calls to gc does 
not help. Web2py opjects do have a __del__ method for this reason.

On Tuesday, 23 October 2012 15:54:51 UTC-5, Marin Pranjić wrote:
>
> I have 4 apache processes running. One is run by a root and other 3 are 
> owned by www-data.
> I will try your suggestion.
>
> Minor update:
> hitting examples app does not cause any issues (CPU is low and memory is 
> stable)
>
> welcome app has slow memory increase
> - I started with freshly restarted apache, 125Mb of memory used
> - Reloading a page for one minute increased memory usage up to 190Mb.
> - CPU was hitting the 100% limit but the hosting has a low CPU power 
> available and I'm less worried about CPU
>
> Welcome app is very simple. I have much worse scenario with a real app, as 
> mentioned before.
>
> Not sure what happens after a minute because everything (including shell 
> and htop) becomes unresponsive because of a CPU issue.
>
> I will have to do some more testing. This time on my local computer where 
> I can use much more resources.
> I will update this thread with the results.
>
> Thank you for your help
>
>
> On Tue, Oct 23, 2012 at 10:02 PM, Niphlod <[email protected] 
> <javascript:>>wrote:
>
>> Disclaimer: really not trying to be the devil's advocate here, but it's 
>> really unclear to me why with uwsgi I can't see any memory leak (and it's 
>> not set to restart itself on high memory usage) with over 2millions 
>> requests.
>>
>> You are confirming that configuring correctly htop you see only 2 apache 
>> processes and the rest are all threads ? How is it that they show different 
>> PIDs ? 
>> Disclaimer2: No expert on apache here, but I've seen my fair share and I 
>> can assume I can read properly the docs (
>> http://httpd.apache.org/docs/2.2/mod/worker.html).
>>
>> You values means:
>> Start with 2 processes (StartServer), 25 threads each (ThreadsPerChild). 
>> When there are less than 25 threads available (MinSpareThreads), spawn 
>> processes until at least 25 threads on total are free. 
>> Reap a process when there are 75 threads doing nothing (MaxSpareThreads). 
>> You can serve concurrently at most 150 clients (MaxClient), so you can 
>> end up with 150/25 processes (6) in normal statuses. 
>> Apache should never recycle processes because of the MaxRequestsPerChild 
>> 0 directive.
>>
>> It's unclear to me that the following behaviour (seems the one happening 
>> to you):
>> """
>> if only one thread is terminating on one process serving a response, you 
>> may have more than one "terminating processes" (up to 150 (MaxClients)).  
>> """
>> is avoided setting just MaxRequestsPerChild = 0 (like in your config) or 
>> setting also MaxSpareThreads = MaxClients.
>>  
>> Anyway, you don't have in place the ServerLimit directive that cuts off 
>> the maximum number of processes spawned by apache (you should set it to a 
>> value going from 6 to whatever you want, but just to try I'd set 
>> MaxSpareThreads to 150 and if the same behaviour happens, I'd set 
>> ServerLimit to 6)
>>
>>  -- 
>>  
>>  
>>  
>>
>
>

-- 



Reply via email to