client-server

Derek Atkins warlord@MIT.EDU
21 Dec 2000 13:22:09 -0500


This is an interesting approach, but HTTP is _SLOW_.  You have to
setup and teardown a TCP connection for each request, and you have to
build an SSL association for each request.  This just takes time.  Not
only that, but forking off a CGI is also very expensive.  

Having all of the network connection setup cached through a whole
session (rather than per request) will save a lot of time, but I don't
know if we can do that easily with HTTP or Apache.  I suppose we could
build Java Servlets to solve the cgi forking problem, but then we'd
need to port GnuCash to Java.  Or we could build an Apache module
(mod_gnc?).

I think this is a wonderful approach for report generation, but I'm
not convinced it's the best approach for day-to-day data entry.

-derek

<linas@linas.org> writes:

> OK, here's the dope:
> 
> I don't think rob is entirely aware of the possibilities that his XML
> file format opens up.   Some of the readers of this mailing list may
> also not be aware of what demos grib has done with embedding guppi
> in html.  I don't know how many people are aware that the cvs branch
> of gnucash has a web browser more-or-less built into it.  Its not a
> great all-purpose browser, but for the following example, that don't
> matter.
> 
> GnuCash is just inches away from being a financial ASP website.
> Here's how:
> 
> Imagine logging into a special ssl-protected website.  (using
> gnucash's built-in browser).  You've authenticated, and now you want
> to look at your stocks.  You are taken to the following web page:
> 
> ----------------------------------------------------------
> 
> <html>
> <body>
> <h1>Your Portfolio!</h1>
> Based on the current market values, your asset allocation graph is
> shown below! Just click and drag on this live guppi pie chart!
> The left mouse button lets you move pie slices around, and the 
> right button lets you rotate the whole pie.
> 
> <p>
> <object classid="gnc-guppi-pie" width=400 height=400>
>   <param name=title    value="Pie chart of stupid data">
>   <param name=subtitle value="NEW! with subtitle">
>   <param name=datasize value=6>
>   <param name=data 
>          value="100 200 400 800 1600 3200">
>   <param name=labels
>          value="teeny tiny small medium large huge">
>   <param name=colors
>          value="red blue orange green purple goldenrod">
> </object>
> 
> <object classid="gnc-data" width=0 height=0>
>   <param name=data value="
> <gnc>
>   <version>1</version>
>   <ledger-data>
>     <account>
>       <restore>
>         <name>Brokerage Account</name>
>         <guid>a4b92830ee9ab7db17221f156bc15d87</guid>
>         <type>BANK</type>
>         <description>Brokerage Account</description>
>         <currency>
>           <space>ISO4217</space>
>           <id>USD</id>
>         </currency>
>       </restore>
>     </account>
>     <account>
>       <restore>
>         <name>Bond</name>
>         <guid>fbb97d1d8f6ae60d0e699af8c5b8dbfd</guid>
>         <type>STOCK</type>
>         <description>Bond</description>
>         <currency>
>           <space>ISO4217</space>
>           <id>USD</id>
>         </currency>
>         <parent>
>           <guid>a4b92830ee9ab7db17221f156bc15d87</guid>
>         </parent>
>       </restore>
>     </account>
>   </ledger-data>
> </gnc>
> ">
> 
> </object>
> 
> 
> ----------------------------------------------------------
> What did this web page do?  First, it instructed gnucash to use a
> live guppi chart do display data.   The above is a direct cut-n-paste
> of some code that bill dropped into cvs recently.  (Yes, the next
> version of gnucash will have graphs).
> 
> Next, this web page sent us some gnucash data.  (it might be better
> to compress it, uuencode it, and send it under a separete mime-type,
> but lets gloss that one).  The sample data is a cut-n-paste out
> of the gnucash cvs tree, some sample files in the new file format.
> 
> What have we accomplished here?
> -- we've built a web site that only gnucash can look at and make
>    sense of.
> 
> -- we've built a finacial website whose performance blows the doors 
>    off yahoo.com or fncentral.com   Basically, no nasty html forms
>    needed.  We've got a slick ledger.  We've got interactive graphs.
>    Microsoft .net, take that!  Pow!  Bang!
> 
> -- We've solved the multi-user login issue. Sort of. At least, we
>    turned the multi-user login issue into a standard web/apache
>    login issue, and there's mod_htpasswd and fancier, mod_kerberos,
>    to deal with that.   And, since this is just plain-old apache,
>    we're using plain-old mod_ssl to encrypt for transport.
> 
> -- We've side-stepped the sql transport issue, sort-of.  All data
>    between gnucash-the-web-browser and gnc-the-apache-server is in
>    the form of this oddly marked-up html with embedded, uuencoded
>    gnc-xml.  On the server side, we have to write some cgi-bins 
>    that yank data from any old sql db, and convert it into gnc-xml. 
>    (personally, I recommed using gnc-engine to implement those 
>    cgi-bins).
> 
> 
> I beleive the above architecture renders the whole previous
> discussion moot. I also think its a very, very exciting thing to do.
> It solves a number of technical issues, such as multi-user, that
> have been plaguing us.  Next, it give us world-class financial ASP
> capabilites.   Finally, I think this is what microsoft is thinking
> about when it talks .net  and  this alone makes it important for us
> to do this more/better/faster.
> 
> 
> --linas
> 
> 
> 

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available