Re: ### Allocation failure
Scott Rogers <scott-t7/[email protected]> Wed, 16 Apr 2003 11:06:50 +0000
| Newsgroups | gmane.comp.lang.moto.devel |
|---|---|
| Message-ID | <[email protected]> |
David,
I changed my httpd.conf file as you suggested to turn off sessions. On b=
oth=20
FreeBSD and Linux I experienced the same behavior as you.
The Linux box reported 844 requests per second with no failures and
the BSD box reported 1045 requests per second with 562 failures.
So it does appear to be session related.
Thanks.
My httpd.conf below
=3D=3D=3D BEGIN httpd.conf =3D=3D=3D
<IfModule mod_tmoto1.c>
<Location /tmoto1>
Tmoto1Option Location /tmoto1
Tmoto1Option Session.Disable TRUE
SetHandler tmoto1
</Location>
</IfModule>
=3D=3D=3D END httpd.conf =3D=3D=3D
On Wednesday 16 April 2003 01:45 am, David Hakim wrote:
> Interesting, I'm pretty confident this is Sessions building up. I
> replicated the allocation failure with sessions enabled no problem
> (yep, right around 6-7K transactions/sessions 32M is used up) , however
> as soon as I disabled them I was able to run the ab test without
> incident. Please post the relevant portions of your httpd.conf. Here
> are mine for the compiled module on my httpd.conf (running on a g4
> portable 500Mhz Mac OS 10.2.5 with lots-o-other-things running :) )
>
> =3D=3D=3D=3D=3Dhttpd.conf=3D=3D=3D=3D
> LoadModule hello_module libexec/httpd/mod_hello.so
>
> <IfModule mod_hello.c>
> <Location /hello>
> HelloOption Location /hello
> SetHandler hello
> HelloOption Session.Disable TRUE
> </Location>
> </IfModule>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> And here was my ab output:
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> % ab -t 0 'http://localhost/hello/hello.moto'
> This is ApacheBench, Version 1.3d <$Revision: 1.1.1.9 $> apache-1.3
> Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd,
> http://www.zeustech.net/
> Copyright (c) 1998-2002 The Apache Software Foundation,
> http://www.apache.org/
>
> Benchmarking localhost (be patient)
> Completed 5000 requests
> Completed 10000 requests
> Completed 15000 requests
> Completed 20000 requests
> Completed 25000 requests
> Completed 30000 requests
> Completed 35000 requests
> Completed 40000 requests
> Completed 45000 requests
> Finished 50000 requests
> Server Software: Apache/1.3.27
> Server Hostname: localhost
> Server Port: 80
>
> Document Path: /hello/hello.moto
> Document Length: 198 bytes
>
> Concurrency Level: 1
> Time taken for tests: 249.111 seconds
> Complete requests: 50000
> Failed requests: 0
> Broken pipe errors: 0
> Total transferred: 16550000 bytes
> HTML transferred: 9900000 bytes
> Requests per second: 200.71 [#/sec] (mean)
> Time per request: 4.98 [ms] (mean)
> Time per request: 4.98 [ms] (mean, across all concurrent requests=
)
> Transfer rate: 66.44 [Kbytes/sec] received
>
> Connnection Times (ms)
> min mean[+/-sd] median max
> Connect: 0 1 NaN 0 56638
> Processing: 2 3 7.7 2 800
> Waiting: 0 2 7.1 2 800
> Total: 2 4 NaN 2 56641
>
> Percentage of the requests served within a certain time (ms)
> 50% 2
> 66% 2
> 75% 3
> 80% 3
> 90% 3
> 95% 6
> 98% 7
> 99% 19
> 100% 56641 (last request)
>
> Also, consider adding this script somewhere on your server so you can
> watch moto's memory, sessions and other persistent objects while
> benchmarking:
>
> $use("codex.util")
> $use("codex.http")
>
> <html>
> <body bgcolor=3D"#FFFFFF">
> <table border=3D0 cellpadding=3D0>
> <tr>
> <td valign=3Dtop>
> Total Memory =3D $(getTotalMemory() / (1024*1024 ))M
> =3D $(getTotalMemory() / (1024 ))K
> =3D $(getTotalMemory())B <br>
> Free Memory =3D $(getFreeMemory() / (1024*1024 ))M
> =3D $(getFreeMemory() / (1024 ))K
> =3D $(getFreeMemory())B <br>
> Used Memory =3D $((getTotalMemory()-getFreeMemory()) /
> (1024*1024 ))M
> =3D $((getTotalMemory()-getFreeMemory()) /
> (1024 ))K
> =3D $((getTotalMemory()-getFreeMemory()))B<=
br>
> Objects Allocated =3D $(getANodes()) <br>
> Available Segments =3D $(getFNodes()) <br>
> Total Context Objects =3D $(getContext().getObjectCount=
())
> <br>
> Total Sessions =3D $(getContext().getSessionCount()) <b=
r>
> States Per Session =3D
> $(getContext().getStatesPerSession()) <br>
> Session Timeout =3D $(getContext().getSessionTimeout())
> <br>
> </td><td
> height=3D"100"
> width=3D"50"
> bgcolor=3D"0000FF"
> valign=3Dbottom
>
> ><img
>
> border=3D"0"
> src=3D"rbar.gif"
> width=3D"50"
> height=3D"$(100 -
> <int>((<float>getFreeMemory()/getTotalMemory())*100))"
>
> ></td>
>
> <tr>
> </table>
> </body>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> -Dave
>
> On Tuesday, April 15, 2003, at 11:45 AM, Scott Rogers wrote:
> > Dave,
> >
> > I did as you asked. I turned off sessions for the compiled
> > application and
> > received the same result on the FreeBSD box. FYI I also modified
> > codex/sharedmem.h to execute the 'debug()' function when the error
> > occurs. So
> > I have a 15mg httd error log with the tree dumps. I don't understand
> > how to
> > interperet the output however.
> >
> > I ran the app from the command line and received the following output=
:
> >
> > =3D=3D=3D BEGIN output =3D=3D=3D
> >
> >> /usr/local/moto/bin/moto -d hello.moto
> >
> > /* */
> >
> >
> >
> > <html>
> > <head>
> > <style type=3D"text/css">
> > </style>
> > </head>
> > <body>
> >
> > <hr>
> >
> > Hello bob <br/>
> > Hello bobie
> > <hr/>
> >
> >
> >
> > Title: Loud People Out Front
> >
> >
> > <hr>
> > </body>
> > </html>
> >
> > ---------------------------------------------------------
> >
> > Size Range Tree :
> > |[0x28165000,0x2a165000)| =3D 33554432 id=3D12 pid=3D712816190
> >
> > Allocated Range Tree :
> > According to lo-mem we have 1 nodes allocated
> > =3D=3D=3D END output =3D=3D=3D
> >
> > On Tuesday 15 April 2003 05:21 pm, David Hakim wrote:
> >> Interesting ... I'm really surprised that this failure is occurring
> >> with the compiled module.
> >>
> >> Anyhow ... its pretty clear then that there is a memory leak at leas=
t
> >> somewhere. Since your test page isn't really using codex.http, could
> >> you run
> >>
> >> moto -d <test file>
> >>
> >> from the command line and verify that there are no leaks there ?
> >>
> >> Second, could you add the following directives to your httpd.conf:
> >>
> >> MotoOption Session.Disable TRUE
> >>
> >> changing the above to
> >>
> >> <CompiledModule>Option Session.Disable TRUE
> >>
> >> for your compiled module and re-run the ab tests ?
> >>
> >> -Dave
> >>
> >> On Tuesday, April 15, 2003, at 09:06 AM, Scott Rogers wrote:
> >>> David,
> >>>
> >>> I experienced the same behavior on the FreeBSD box in interperted a=
nd
> >>> compiled
> >>> mode. I did not try interperted on the Linux box.
> >>>
> >>> I did nothing to turn off sessions. So, if sessions are on 'out of
> >>> the box'
> >>> then they were on for these tests.
> >>>
> >>> Scott Rogers
> >>>
> >>> On Tuesday 15 April 2003 03:50 pm, David Hakim wrote:
> >>>> Is this under the interpreter or with a module compiled with mmc ?
> >>>> Also, are sessions turned off for this application ?
> >>>>
> >>>> -Dave
> >>>>
> >>>> On Tuesday, April 15, 2003, at 07:03 AM, Scott Rogers wrote:
> >>>>> Hey All,
> >>>>>
> >>>>> I recently did some performance testing of Moto on both FreeBSD
> >>>>> 4.6.2
> >>>>> and
> >>>>> Redhat Linux 7.2.
> >>>>>
> >>>>> FreeBSD
> >>>>> Apache: 1.3.26
> >>>>> Moto: 0.19.0
> >>>>> 256mg ram
> >>>>>
> >>>>>
> >>>>> RedHat
> >>>>> Apache 1.3.27
> >>>>> Moto: 0.19.0
> >>>>> 1gig ram
> >>>>>
> >>>>> Using ApacheBench (ab with source distributions) in the following
> >>>>> manner:
> >>>>> ab -t 0 http://localhost/tmoto1/hello.moto
> >>>>>
> >>>>> This sends 50,000 connections to the server, one at a time.
> >>>>> Somewhere
> >>>>> between
> >>>>> 5000 and 10,000 connections, Moto starts sending "### Allocation
> >>>>> failure"
> >>>>> messages to the Apache error log file.
> >>>>>
> >>>>> I tracked this down to line 568 of src/codex/sharedmem.c. It see=
ms
> >>>>> there is
> >>>>> not enough contiguous memory, according to function "locateLPFNod=
e"
> >>>>> at
> >>>>> line
> >>>>> #516.
> >>>>>
> >>>>> It seems when Moto is unable to return a large enough block of
> >>>>> memory
> >>>>> from
> >>>>> it's internal stack, it issues the above warning/error message to
> >>>>> stderr.
> >>>>>
> >>>>> The problem is, it logs the message so many times it fills up my
> >>>>> /var
> >>>>> file
> >>>>> system in a matter of seconds!
> >>>>>
> >>>>> Also, it is important to note, that on the FreeBSD system Moto
> >>>>> consumes all
> >>>>> available RAM, but not on the Linux box with 1gig of Ram.
> >>>>>
> >>>>>
> >>>>>
> >>>>> Here is the code excerpt:
> >>>>>
> >>>>> =3D=3D=3D BEGIN hello.moto =3D=3D=3D
> >>>>> $use("codex.http")
> >>>>> #include("my_classes.moto")
> >>>>>
> >>>>>
> >>>>> <html>
> >>>>> <head>
> >>>>> <style type=3D"text/css">
> >>>>> </style>
> >>>>> </head>
> >>>>> <body>
> >>>>>
> >>>>> <hr>
> >>>>> ${
> >>>>> HelloWorld hw =3D new HelloWorld();
> >>>>> String message =3D hw.sayHelloTo("bob");
> >>>>> }$
> >>>>> $(message + "<br/>")
> >>>>> $(hw.sayHelloTo("bobie"))
> >>>>> <hr/>
> >>>>>
> >>>>> ${
> >>>>> Box box =3D new Box("Loud People Out Front");
> >>>>> }$
> >>>>>
> >>>>> $(box.renderStandard())
> >>>>>
> >>>>>
> >>>>> <hr>
> >>>>> </body>
> >>>>> </html>
> >>>>> =3D=3D=3D END hello.moto =3D=3D=3D
> >>>>>
> >>>>>
> >>>>> =3D=3D=3D BEGIN my_classes.moto =3D=3D=3D
> >>>>> ${
> >>>>> class HelloWorld {
> >>>>> String sayHelloTo(String name){
> >>>>> return "Hello " + name + " ";
> >>>>> }
> >>>>> }
> >>>>>
> >>>>>
> >>>>> class Box {
> >>>>> boolean _initalized =3D false;
> >>>>> String _title =3D "";
> >>>>>
> >>>>> Box(String title) {
> >>>>> this._title =3D title;
> >>>>> }
> >>>>>
> >>>>> String renderStandard() {
> >>>>> return "Title: " + _title;
> >>>>> }
> >>>>> }
> >>>>>
> >>>>> }$
> >>>>> =3D=3D=3D END my_classes.moto =3D=3D=3D
> >>>>>
> >>>>>
> >>>>> Thanks,
> >>>>>
> >>>>> Scott Rogers