Hi Denis,

As Gerd kindly explained, using threads wouldn't help for scalability. It turns out that it wouldn't help for stability either, because the workers have to deal with R's (as in statistics softw'R) interpreter, and the communication between OCaml and R is not bullet-proof right now. So I'd rather have the computation isolated in its process, not to harm the web-server.

Cheers,
  ph.
 


2013/3/28 Denis Berthod <casa.berthod@gmail.com>



Le 27 mars 2013 à 23:49, Gerd Stolpmann a écrit :

> Am 27.03.2013 23:42:14 schrieb(en) Denis Berthod:
>> Hello,
>> Isn't the Lwt_preemptive module exactly what you want?
>> http://ocsigen.org/lwt/api/Lwt_preemptive
>> But maybe, you want to use real processes and not threads.
>
> In OCaml, only one thread may access runtime functions at a time, and because of this, only one thread at a time can run OCaml code. So you exploit only one core with a multi-threaded program. I guess this does not meet Philippe's scalability requirement, and he wants to use processes instead.
>
> Gerd
>


Indead, I have only considered the stability problem that can be tackle by real threads as they don't block the lwt runtimes during computation.
Howerver, you are right concerning the scalability.

Cheers,

Denis



>
>> Cheers,
>> Denis
>> Le 26 mars 2013 à 15:29, Philippe Veber a écrit :
>> > Dear all,
>> >
>> > I'm developping an ocsigen website doing some scientific calculations. Up to now, the calculations were done in the same process that runs the server. In order to gain in scalability (and maybe stability too), I would like to run those calculations in a separate (pool of) process(es). As this is a pretty typical setup, I guess quite a few people have already done that. So I'd like to hear some suggestions on what library to use in this particular context. It seems to me that the release library [1] should do the job and is lwt-friendly, but there are maybe other good options?
>> >
>> > Thanks for any hint, cheers!
>> >
>> > Philippe.
>> >
>> > [1] https://github.com/andrenth/release
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
> --
> ------------------------------------------------------------
> Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
> Creator of GODI and camlcity.org.
> Contact details:        http://www.camlcity.org/contact.html
> Company homepage:       http://www.gerd-stolpmann.de
> ------------------------------------------------------------
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs