20
AOLserver America Online’s open source webserver Dossy Shiobara February 2005

AOLserver America Online’s open source webserver Dossy Shiobara February 2005

Embed Size (px)

Citation preview

AOLserverAmerica Online’sopen source webserver

Dossy Shiobara

February 2005

2

About Dossy Shiobara

• I've been using AOLserver since late 1999 to serve my own personal websites, as well as helping to support others who use it.

• In 2003, I joined AOL where I support the sites at AOL that use AOLserver as well.

• I'm currently the Project Leader of the AOLserver project.

• I’m the initial developer of two AOLserver modules, nsmysql and nsfreetds. I’ve also contributed to the core server, as well as nsopenssl and other modules.

3

A brief history of AOLserver

4

NaviSoft (before Nov 1994)

• Company started by producing high-quality client- and server-side tools for web publishing: NaviPress and NaviServer.

• NaviPress was one of the first WYSIWYG HTML editors.

• NaviPress could send changes up to NaviServer (using HTTP PUT) making web site management and updating simple.

• Because of this capability, NaviPress/NaviServer was one of the first entrants into the distributed web authoring space.

• NaviServer was designed to be multi-threaded from the beginning. (In comparison, multi-threaded Apache was only declared GA or “General Availability” or non-beta in Apache 2.0.35 in April 2002.)

5

AOL (after Dec 1994)

• In 1994, AOL realizes the need to enter into the Internet and World Wide Web space.

• AOL acquires NaviSoft, Inc. on November 30, 1994.

• NaviServer is renamed AOLserver, NaviPress to AOLpress.

• AOL offers commercial web hosting through NaviService, then GNN Hosting, then PrimeHost, using AOLserver/AOLpress.

• AOL launches Digital City, Inc. (DCI) in 1996 on AOLserver platform. Continues to use AOLserver for other web properties over the years (Moviefone.com, Mapquest.com, etc.).

• AOLserver 3.0 released as open source on July 8, 1999.

• AOLserver 4.0 released in November, 2003

6

So, what is AOLserver?

7

What can I do with AOLserver?

• Run a server with high quality code resulting in very few security vulnerabilities found in the wild.

• Easily administrate your servers through configuration files that are programs themselves.

• Rapidly develop applications using a mix of C and Tcl that leverage a scalable, multi-threaded architecture.

• Serve existing CGI (using nscgi), PHP (using PHP’s AOLserver SAPI module), and JSP/Java Servlets (using Tomcat and nsjk2).

8

What can’t I do with AOLserver?

• Not suited for hosting different customers within the same server process because of multi-threaded nature. Each customer needs their own server process.

• Not many off-the shelf applications available to download, install and run.

• No support for mod_perl at the moment.

9

Who uses AOLserver?

• Commercially:

– America Online: AOL.com, Moviefone.com, Mapquest.com, etc.

– KnowNow’s LiveServer

• Educational/Academic:

– dotLRN (.LRN) – distance e-learning (MIT Sloan School of Business, etc.)

– SMLserver – Standard ML ’97 (IT University of Copenhagen)

• Others:

– ArsDigita Community System (ACS)

– OpenACS – community site toolkit (Greenpeace, Creative Commons, etc.)

10

How do I get AOLserver?

• AOLserver is freely available, open source software, hosted at SourceForge.

• AOLserver is approximately 75K lines of C code and 5K lines of Tcl code.

• AOLserver project website is at http://aolserver.com/.

• Site contains download links of source tarballs, links to the AOLserver Wiki, and other documentation links.

• For more information on Tcl, go to http://www.tcl.tk/.

11

Examples

12

Server configuration

• The server configuration is just another Tcl script that gets executed at server start-up.

• Example “nssock” (HTTP listener) module configuration snippet:

ns_section“ns/server/${servername}/modules”

ns_param nssock nssock.so

ns_section“ns/server/${servername}/module/nssock”

ns_param port 80

ns_param hostname www.example.com

ns_param address 192.168.0.1

13

AOLserver Dynamic Pages (ADPs)

Source:

<%

set now [clock seconds]

ns_adp_puts “It is now $now, or [clock format $now].”

%>

Output:

It is now 1109047145, or Mon Feb 21 11:39:05 PM EST 2005.

14

Another way of doing it

Source:

<% set now [clock seconds] %>

It is now <%= $now %>, or <%= [clock format $now] %>.

Output:

It is now 1109047145, or Mon Feb 21 11:39:05 PM EST 2005.

15

Servlet-like request handling

Bind a Tcl proc to handle requests for a particular URL:

ns_register_proc GET /demo/time getTime

proc getTime {} {

set now [clock seconds]

set page “<html><body>\n”

append page “It is now $now, or [clock format $now].\n”

append page “</body></html>\n”

ns_return 200 text/html $page

}

16

Query a SQL database

Query a SQL database to build up part of an HTML page:

set page “<html><body>\n”set db [ns_db gethandle userdb]set row [ns_db select $db “SELECT username FROM users”]while {[ns_db getrow $db $row]} {

append page “User: [ns_set get $row username]<br/>\n”}append page “</body></html>\n”ns_set free $rowns_db releasehandle $db

17

Perform a task in a background thread

Perform a task in a background thread:

ns_schedule_proc 3600 hourlyCheck

proc hourlyCheck {} {

set errors [… collect errors from log file …]

if {[string length $errors]} {

ns_sendmail [email protected] \

[email protected] \

“Errors Encountered” $errors

}

}

18

Summary

19

AOLserver …

• was originally named NaviServer when first created in 1994.

• is an open source webserver available from SourceForge.

• is mostly written in C, approximately 75K LOC today.

• uses Tcl as its embedded scripting language, another 5K LOC.

• has employed a multi-threaded design from the start.

• is suitable for rapidly developing fast, scalable, dynamic and data-driven web applications.

• has been proven stable and capable over the years through aggressive use in some of the world’s busiest websites at AOL.

• has been ported to many platforms: Solaris, Linux, Win32, MacOS X, BSD, Irix, HP-UX, etc.

20

Questions? Comments?