Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Re: mod_caml performance
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: [Caml-list] Re: mod_caml performance
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