On Sat, 1 May 1999, S. Alexander Jacobson wrote:

> The third problem is also an implementation issue....
> You don't want to have to start a hugs process that makes a
> connection to a database everytime a user makes a request.  You want
> something like mod_perl or jserv which keeps the interpreter
> alive to handle requests from the httpd.  

        But you can certainly run a derivative of Haskell Server
        as a separate server offering specialized services.
        (Sorry, I do not remember at the moment who are its authors
        and what is a link to it. I am talking about the original
        software of such name, not about its current incarnation to
        HaskellScript - which is too Microsoft specific to my liking.
        We basically run Linux here.)

        Runhugs is just one example of such a server. Some time
        ago I modified the official Haskell Server quite heavily
        to convert it to specialized "Numerical Haskell Server". 
        I am not speculating. I used to run such stuff.

        You can advertise the port number of such a Haskell server
        either staticly (you need to assure that it will always
        run on a well known port) or dynamicly. In the latter
        case you need to create auxillary dynamic web page, which
        would be produced in response to user request: "I want specialized
        haskell service." To create the dynamic "port announcing page"
        you could use a tiny CGI program, which would scan a list
        of Unix processes to figure out whether the Haskell server
        runs at all, and - if it does - what is its "belldoor"
        port number. A two-line "track file" would be probably needed here
        as well.

        The good news is that Haskell server (based on Hugs)
        is much less expensive than equivalent Java server. 1-2 Mbytes
        vs 8-10 Mbytes - if I remember correctly the results of my
        experiments with both types of servers.
        
        The user can then connect to haskell server from that dynamic
        or static page. The Haskell server (written in C - as Hugs is)
        can handle logins and dispatch child processes - one per user,
        handle timeouts, logouts, etc.
        
        And it would respond to as many requests as your heart desires.

        One of these days, when I stop worrying about my income and
        find again some time for producing free Haskell code, I'll
        try to finish up my numerical server that used to do those things
        on experimental scale. You could then use it as an example and
        modify it to suit your application. For now you just have to
        trust my word: such approach really worked well. But you can
        figure out the details yourself, anyway. No rocket science
        here.   

        I hope it helps,
        Jan











Reply via email to