From: Richard Jones <rich@annexia.org>
To: Jimmie Houchin <jhouchin@texoma.net>
Cc: caml-list@inria.fr
Subject: [Caml-list] Re: mod_caml performance
Date: Wed, 31 Mar 2004 12:14:47 +0100 [thread overview]
Message-ID: <20040331111447.GA28948@redhat.com> (raw)
In-Reply-To: <406A5057.20008@texoma.net>
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
parent reply other threads:[~2004-03-31 11:14 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <406A5057.20008@texoma.net>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040331111447.GA28948@redhat.com \
--to=rich@annexia.org \
--cc=caml-list@inria.fr \
--cc=jhouchin@texoma.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox