guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Benchmarks of guile-www against HB's Guile module.


From: Alejandro Forero Cuervo
Subject: Benchmarks of guile-www against HB's Guile module.
Date: Mon, 11 Feb 2002 17:56:37 -0500
User-agent: Mutt/1.2.5i

Hello.

Okay, so after a long vacation, I'm back at developing HB's Guile module
again. :)

In case  you don't remember  the discussion there  was a few  months ago
(about  two),  HB  is  an  engine  for  creating  dynamic  (server-side)
web  content, and  it  supports  development in  Guile.   This is  still
experimental and being improved so your suggestions are welcome.

I'll first explain how the setup works.

You create a  something.guile file with nothing but Scheme  code (you no
longer need the ":out (guile.exec) main" and similar things).

In that  file, you call  the hb-register function to  register callbacks
that provide functionality.  You can think  of each of this callbacks as
being one page in your site.

You can also call the hb-unload  function to register functions that you
want to  have called whenever  your Guile  file is unloaded  from memory
(such as  when it doesn't  get any use  for a long  time or when  the HB
process is terminated).

Consider the following file:

    (let* (
      (port (open-input-file "/tmp/counter"))
      (c    (string->number (read-line port))))

      (close-port port)

      (hb-register hbfile "main"
        (lambda () (display c) (set! c (+ 1 c))))

      (hb-unload hbfile
        (lambda ()
          (let ((port (open-output-file "/tmp/counter")))
            (display c port)
            (close-port port)))))
 
It loads  a counter from a  file and registers the  "main" callback that
displays and increments  it.  It also registers a function  to be called
when the file is unloaded that stores the value of the counter in disk.

If your file is accessible at
    <http://server/cgi-bin/something.guile> ,
you will use an URL such as
    <http://server/cgi-bin/something.guile/XXXX>
where XXXX is the  name of the registered object you  want to access (in
the  example  above,  XXXX  is  main since  that's  what  is  passed  to
hb-register).

It  is thus  possible  to  maintain complex  objects  or connections  in
memory  and  perform proper  initialization/shutdown  when  the file  is
loaded/unloaded.

There are  many different  modes to run  HB.  It is  possible to  run it
strictly under CGI,  to run it as  a daemon and have  a provided program
(hbcgifwd) running under CGI  contact it, and to run it  as a daemon and
use Squid  as a bridge between  it and the browsers  (squid receives the
requests and forwards them to the daemon).

HB  provides  functionality  for  the common  things  required  for  web
development (such as uploading of files, reading/writing HTTP persistant
cookies, receiving input  for HTML forms and the like).   Although it is
already possible  to use  all of  this functionality  from the  HB Guile
module (that is, from Guile code as  in the example file above), we have
still to make a few wrapper functions to simplify the syntax.

Perhaps we will implement those wrapper functions respecting Guile-www's
interface for CGI functions whenever it makes sense.

We have made  a simple benchmark of  all of the above modes  for HB.  We
have also applied it to a file  very much like the one above but written
for guile-www.  The details are avaliable at
    <http://bachue.com/hb/bm/bm-hb-guile.txt> .

We were surprised to find HB's  Guile Module (which depends on libguile)
perform faster than  Guile with Guile-www in all the  tested modes.  Our
fastest setup was 7842% faster than  using Guile and Guile-www (that is,
it  would attend  131.05 requests  in one  second, while  Guile attended
1.65).  Running HB entirely under CGI  (no need to keep a daemon around:
this was our slowest mode for HB) was about an 80% faster (2.98 requests
per second).

We welcome any suggestions you might have that might make our benchmarks
more precise or our HB-Guile module more  usable: we want to make it the
best tool/interface for using Guile for web development.

Thanks. :)

Alejo.
http://bachue.com/alejo

--
The mere formulation of a problem is far more essential than its solution.
      -- Albert Einstein.

$0='!/sfldbi!yjoV0msfQ!sfiupob!utvK'x44;print map{("\e[7m \e[0m",chr ord
(chop$0)-1)[$_].("\n")[++$i%77]}split//,unpack'B*',pack'H*',($F='F'x19).
"F0F3E0607879CC1E0F0F339F3FF399C666733333CCF87F99E6133999999E67CFFCCF3".
"219CC1CCC033E7E660198CCE4E66798303873CCE60F3387$F"#Don't you love Perl?

Attachment: pgpnTGcfDkvxt.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]