Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Dario Teixeira <darioteixeira@yahoo.com>
To: Joel Reymont <joelr1@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] scalable web apps
Date: Sun, 25 Jul 2010 15:24:43 -0700 (PDT)	[thread overview]
Message-ID: <362124.56006.qm@web111507.mail.gq1.yahoo.com> (raw)
In-Reply-To: <E0E6EC4C-7CF8-4ED1-AC3F-E0D5084E98B4@gmail.com>

Hi,

> How does Ocsigen handle database operations?
> I assume they need to be asynchronous because of
> lightweight threads (Lwt).

Ocsigen itself is agnostic on DB matters.  However, your assumption
concerning the Lwt-friendliness of the DB layer is correct.  There's
basically two solutions to this problem: 1) Use whatever DB bindings
you prefer, but wrap them under Lwt_preemptive; 2) Use Lwt-aware DB
bindings.  For the latter the usual recommendation is PG'OCaml [1],
which in its current incarnation can be used in a monadic fashion
(with Lwt, for example).  If you want to interact with the DB at
an even higher level there's also Macaque [2], which is part of
the Ocsigen project (note that Macaque relies on PG'OCaml for the
low-level work).

When using PG'OCaml with Lwt, pretty soon you'll come across the
problem of connection pooling.  This is the moment you'll want to
look into Lwt_pool, which makes this task a breeze.

Finally, if you're looking for a concrete example of all this stuff
put together I suggest taking a look at the Lambdium's database.ml
module [3] (you can find it under 'backend/src/data/').

Hope that's enough to get you going...
Cheers,
Dario Teixeira

[1] http://pgocaml.berlios.de/
[2] http://ocsigen.org/macaque/
[3] https://forge.ocamlcore.org/projects/lambdium/






  parent reply	other threads:[~2010-07-25 22:24 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-24  7:49 Joel Reymont
2010-07-24  8:57 ` Sylvain Le Gall
2010-07-24 10:55 ` [Caml-list] " William Le Ferrand
2010-07-25 13:52 ` Dario Teixeira
2010-07-25 19:19   ` Joel Reymont
2010-07-26  7:29   ` Török Edwin
2010-07-26  7:59     ` Jérémie Dimino
2010-07-26  8:19       ` Török Edwin
2010-07-27  6:46         ` Jérémie Dimino
2010-07-26 11:27       ` Dario Teixeira
2010-07-26 19:57       ` Jake Donham
2010-07-26 20:02         ` Török Edwin
2010-07-27  6:55         ` Jérémie Dimino
2010-07-26  9:11   ` Sylvain Le Gall
2010-07-26 11:10     ` [Caml-list] " Dario Teixeira
2010-07-26 12:58       ` Sylvain Le Gall
2010-07-26 13:20         ` [Caml-list] " William Le Ferrand
2010-07-25 19:46 ` [Caml-list] " Richard Jones
2010-07-25 21:45   ` Dario Teixeira
2010-07-25 21:56     ` Joel Reymont
2010-07-25 22:03       ` Gabriel Kerneis
2010-07-25 22:24       ` Dario Teixeira [this message]
2010-07-26  7:34       ` Richard Jones
2010-07-26 11:20         ` Dario Teixeira
2010-07-26 16:50           ` Florent Monnier
2010-07-26 17:10             ` Sylvain Le Gall
2010-07-26 17:21               ` [Caml-list] " Gabriel Kerneis
2010-07-26 17:37                 ` Sylvain Le Gall
2010-07-25 22:44     ` [Caml-list] " Yoann Padioleau
2010-07-26  9:08       ` Sylvain Le Gall

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=362124.56006.qm@web111507.mail.gq1.yahoo.com \
    --to=darioteixeira@yahoo.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=joelr1@gmail.com \
    /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