caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Will Ocaml use a  4-way SMP box without splitting the program into separate processes?
@ 2001-07-13 19:59 Mattias Waldau
  2001-07-15 11:32 ` Xavier Leroy
  0 siblings, 1 reply; 5+ messages in thread
From: Mattias Waldau @ 2001-07-13 19:59 UTC (permalink / raw)
  To: Caml list

As I understand it, Ocaml has one master lock for handling threading.

Doesn't this mean that a process can never use more than one processor?

And if that is true, following Xavier Leroy idea "Using
separate processes for the HTTP server/servlet container and for the
servlets (but not starting a new servlet process on each request like
CGI does)" is the only scalable way to go.

Because, I don't think a solution that doesn't use a SMP-machine effectively
is a good solution.

> [mailto:owner-web-caml@quatramaran.ens.fr]On Behalf Of William Chesters
> Depends on the kind of market you are thinking of.  The performance we
> get out of Melati+postgres on a cheap PC is adequate for the great
> majority of all known websites, without really trying.  If you put a
> good ocaml-based equivalent on a 4-way SMP box talking to a database
> on another box, you would be comfortably into the hundreds of hits per
> second I reckon.

What have I misunderstood?

/mattias

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Will Ocaml use a  4-way SMP box without splitting the program into separate processes?
  2001-07-13 19:59 [Caml-list] Will Ocaml use a 4-way SMP box without splitting the program into separate processes? Mattias Waldau
@ 2001-07-15 11:32 ` Xavier Leroy
  2001-07-15 12:15   ` William Chesters
  2001-07-17  1:59   ` Alexander V. Voinov
  0 siblings, 2 replies; 5+ messages in thread
From: Xavier Leroy @ 2001-07-15 11:32 UTC (permalink / raw)
  To: Mattias Waldau; +Cc: Caml list

> As I understand it, Ocaml has one master lock for handling threading.

Correct.

> Doesn't this mean that a process can never use more than one processor?

Yes, if the process is entirely composed of Caml code.  Long-running C
primitives release the lock, meaning that your 4-processor machine can
have 1 processor running Caml code and 3 executing C primitives,
e.g. database queries.

> And if that is true, following Xavier Leroy idea "Using
> separate processes for the HTTP server/servlet container and for the
> servlets (but not starting a new servlet process on each request like
> CGI does)" is the only scalable way to go.

You're correct that a solution based on multiple processes
communicating over byte streams (pipes, sockets, etc) is highly
scalable, not only to SMP systems but also to clusters.  Such an
architecture can be made reasonably efficient even on a single
machine, see X Windows for evidence.

> Because, I don't think a solution that doesn't use a SMP-machine effectively
> is a good solution.

Perhaps.  I don't know how important shared-memory multiprocessing is
important for large Web applications.  Centralized databases can
certainly benefit from large SMP machines, but it was my impression
that everything else is equally well done on multiple, inexpensive
single-processor PCs.  (Cf. Google vs. Altavista.)

At any rate, I believe a single-processor PC can handle a fairly high
Web traffic, if well programmed.  Of course, if you're amazon.com or
google.com that will not suffice, but it should be enough for
joesbusiness.com :-)

- Xavier Leroy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Will Ocaml use a  4-way SMP box without splitting the program into separate processes?
  2001-07-15 11:32 ` Xavier Leroy
@ 2001-07-15 12:15   ` William Chesters
  2001-07-17  1:59   ` Alexander V. Voinov
  1 sibling, 0 replies; 5+ messages in thread
From: William Chesters @ 2001-07-15 12:15 UTC (permalink / raw)
  To: Caml list

Xavier Leroy writes:
 > > Doesn't this mean that a process can never use more than one processor?
 > 
 > Yes, if the process is entirely composed of Caml code.

Oh.  I didn't realise that.

 > Long-running C primitives release the lock, meaning that your
 > 4-processor machine can have 1 processor running Caml code and 3
 > executing C primitives, e.g. database queries.

In practice there are always compelling reasons to one of the standard
SQL DB servers, so the actual query processing isn't done in the
servlet process anyway.  (The reasons are things like: customers want
their data stored in a "proper" database which they trust; they want
to be able to use Excel with it; etc.)

 > Perhaps.  I don't know how important shared-memory multiprocessing is
 > important for large Web applications.  Centralized databases can
 > certainly benefit from large SMP machines, but it was my impression
 > that everything else is equally well done on multiple, inexpensive
 > single-processor PCs.  (Cf. Google vs. Altavista.)

Yes. The one point I would make is that marshalling data to and from
an SQL backend, and getting it into a form which is malleable enough
to support complex application logic in a clean way (e.g. an object DB
like Melati's), is expensive.  Cacheing data within the servlet
process is an effective way of amortising these costs.  And it's much
easier to implement cacheing inside one multithreaded process than
between several processes, potentially on different machines.

Also for a small-scale operation, TCO of a single SMP machine is lower
than that of multiple cheap PCs.

 > At any rate, I believe a single-processor PC can handle a fairly high
 > Web traffic, if well programmed.  Of course, if you're amazon.com or
 > google.com that will not suffice, but it should be enough for
 > joesbusiness.com :-)

Very true.  It is really astonishing what you can get away with.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Will Ocaml use a  4-way SMP box without splitting the  program into separate processes?
  2001-07-15 11:32 ` Xavier Leroy
  2001-07-15 12:15   ` William Chesters
@ 2001-07-17  1:59   ` Alexander V. Voinov
  2001-07-20 14:01     ` Xavier Leroy
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander V. Voinov @ 2001-07-17  1:59 UTC (permalink / raw)
  To: Xavier Leroy; +Cc: Mattias Waldau, Caml list

Hi Xavier,

Xavier Leroy wrote:
> 
> > As I understand it, Ocaml has one master lock for handling threading.
> 
> Correct.
> 
> > Doesn't this mean that a process can never use more than one processor?
> 
> Yes, if the process is entirely composed of Caml code.  Long-running C
> primitives release the lock, meaning that your 4-processor machine can
> have 1 processor running Caml code and 3 executing C primitives,
> e.g. database queries.

Is this true for both native and bytecode? 

Alexander
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Will Ocaml use a  4-way SMP box without splitting the program into separate processes?
  2001-07-17  1:59   ` Alexander V. Voinov
@ 2001-07-20 14:01     ` Xavier Leroy
  0 siblings, 0 replies; 5+ messages in thread
From: Xavier Leroy @ 2001-07-20 14:01 UTC (permalink / raw)
  To: Alexander V. Voinov; +Cc: Mattias Waldau, Caml list

> > > Doesn't this mean that a process can never use more than one processor?
> > 
> > Yes, if the process is entirely composed of Caml code.  Long-running C
> > primitives release the lock, meaning that your 4-processor machine can
> > have 1 processor running Caml code and 3 executing C primitives,
> > e.g. database queries.
> 
> Is this true for both native and bytecode? 

Yes.  The GC and many parts of the runtime system common to both
compilers are not thread-safe.

- Xavier Leroy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-07-20 14:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-13 19:59 [Caml-list] Will Ocaml use a 4-way SMP box without splitting the program into separate processes? Mattias Waldau
2001-07-15 11:32 ` Xavier Leroy
2001-07-15 12:15   ` William Chesters
2001-07-17  1:59   ` Alexander V. Voinov
2001-07-20 14:01     ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).