From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA05350; Wed, 31 Mar 2004 13:14:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA05088 for ; Wed, 31 Mar 2004 13:14:52 +0200 (MET DST) Received: from aomori.annexia.org (annexia.force9.co.uk [212.56.101.183]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i2VBFZjq021419 for ; Wed, 31 Mar 2004 13:15:35 +0200 Received: from rich by aomori.annexia.org with local (Exim 3.36 #1 (Debian)) id 1B8dgF-0007ar-00; Wed, 31 Mar 2004 12:14:47 +0100 Date: Wed, 31 Mar 2004 12:14:47 +0100 To: Jimmie Houchin Cc: caml-list@inria.fr Subject: [Caml-list] Re: mod_caml performance Message-ID: <20040331111447.GA28948@redhat.com> References: <406A5057.20008@texoma.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <406A5057.20008@texoma.net> User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Jones X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; 2004:99 0600,:01 houchin:01 imposing:01 simplistic:01 naively:01 slower:01 loadable:01 deployed:01 visitors:99 postgres:01 0.0:01 11.3:99 postmaster:99 postgres:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Mar 30, 2004 at 11:00:07PM -0600, Jimmie Houchin wrote: > Hello, > > I am considering exploring OCaml for web development. > > I do not currently know OCaml. My naive understanding is that it is a > high performance language with a reasonable learning curve. > > Before I invest in learning OCaml, I would like to ask one question if I > may. I realize I am imposing and asking a favor. Answer at your > convenience if you desire to answer. I will completely understand if you > choose not to answer. > > How well does mod_caml perform? > > example: > > A hello world static page similar to your hello world example vs. your > hello world example. > > Just wanting a very simplistic idea of performance in what naively > appears to be a best case comparison. The first thing is that OCaml has two modes of execution: byte code and native code. The byte code mode is about 5 times slower than native code. Native code performance is on a par with languages like C, as long as you program in an imperative style and turn off bounds checking (the '-unsafe' option). mod_caml uses loadable OCaml modules, and because of this is restricted to _byte_code_ only. However, in a typical web application you're not really interested in raw performance, because network and database I/O dominates all other considerations. In general you're far better off concentrating on optimizing your database use (ie. SQL, stored procedures, indexes on tables), and reducing your network use (XHTML 1.0 Strict, CSS, HTTP compression), than worrying about performance of the language. Also memory usage is important with web applications. If you've ever deployed a live mod_perl or Java servlet application you'll know it sucks up huge amounts of memory. Typically you need 1 GB of RAM to serve any significant population of users with those platforms. OCaml / mod_caml is much better at using memory. (See below for the memory usage of our lightly-loaded live server). What also counts is type safety, which saves programmer hours. BTW, you can try out j-london.com and download the source code from http://www.j-london.com/dist/ It's a live interactive site which uses mod_caml, and it serves a small community of about 100 unique visitors per day. Rich. Mem: 58924K total, 54816K used, 4108K free, 1684K buffers Swap: 262136K total, 52220K used, 209916K free, 13744K cached PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND 6285 postgres -2 0 7008 6664 6528 S 0.0 11.3 0:00 postmaster 6739 postgres -2 0 6560 6392 5328 S 0.0 10.8 0:00 postmaster 6790 postgres -2 0 6472 6304 5284 S 0.0 10.6 0:00 postmaster 6740 postgres -2 0 6384 6216 5232 S 0.0 10.5 0:00 postmaster 6789 postgres -2 0 6248 6080 5124 S 0.0 10.3 0:00 postmaster 6272 postgres -2 0 5800 5460 5440 S 0.0 9.2 0:00 postmaster 6033 postgres -2 0 5636 5388 5104 S 0.0 9.1 0:00 postmaster 6371 postgres 0 0 5672 5316 5236 S 0.0 9.0 0:00 postmaster 6591 postgres -2 0 5488 5220 5096 S 0.0 8.8 0:00 postmaster 6386 postgres -2 0 5524 5168 5144 S 0.0 8.7 0:00 postmaster 6035 postgres -2 0 5376 5048 5028 S 0.0 8.5 0:00 postmaster 6027 postgres -2 0 5116 4832 4780 S 0.0 8.2 0:00 postmaster 6058 postgres -2 0 5168 4716 4712 S 0.0 8.0 0:00 postmaster 5820 www-data 2 0 4460 3528 3204 S 0.0 5.9 0:00 apache 5816 www-data -2 0 4592 3364 3028 S 0.0 5.7 0:00 apache 5988 www-data -2 0 4304 3360 2572 S 0.0 5.7 0:00 apache 5817 www-data -2 0 4468 3168 2984 S 0.0 5.3 0:00 apache 5819 www-data 0 0 4368 3116 2764 S 0.0 5.2 0:00 apache 5989 www-data -2 0 4492 3104 2960 S 0.0 5.2 0:00 apache 5930 www-data -2 0 4364 2904 2768 S 0.0 4.9 0:00 apache 6597 postgres -2 0 3984 2756 2756 S 0.0 4.6 0:00 postmaster 6595 postgres -2 0 3728 2640 2640 S 0.0 4.4 0:00 postmaster 6594 postgres -2 0 3604 2492 2492 S 0.0 4.2 0:00 postmaster 5818 www-data -2 0 4512 2424 2284 S 0.0 4.1 0:00 apache 6592 postgres -2 0 3680 2420 2420 S 0.0 4.1 0:00 postmaster 5990 www-data -2 0 4540 2276 2176 S 0.0 3.8 0:00 apache -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment C2LIB is a library of basic Perl/STL-like types for C. Vectors, hashes, trees, string funcs, pool allocator: http://www.annexia.org/freeware/c2lib/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners