### Allocation failure

Scott Rogers <scott-t7/[email protected]> Tue, 15 Apr 2003 11:03:14 +0000
Newsgroups gmane.comp.lang.moto.devel
Message-ID <[email protected]>
Hey All,

I recently did some performance testing of Moto on both FreeBSD 4.6.2 and=
=20
Redhat Linux 7.2. =20

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 be=
tween=20
5000 and 10,000 connections, Moto starts sending "### Allocation failure"=
=20
messages to the Apache error log file. =20

I tracked this down to line 568 of src/codex/sharedmem.c.  It seems there=
 is=20
not enough contiguous memory, according to function "locateLPFNode" at li=
ne=20
#516.

It seems when Moto is unable to return a large enough block of memory fro=
m=20
it's internal stack, it issues the above warning/error message to stderr.=
 =20

The problem is, it logs the message so many times it fills up my /var fil=
e=20
system in a matter of seconds!

Also, it is important to note, that on the FreeBSD system Moto consumes a=
ll=20
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&nbsp;" + name + "&nbsp;";
         }
      }


   class Box {
     boolean _initalized =3D false;
     String _title =3D "";

      Box(String title) {
       this._title =3D title;
     }
    =20
     String renderStandard() {
       return "Title: " + _title;
     }
   }

}$
=3D=3D=3D END my_classes.moto =3D=3D=3D


Thanks,

Scott Rogers