349 lines
16 KiB
HTML
349 lines
16 KiB
HTML
<!--startcut ==============================================-->
|
|
<!-- *** BEGIN HTML header *** -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML><HEAD>
|
|
<title>AOLserver - a web development platform LG #58</title>
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
|
|
ALINK="#FF0000">
|
|
<!-- *** END HTML header *** -->
|
|
|
|
<CENTER>
|
|
<A HREF="http://www.linuxgazette.com/">
|
|
<H1><IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.jpg"
|
|
WIDTH="600" HEIGHT="124" border="0"></H1></A>
|
|
|
|
<!-- *** BEGIN navbar *** -->
|
|
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="ward.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue58/washington.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="york.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
|
|
<!-- *** END navbar *** -->
|
|
<P>
|
|
</CENTER>
|
|
|
|
<!--endcut ============================================================-->
|
|
|
|
<H4 ALIGN="center">
|
|
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
|
|
<P> <HR> <P>
|
|
<!--===================================================================-->
|
|
|
|
<center>
|
|
<H1><font color="maroon">AOLserver - a web development platform</font></H1>
|
|
<H4>By <a href="mailto:irvingw@pobox.com">Irving Washington</a></H4>
|
|
</center>
|
|
<P> <HR> <P>
|
|
|
|
<!-- END header -->
|
|
|
|
|
|
|
|
|
|
<h3> Introduction and short history of AOLserver </h3>
|
|
|
|
A web server is not an end in itself - it's only a tool that
|
|
allows creating web services. This article introduces an
|
|
<a href="http://www.aolserver.com">AOLserver</a>, an open-source,
|
|
standards-compliant web server extraordinaire (think Apache on steroids)
|
|
that runs beautifully under GNU/Linux. We present its history and
|
|
show how its capabilities make it an ideal web development platform.
|
|
<p>
|
|
First there was a company called NaviSoft founded by a couple of wizard
|
|
Unix programmers. They've set out to create the best web publishing system
|
|
on the planet and they were well on their way. It was 1994 and their product,
|
|
a web server called NaviServer, was multi-threaded from the ground up
|
|
(Apache is still trying to catch up with this particular feature), had a tightly
|
|
integrated scripting language, good extension API and database connectivity
|
|
built in. It was so good that AOL decided in 1996 to use it to
|
|
<a href="http://www.netcraft.com/whats/?host=www.aol.com">power the core
|
|
of their business</a> - multiple AOL web-estate. But buying programs is not
|
|
how AOL works - they've bought the whole company to make sure that
|
|
the software will grow as fast as AOL's needs. Thus NaviServer has been
|
|
renamed to AOLserver. In 1999 an MIT researcher, accomplished photographer and
|
|
web-developer in one person, <a href="http://philip.greenspun.com/">Philip
|
|
Greenspun</a>, convinced AOL that it should open-source
|
|
AOLserver for the mutual benefit of AOL and public at large. So they did.
|
|
After a few months of frantic code cleanup AOLserver 3.0 debuted as an
|
|
open-source web server whose development is largely community
|
|
driven. AOLserver 3.1 has been released in September 2000.
|
|
|
|
<h3> Qualities of a good web server </h3>
|
|
|
|
A web server is more like a C compiler than a word processor.
|
|
It's a tool, a development platform that is used to
|
|
build web services. Let's examine some of the desirable
|
|
qualities that a web server should have
|
|
and see how well AOLserver fits the bill.
|
|
|
|
<h4> Robustness, stability, scalability </h4>
|
|
|
|
I list robustness in the first place because if your
|
|
web server crashes and your web pages are inaccessible
|
|
to visitors then nothing else really matters.<p>
|
|
AOLserver is robust, stable and scalable, after all
|
|
it has been perfected for years by a tight group of programming
|
|
wizards. Fortunately, you don't have to take my word for it.
|
|
AOLserver has been battle-field tested in the most demanding
|
|
environments. It is known to serve 30 thousand hits per seconds
|
|
on <a href="http://www.netcraft.com/whats/?host=www.aol.com">AOL</a>
|
|
sites. <a href="http://www.arsdigita.com">ArsDigita</a>, a
|
|
Web development company, has built numerous web sites
|
|
(<a href="http://www.netcraft.com/whats/?host=www.photo.net">www.photo.net</a>,
|
|
<a href="http://www.netcraft.com/whats/?host=www.scorecard.org">www.scorecard.com</a>,
|
|
<a href="http://www.netcraft.com/whats/?host=www.away.com">www.away.com</a>)
|
|
that routinely serve millions hits per day.
|
|
The bottom line is: AOLserver proved to be extremely stable
|
|
and scalable by serving some of the most popular sites on the
|
|
Internet today.
|
|
|
|
<h4> Features, a lot of them </h4>
|
|
|
|
For serving static pages AOLserver is just as good as any other
|
|
fast, efficient and reliable web server.
|
|
Today, however, publishing static content is not thrilling
|
|
anymore. The focus is on dynamic, collaborative services.
|
|
AOLserver has been built from the ground up for such
|
|
purposes and it shows. Here's a list of features that
|
|
a web server should have, why it should have it and
|
|
a description of what AOLserver offers.
|
|
<p>
|
|
You want web server to <b>support four of the most popular programming
|
|
paradigms</b>. You can think of a web service in object-oriented
|
|
terms: a web server is an object whose methods are URLs. Users
|
|
invoke methods by requesting an URL from within their web
|
|
browser. The simplest way a web server can respond to such
|
|
request is to fetch a static HTML file from the file system
|
|
and send its content to an user. Doing anything more complicated
|
|
means running a computer program which will generate an HTML
|
|
page. One way to do it is by <b>extending web server itself</b>
|
|
using its C extension API. Every popular web server
|
|
(Apache, IIS, Netscape) has some implementation
|
|
of this idea. AOLserver provides well thought out C
|
|
extension API that makes writing modules that extend its functionality
|
|
really easy. As an example: the source code embedding PHP in
|
|
AOLserver is half the size of the similar code that embeds PHP in Apache
|
|
(this "benchmark" should be taken with an appropriate
|
|
grain of salt but it gives a rough idea of extension API quality).
|
|
Having praised the API it should be noted that this is a
|
|
very slow and error prone way of writing web services (on any
|
|
web server). You have to code in a very low-level language
|
|
(C), debugging is a nightmare and smallest mistake can crash
|
|
the whole server.
|
|
|
|
<p>
|
|
To remedy those shortcomings a <b>CGI protocol</b>
|
|
has been created. This protocol is supported by
|
|
all major web servers including AOLserver.
|
|
The idea is very simple: upon page request
|
|
a web server will execute a program and whatever this
|
|
program will send to its standard output will be sent
|
|
back to a browser. The greatest advantage is that
|
|
it can significantly shorten development time since
|
|
programmer can use the best tool for the job
|
|
(which usually means a scripting language like Perl, Tcl,
|
|
Lisp or simply a language that he is most familiar with).
|
|
The disadvantage is that it's slow (for each request a
|
|
program needs to be executed and it's very expensive
|
|
operation) and thus doesn't scale well.
|
|
|
|
<p>
|
|
To improve performance
|
|
web servers started to <b>directly embed</b> scripting
|
|
languages. The most popular examples are mod_perl
|
|
in Apache and PHP. Since interpreter is linked
|
|
with the web server executable it's no longer
|
|
necessary to fork an external program to execute
|
|
the script which saves a lot of time. This approach
|
|
conserves the fast development advantage of CGI
|
|
scripts but the cost is that it limits you to
|
|
one particular scripting language (which may or may not
|
|
be an disadvantage depending on how well developer
|
|
knows this scripting language). AOLserver's story
|
|
in this department is very compelling: it is
|
|
the only major web server that comes with a tightly
|
|
integrated scripting language (Tcl) out-of-the-box.
|
|
If for some reason you dislike Tcl you can use
|
|
PHP, Python, Java (and there is a work in progress to
|
|
add Perl support).
|
|
|
|
<p>
|
|
The last programming paradigm is <b>server-side includes</b>
|
|
ie. code embedded in HTML pages. When a page
|
|
is server it is parsed by the server, HTML code is left
|
|
untouched, embedded code chunks are executed and replaced
|
|
by their output and resulting page is sent to browser.
|
|
The most popular example of this paradigm are ASP pages in
|
|
IIS. AOLserver provides developers with a similar feature:
|
|
ADP pages that allows you to embeded Tcl code inside HTML.
|
|
|
|
<p>
|
|
You want your web service to be <b>fast and efficient</b>.
|
|
AOLserver's multi-threaded architecture gives you
|
|
the performance advantage over process based web servers
|
|
(eg. Apache 1.3.x, Apache 2.0 is being rewritten as
|
|
multi-threaded server but hasn't yet reached maturity).
|
|
If a web server is based on processes it has to
|
|
create a new process to serve each http request.
|
|
AOLserver only has to spawn a new thread and it's
|
|
much faster.
|
|
|
|
<p>
|
|
You want to have ability to <b>share data between scripts</b>.
|
|
There are many uses for such feature, the simplest
|
|
example would be to count how many times a given
|
|
page/script has been called. It's not easy to achieve
|
|
this in a process based web server because processes
|
|
do not share dynamically allocated memory. As an example, if you
|
|
use mod_perl scripts in Apache, you can have a global
|
|
variable and increment it but if you think that this
|
|
will tell you the total number of times the script has been
|
|
executed you're in for a surprise: this value is actually
|
|
per-script-per-process and since Apache pre-forks multiple processes
|
|
and (as far as programmer is concerned) unpredictably assigns
|
|
them to execute scripts your counter won't give you an accurate
|
|
number. It's possible to overcome this using shared memory (or
|
|
by storing the data in a database) but it is
|
|
so cumbersome and non-standard that it's not popular among
|
|
Apache developers. In AOLserver it's a child's play
|
|
thanks to the fact that threads share dynamic memory
|
|
and excellent built-in <b>nsv</b> interface.
|
|
|
|
<p>
|
|
Since dynamic web services usually have to store
|
|
data in a database and retrieve data from a databases you
|
|
want your web server to have an
|
|
<b>ability to talk to databases</b>. AOLserver comes
|
|
with an exceptionally good, standardized and fast database
|
|
connectivity API. It's fast because it uses connection pooling, ie.
|
|
database connections are opened when the web server starts and
|
|
subsequently reused among scripts.
|
|
An alternative (used eg. in PHP3) is to open a connection
|
|
on the beginning of a script and close it at the end.
|
|
This approach is much slower.
|
|
<br>
|
|
Standardized means that you use the same API
|
|
to send SQL commands regardless of the database server used
|
|
(to contrast, in PHP each database has its own set of
|
|
APIs). It's easier to port the code
|
|
when switching databases (SQL statements still need
|
|
to be ported, but that just shows how <i>standard</i>
|
|
an SQL standard is).
|
|
<br>
|
|
To top it off drivers exist for most popular
|
|
databases: Oracle, PostgreSQL, MySQL, Informix,
|
|
Interbase, Solid, DB2.
|
|
|
|
<p>
|
|
AOLserver provides developers with more basic blocks
|
|
for building dynamic web services than any other
|
|
web server. Most web services have to solve many
|
|
similar problems and provide:
|
|
<ul>
|
|
<li> user and session tracking
|
|
<li> permissions system
|
|
<li> content management (publishing, templating)
|
|
<li> e-commerce
|
|
<li> banner management
|
|
<li> site-wide search
|
|
<li> and many, many more
|
|
</ul>
|
|
Even given all the wonderful features of AOLserver
|
|
you might get tired reinventing the infrastructure needed
|
|
for supporting collaborative web service.
|
|
Instead of re-inventing the wheel you might take a look at
|
|
open-source, Oracle-based
|
|
<a href="http://www.arsdigita.com">ArsDigita Community
|
|
System (ACS)</a> (or at
|
|
<a href="http://www.openacs.org">OpenACS</a>, port of ACS
|
|
that uses open-source PostgreSQL database).
|
|
You'll have to spend some time in learning about this
|
|
very extensive toolkit but after an initial investment
|
|
you'll be able to quickly build high-quality web services
|
|
that require advanced collaboration features.
|
|
|
|
<h4> Documentation </h4>
|
|
|
|
Good documentation is essential. More often than not it's also the most
|
|
frequently neglected aspect of open-source projects. AOLserver, thanks to its
|
|
commercial roots, has a very good documentation, available both on-line
|
|
and off-line. It consist of an administrator guide, detailed guides to C
|
|
and Tcl interfaces, a guide to developing database drivers.
|
|
|
|
<h4> Vibrant community </h4>
|
|
|
|
An active community of users and developers is important
|
|
for steering programs into new waters, providing suggestions
|
|
and bug fixes, helping new users etc. AOLserver has entered
|
|
open-source land relatively recently and has already gained
|
|
an attention of external developers. There are projects in full
|
|
swing that push AOLserver into realms it has never reached
|
|
before. The following modules are being worked on by community
|
|
members (independent of the core developers):"
|
|
<ul>
|
|
<li> quickly maturing <a href="http://pywx.idyll.org">PyWX project</a>
|
|
embeds a Python interpreter inside AOLserver so that it enjoys the
|
|
same high integration as Tcl
|
|
<li> <a href="http://www.arsdigita.com/download">nsxml</a> module
|
|
contributed by ArsDigita adds XML processing capabilities by
|
|
wrapping <a href="http://www.xmlsoft.org">libxml</a> in a Tcl interface
|
|
<li> <a href="http://nsjava.sourceforge.net/">nsjava</a> enables
|
|
calling Java from within AOLserver
|
|
<li> <a href="http://www.cs.pub.ro/~gaburici/nstomcat/">nstomcat</a>
|
|
enables running servlets inside AOLserver
|
|
<li> first stab at embedding Perl <a href="http://www.laney.edu:8080/users/jim/perl-aol.html">has been made</a>
|
|
</ul>
|
|
|
|
<h3> Conclusion and links </h3>
|
|
|
|
Web is changing rapidly. Static pages and simple CGI
|
|
scripts are not sexy anymore.
|
|
Anything worthwhile that can be achieved on the Web today
|
|
involves building web pages from dynamic data sources,
|
|
collaboration among visitors, tracking user's behavior
|
|
etc. AOLserver's features make it an ideal development
|
|
platform for building such advanced, collaborative web
|
|
services.
|
|
|
|
<p>
|
|
|
|
To get more information check those sites:
|
|
<ul>
|
|
<li> <a href="http://www.aolserver.com">www.aolserver.com</a> is the
|
|
best place to get more information about AOLserver and participate
|
|
in its development
|
|
<li> Philip Greenspun has written an excellent introduction to
|
|
AOLserver. Here's <a
|
|
href="http://www.arsdigita.com/asj/aolserver/introduction-1">part
|
|
one</a> and <a
|
|
href="http://www.arsdigita.com/asj/aolserver/introduction-2">part
|
|
two</a> of his article
|
|
<li> <a href="http://www.aolserver.com/tcl2k/html/index.htm">this
|
|
paper</a> shows how AOLserver is used to
|
|
power some really heavy-weight sites
|
|
<li> when you get past simple web sites you might want to read
|
|
<a href="http://www.arsdigita.com/books/panda/">
|
|
Philip and Alex's Guide to Web Publishing</a> to find out what
|
|
designing web services is about
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<!-- *** BEGIN copyright *** -->
|
|
<P> <hr> <!-- P -->
|
|
<H5 ALIGN=center>
|
|
|
|
Copyright © 2000, Irving Washington<BR>
|
|
Published in Issue 58 of <i>Linux Gazette</i>, October 2000</H5>
|
|
<!-- *** END copyright *** -->
|
|
|
|
<!--startcut ==========================================================-->
|
|
<HR><P>
|
|
<CENTER>
|
|
<!-- *** BEGIN navbar *** -->
|
|
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="ward.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue58/washington.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="york.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
|
|
<!-- *** END navbar *** -->
|
|
</CENTER>
|
|
</BODY></HTML>
|
|
<!--endcut ============================================================-->
|