Version française
Home     About     Download     Resources     Contact us    
Browse thread
scalable web apps
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dario Teixeira <darioteixeira@y...>
Subject: Re: [Caml-list] scalable web apps
Hi,

> How do you build scalable web apps with OCaml?
> Do you use Apache with mod_caml? Naked Ocsigen?
> Do you put Ocsigen behind Nginx?

Your question is quite open-ended.  There are several "scalability crisis"
that an web app is expected to confront as it grows from handling at most
a handfull of requests per second to dealing with tens or even hundreds of
thousands of requests per second.  Are we talking about surviving a "mere"
Slashdot effect (not as scary nowadays as it once was), or about competing
with Facebook?

Naked Ocsigen -- particularly naked native-code Ocsigen -- should serve
you a long way in the initial stage of the growth path.  In fact, I suspect
you'll run into scalability problems with the database backend much sooner
than you'll find them on the Ocsigen side.  (For caching DB requests, I
reckon that Ocsigen's Ocsigen_cache module should be sufficient for this
early stage, single Ocsigen server situations).

The only circumstance where I would be cautious on relying solely on a
naked Ocsigen is if you are also required to serve plenty of static content
(images, etc).  Even though Ocsigen includes an extension for serving static
pages, for hysterical reasons no Unix supports non-blocking mode for regular
files, which of course causes problems for Lwt-apps (see the Lwt manual for
more information on this).  Therefore, in this context you may get better
results by having another server (like Nginx) dedicated to static content.

As Sylvain mentioned, in my talk I discussed that Ocaml's single-coredness is 
in no way an obstacle to scaling an web app beyond a single Ocsigen server.
However, at this stage of growth you'll also have to consider using a
distributed caching mechanism, such as Memcached or Wink's Cache [1] (the
later developed in Ocaml by Gerd Stolpmann et al).

Best regards,
Dario Teixeira

[1] http://oss.wink.com/cache/