Forum OpenACS Development: Re: maxidle and maxopen

Collapse
9: Re: maxidle and maxopen (response to 8)
Posted by Maurizio Martignano on
Dear Gustaf,
thanks a lot for your reply.

Some few weeks ago I published a post about having some memory allocation problems with aolserver/openacs. Initially I thought these problems were due to the aolserver/TCL allocator (i.e. the standard mechanism, or Zippy - the default one, or VTMalloc). But then I observed that the majority of the menory was consumed by PostgreSQL connections. By setting the parameters MaxIdle and MaxOpen to their defualt values (600 and 3600) I managed to fix this problem.

I would recommend to update accordingly these parameters in the standard startup file "congig.tcl" which gets shipped together with the OpenACS distribution(s). This way newbies like me won't fall again in this memory problem and invest a lot of time and resources trying to solve it.

Thanks a lot in advance,
Maurizio

Collapse
10: Re: maxidle and maxopen (response to 9)
Posted by Gustaf Neumann on
Maurizio,

this is very interesting. I'll try this on my configurations and check, how the memory behavior changes...

Collapse
11: Re: maxidle and maxopen (response to 10)
Posted by Maurizio Martignano on
Gustaf,
I'll be very interested in knowing your results.
BTW: While you're working on this issue, I noticed that changing the "connections" parameters from 5 to 1 might also help in reducing the memory occupation.

Cheers and thanks,
Maurizio

Collapse
12: Re: maxidle and maxopen (response to 11)
Posted by Gustaf Neumann on
"working" is an exaggeration. On four of my installations, i have commented out the maxopen/maxidle statements, falling back to the default values of aolserver. So far, i have not noticed significant differences, but its (a) sunday and (b) to early to tell.

Btw, reducing connections from 5 to 1 might reduce memory, but the same time your are reducing greatly the ability to run db-queries in parallel. If you have multiple http requests running, and all of these require handles from the pools, and you have ony 1 connection configured, the queries are sequentialized, since each query has to wait until a db connection is available. This means that he waiting time for handles will go up. If most of your http requests use the database the value for maxthreads must be aligned with connections. On our main site, we have 90 connections configured.

Collapse
13: Re: maxidle and maxopen (response to 12)
Posted by Maurizio Martignano on
Dear Gustaf, thanks a lot. I'll be waiting for some additional tests from yuor side. Please let me know what is the amount of the differences you noticed, if any.

I do agree that the change in the "connection" value reduces the ability to run db-quesires in parallel.

Cheers and thanks,
MAurizio

Collapse
14: Re: maxidle and maxopen (response to 13)
Posted by Gustaf Neumann on
Maurizio,

there are no significant changes on my sites. I altered the configuration between Sat. and Sun. On Sat we had 421370 hits, on Sun 488751. The chart shows that the growth of the virtual size is happening with and without the MaxIdle/MaxOpen = 0 settings: http://media.wu-wien.ac.at/download/nsdsize-week-2007-03-26.png

Btw, the M should be a G in the chart. Also my other installation did not show improvements.

How did you measure savings? Is this maybe Windows specific?

Collapse
15: Re: maxidle and maxopen (response to 14)
Posted by Maurizio Martignano on
Hello Gustaf, this is what I got on a SUSE Enterprise Linux Server 10 with Linux 2.6.16.27-0.6-smp on a test/benchmnark installation with aolserver 4.0.10 and OpenACS 4
ns_section ns/db/pool/pool1
ns_param   maxidle            60   instead of 1000000000
ns_param   maxopen            360  instead of 1000000000
ns_param   connections        1    instead of 5


  PID MINFLT MAJFLT      VSTEXT  VSIZE  RSIZE  VGROW  RGROW  MEM CMD     1/11
 4143  17341      0          1K 51036K 33860K 51036K 33860K   3% nsd
 4146  10226      0       2140K 135.0M 27376K 135.0M 27376K   2% postmaster
 4147   1204      0       2140K 132.8M  4964K 132.8M  4964K   0% postmaster
 3874     58      0       2140K 131.8M  3084K     0K     4K   0% postmaster
 4148    638      0       2140K 132.3M  2716K 132.3M  2716K   0% postmaster


ATOP - icaro              2007/03/22  17:44:27              600 seconds elapsed
  PID MINFLT MAJFLT      VSTEXT  VSIZE  RSIZE  VGROW  RGROW  MEM CMD     1/7
 4143  10433      0          1K 66576K 47568K 15540K 13708K   4% nsd
 4192  69619      0       2140K 134.9M 110.0M 134.9M 110.0M   9% postmaster
 4203    998      0       2140K 132.6M  4144K 132.6M  4144K   0% postmaster
 3874     59      0       2140K 131.8M  3084K     0K     0K   0% postmaster
 3878      7      0       2140K  6472K   892K     0K     0K   0% postmaster


ATOP - icaro              2007/03/22  17:54:27        
 4143   2374      0          1K 66576K 47560K     0K    -8K   4% nsd
 4239   1039      0       2140K 132.6M  4312K 132.6M  4312K   0% postmaster
 3874     47      0       2140K 131.8M  3084K     0K     0K   0% postmaster
 3878      5      0       2140K  6472K   892K     0K     0K   0% postmaster
 3877      0      0       2140K  7304K   712K     0K     0K   0% postmaster
After the first set of data I stayed put (i.e. I did not touch/used the system) and as you can see in the following sets of data that PostgreSQL released some memory (have a look at the VSIZE value). When I was using timeouts with values of 1000000000 or of 0 the memory did not get released by PostgreSQL.
Yes it is true, I put some very short timeouts. But I did that to observe some changes in the allocated memory as soon as possible.

Hope it helps,
Maurizio