TCL 2 K

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 77

Tcl in AOL Digital City

The Architecture of a Multithreaded High-Performance Web Site Jim Davidson America Online, Inc. February 16, 2000

Welcome To Digital City

2/16/2000

Tcl in AOL Digital City

You Just
Included 48 dynamic template files Invoked over 5000 Tcl commands:
58 distinct C commands 67 distinct Tcl procs

Locked and unlocked over 800 mutexes Searched a database through a special Tcl proxy process interface Selected promos for over 10 advertising slots And much more all in under 150,000 microseconds (which is actually pretty fast)

2/16/2000

Tcl in AOL Digital City

Overview
Digital City, an online service of America Online Inc., is powered by AOLserver, a dynamic, multithreaded Tcl application development platform This talk will describe AOLserver, multithreaded Tcl, and the Digital City web platform

2/16/2000

Tcl in AOL Digital City

AOLserver and Multithreaded Tcl

AOLserver Background
AOLserver is a web application development environment used throughout AOL, e.g.:
Digital City, AOL.com, AOL Search, Shop@AOL, AOL.com/Netscape WebCenters, and many more...

AOLserver is based on NaviServer:


NaviServer was developed by NaviSoft, a small web startup company acquired by AOL in 1994 NaviServer included many novel features including support for NaviPress, an HTML editor/browser, and database integration

AOLserver is now in OpenSource, available for download at http://www.aolserver.com


2/16/2000 Tcl in AOL Digital City 6

AOLserver Basics
AOLserver is a full featured, multithreaded web application development environment for Unix and NT In addition to static page serving and CGIs, AOLserver includes a rich and flexible C API for:
Dynamically loading user-written C modules (DLLs) Binding functions to arbitrary web requests SQL database services Cron-like background task scheduling Asynchronous socket callbacks And much more...

2/16/2000

Tcl in AOL Digital City

AOLserver Tcl
However, the most useful aspect of AOLserver has always been its complete Tcl integration Tcl integration is not unique to AOLserver, other implementations include:
Apaches mod_tcl Binary Evolutions VelociGen Vignettes Story Server

Among other advantages, integrated Tcl generally provides higher performance than CGI-based solutions

2/16/2000

Tcl in AOL Digital City

AOLserver Tcl Model


For AOLserver, the Tcl integration model is (in general) to provide a Tcl command interface to the underlying C API Tcl commands are available to:
Handle URL requests, query a database, send email, monitor the system, and much more

Lets take a look at a few examples...

2/16/2000

Tcl in AOL Digital City

Example: CGI-style Request Procedures


ns_register_proc binds procs to arbitrary requests:
ns_register_proc GET /demo/time getTime
proc getTime {} { set headers [ns_conn headers] set browser [ns_set iget $headers User-Agent] set page <html><body>\n append page Time: [clock seconds]<br>\n append page Browser: $browser\n append page </body></html> ns_return 200 text/html $page }

2/16/2000

Tcl in AOL Digital City

10

Example: Database Access


ns_db can be used to access an SQL database:
ns_register_proc GET /demo/movies getMovies
proc getMovies {} { set page <html><body>\nCurrent Movies:\n set db [ns_db gethandle moviedb] set row [ns_db select $db select * from movies] while {[ns_db getrow $db $row]} { append page [ns_set get $row movie]<br>\n } append page </body></html> ns_set free $row ns_db releasehandle $db ns_return 200 text/html $page }

2/16/2000

Tcl in AOL Digital City

11

Example: Background Tasks


ns_schedule_proc can register a background script:
ns_schedule_proc 3600 hourlyCheck
proc hourlyCheck {} { set errors [ collect errors from log file ] if {$errors != } { ns_sendmail errors@mydomain.com \ aolserver@mydomain.com \ Errors Encountered $errors } }

2/16/2000

Tcl in AOL Digital City

12

Example: AOLserver Dynamic Pages


AOLservers most useful Tcl interface is ADP AOLserver Dynamic Pages Modeled on Microsoft IIS Active Server Pages, ADP:
Places the logic (Tcl) in the presentation (HTML) Provides easier learning curve for HTML developers Supports reuse through multiply included templates Is highly optimized through aggressive template and bytecode caching techniques

2/16/2000

Tcl in AOL Digital City

13

Example: Simple ADP Template


Returning the time and browser is now a bit cleaner:
<%
set headers [ns_conn headers] set browser [ns_set iget $headers User-Agent] set time [clock seconds] %> <html><body> Time: <%= $time %> Browser: <%= $browser %> </body></html>

2/16/2000

Tcl in AOL Digital City

14

Example: ADP Debugging


Another benefit of ADP is support for TclPro:
<html> <body> <% ns_adp_puts [ns_time]%> ...

2/16/2000

Tcl in AOL Digital City

15

AOLserver Multithreaded Tcl


While AOLserver provides a powerful Tcl interface, whats really interesting is AOLservers use of multithreaded Tcl First, a quick multithreading review...

2/16/2000

Tcl in AOL Digital City

16

What is Multithreading?
Multithreading is an environment where more than one thread of execution is active in a program:
Single threaded: Exclusive access to memory, files, etc.

Multithreaded: Simultaneous access to memory, files, etc.

memory, open files, etc.

memory, open files, etc.

2/16/2000

Tcl in AOL Digital City

17

What Youll Want to Know


Posix Threads (pthreads): A well considered threading API used as the model for Tcl 8.2 and AOLserver 3.0 Basic thread primitives:
Creating and joining (waiting for) threads Mutexes (or locks) to protect shared data Condition variables to signal and synchronize threads Thread local storage to maintain per-thread data which can not be passed directly between functions

2/16/2000

Tcl in AOL Digital City

18

What You Can Generally Ignore


Win32 Threads: Posix threads, some would say, are a more useful framework for server applications Higher level objects and interfaces you can generally ignored because theyre normally a bad idea:
Read/Write locks Critical Sections (or recursive mutexes) Semaphores Thread Priorities and Scheduling Thread Cancellation and Exception Handling

2/16/2000

Tcl in AOL Digital City

19

Why Are Threads Good?


For some problems, threads can increase throughput by running simultaneously on separate CPUs For some problems, threads can provide faster access to expensive shared resources (e.g., a large cache) For some problems, threads can provide a simpler programming environment than event-driven models

2/16/2000

Tcl in AOL Digital City

20

Example: Event-Driven vs Thread I/O


I/O bound apps are sometimes easier with threads:
proc my.thread {host} { set sock [socket $host 80] puts $sock "GET /index.html\r\n" flush $sock read $sock close $sock } foreach host {host1 host2 host3 host4} { lappend tids [ns_thread begin my.thread $host"] } foreach tid $tids { ns_thread wait $tid } global done count proc my.read {sock} { global done count read $sock if [eof $sock] { close $sock if {[incr count -1] == 0} { set done 1 } } } proc my.write {sock} { puts $sock "GET /index.html\r\n" flush $sock fileevent $sock readable "my.read $sock" } set count 0 foreach host { host1 host2 host3 host4} { incr count set sock [socket -async $host 80] fconfigure $sock -blocking off fileevent $sock writable "my.write $sock" } vwait done

Threads Events

2/16/2000

Tcl in AOL Digital City

21

Why Threads May Be Bad


Check Johns old presentation on why threads might not be a good idea:
What's Wrong With Threads?
casual all programmers wizards

Why Threads Are A Bad Idea (for most purposes)


John Ousterhout Sun Microsystems Laboratories
john.ousterhout@eng.sun.com http://www.sunlabs.com/~ouster
u u

Visual Basic programmers C programmers Why Threads Are Hard C++ programmers Synchronization: Threads programmers Must coordinate access to shared data with locks. Too hard for most programmers to use. Forget a Why Threads Are Hard, cont'd lock? Corrupted data.
u

Even for experts,Deadlock: u development is painful. u Hard to debug: data dependencies, timing dependencies. Circular dependencies among locks. u Threads break abstraction: can't design Each process waits for some other process: system modules independently. 28, 1995, slide 5 Why Thre ads Are A Bad Idea September hangs. u Callbacks don't work with locks. thread 1 lock A T1 lock T2 deadlock! B thread 2 T1
calls Module A deadlock! September 28, 1995, slide 6 Module B sleep wakeup Module B callbacks T2
September 28, 1995, slide 7

Module A
Why Thre ads Are A Bad Idea

Why Thre ads Are A Bad Idea

2/16/2000

Tcl in AOL Digital City

22

Multithreaded Tcl
For better or worse, Tcl was not designed with thread support in mind as the single threaded, event-driven model served most purposes well (e.g., Tk) However, the code was well implemented so that adding thread support was not entirely impossible Lets look at what was done in Tcl 8.2 to support threads...

2/16/2000

Tcl in AOL Digital City

23

Multithreaded Tcl - Mutex Protection


First, various shared data had to be protected with mutexes, e.g., from tclUtil.c:
void Tcl_PrintDouble(interp, value, dst) { char *p, c; Tcl_UniChar ch; Tcl_MutexLock(&precisionMutex); sprintf(dst, precisionFormat, value); Tcl_MutexUnlock(&precisionMutex); ...

2/16/2000

Tcl in AOL Digital City

24

Multithreaded Tcl - Thread Local Storage


Next, various global data had to be moved to thread local storage, e.g., from tclIO.c:
void Tcl_SetStdChannel(channel, type) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); switch (type) { case TCL_STDIN: tsdPtr->stdinInitialized = 1; tsdPtr->stdinChannel = channel; break; ...

2/16/2000

Tcl in AOL Digital City

25

Multithreaded Tcl - Event Loop


Finally, the event loop was modified so each thread maintains a (seemingly) independent event loop
Threads interested in file events: Other Threads

1. Threads sends files to watch to Notifier and enters condition wait...

3) Notifier wakes up individual threads when file of interest is ready Select Loop

2. Notifier watches files for all threads with single select() loop

2/16/2000

Tcl in AOL Digital City

26

Tcl 8.2 Multithreading Issues


Although Tcl 8.2 is a huge step forward, it still has some issues:
No commands to create, join, or synchronize threads No commands to share resources (e.g., variables, open files) Some code is not yet entirely thread safe (e.g., glob) The event-loop and memory allocator may be bottlenecks Installations normally default to not compiling with threads

Happily, AOLserver has addressed these issues...

2/16/2000

Tcl in AOL Digital City

27

AOLserver Multithreaded Tcl


AOLserver extends and patches Tcl 8.2 with:
Commands for creating, joining, and synchronizing threads Commands for sharing variables (files are harder) A zippy cool replacement for the memory allocator Compile time patches for thread unsafe routines (e.g, -Dreaddir=ns_readdir)

In addition, AOLserver addresses a basic problem of multithreaded Tcl - nearly seamless multithreaded interpreter initialization

2/16/2000

Tcl in AOL Digital City

28

Multithreaded Tcl Interp Initialization


Problem: Interps created throughout the lifetime of a a multithreaded application which include (almost) the same state (commands, procedures, etc.) One solution could be the package interface of Tcl 8.2 for lazy, per-interp initialization

2/16/2000

Tcl in AOL Digital City

29

AOLserver Tcl Interp Initialization


However, because it pre-dates 8.2, AOLserver has instead used three different initialization solutions:
A pool of pre-initialized interps Direct linking of select parts of the interp structure Cloning of a single master interp for later interps

Lets take a look at each solution...

2/16/2000

Tcl in AOL Digital City

30

First Solution: Interp Pools


AOLserver 2.0 used a pool of pre-initialized interps:
At startup, interps were initialized and place in the pool Threads would allocate interps from the pool when needed

Thread requiring an interp

Thread allocates interp from pool C

Thread returns interp when done C A B C

Interp Pool

Interp Pool

Interp Pool

2/16/2000

Tcl in AOL Digital City

31

First Solution: Interp Pools


Results of pooling:
Limited locking and high performance Possibility for threads to backup waiting for interps Sharing variables required a command interface (ns_var) Special APIs to initialize interps at startup were weird (and unfortunately persist to this day)

2/16/2000

Tcl in AOL Digital City

32

Second Solution: Direct Sharing


AOLserver 2.1 attempted a share everything model by simply linking sharable parts of the interp structure:
At startup a single master interp was created and initialized Later threads would create half interps with links to master interp structures (e.g., command and global variable tables)
Master Interp initialized at startup Additional threads would create half interps

Command Table C Variable Table V

2/16/2000

Tcl in AOL Digital City

33

Second Solution: Direct Sharing


Direct Sharing Results:
Dynamic update trivial and instant Unfortunate sharing of some global variables, (e.g., errorInfo) Necessary locking resulted in severe lock contention Extent of the modifications to the Tcl 7.4 source code made upgrades to Tcl 7.5, let alone 8.x, very difficult

2/16/2000

Tcl in AOL Digital City

34

Latest Solution: Interp Cloning


AOLserver 3.0 introduced an interp cloning model:
At startup, a single master interp is used for initialization After startup, new interps are created and then updated by copying commands and procs from the master
Complete interps for other threads

Master interp initialized at startup

Command Table C C Variable Table V Commands, etc. copied from master V C V

2/16/2000

Tcl in AOL Digital City

35

Latest Solution: Interp Cloning


Results of interp cloning:
Limited locking and high performance Shared variables again requires a command interface (nsv) Consistent with Tcl 8.2 model of interp(s) bound to threads Implementation requires no code change to the Tcl 8.2 source, easing forward migration

2/16/2000

Tcl in AOL Digital City

36

AOLserver Multithreaded Tcl Examples


While the implementation of multithreaded Tcl is somewhat complicated and goofy, its use is still pretty straightforward Lets look at some examples...

2/16/2000

Tcl in AOL Digital City

37

Example - Creating Threads


Threads can be created and joined with ns_thread:
proc my.thread {host} { open socket, fetch page } foreach host {host1 host2 host3 host4} { lappend tids [ns_thread begin my.thread $host"] } foreach tid $tids {ns_thread wait $tid}

2/16/2000

Tcl in AOL Digital City

38

Example - Sharing Memory


Data can be shared with nsv variables:
proc my.thread {host} { nsv_set pages $host [ open socket, fetch page ] } foreach host {host1 host2 host3 host4} { lappend tids [ns_thread begin my.thread $host"] } foreach tid $tids {ns_thread wait $tid} foreach host {host1 host2 host3 host4} { data available via [nsv_get pages $host] }

2/16/2000

Tcl in AOL Digital City

39

Example - Simple Cache


nsv and ns_mutex can implement a simple cache:
proc cache.get {key} { set lock [nsv_get cache lock] ns_mutex lock $lock if ![nsv_exists cache value,$key] { nsv_set cache $key [ fetch data for $key ] } set value [nsv_get cache $key] ns_mutex unlock $lock return $value }

2/16/2000

Tcl in AOL Digital City

40

Example - Real Cache


Unfortunately, a real cache is generally more complicated, requiring the ns_cond command as well:
proc cache.get {key} { set lock [nsv_get cache lock]; set cond [nsv_get cache cond] ns_mutex lock $lock if ![nsv_exists cache $key] { nsv_set cache $key ns_mutex unlock $lock set value [ fetch data for $key ] ns_mutex lock $lock nsv_set cache $key $value ns_cond broadcast $cond } else { while {[set value [nsv_get cache $key]] == } { ns_cond wait $cond $lock } } ns_mutex unlock $lock return $value } 2/16/2000 Tcl in AOL Digital City 41

Putting AOLserver To Use


While AOLserver is a powerful and flexible platform, by itself its not a solution for any interesting web sites Instead, web sites must generally extend AOLserver with functionality to support specific needs The Digital City web platform is an example of putting AOLserver to use for a custom service solution

2/16/2000

Tcl in AOL Digital City

42

The Digital City Platform

What is Digital City?


Digital City is a local entertainment and information guide available through many brands:

2/16/2000

Tcl in AOL Digital City

44

The Digital City Challenge


Digital City presents some interesting technical challenges:
High performance database-driven apps (e.g., MovieGuide) Re-usable interactivity features (e.g, comment boards) Complex advertising features and management tools Rapid application development

Digital City also inherits AOLs media-company legacy of continuous, instant editorial content publishing

2/16/2000

Tcl in AOL Digital City

45

And Digital City Must Scale


Digital City must support huge traffic from AOL, for example, from the Welcome Screen of death:

2/16/2000

Tcl in AOL Digital City

46

The Digital City Architecture


To address these challenges, Digital City maintains a complex, multi-server architecture:
1 Web Page
Title Blah, Blah, Blah

Art01

Editor -request s update page -c ompletes form -s ubmit s update

Update Form
Title

Art02

Text Blurb Blah, Blah, Blah Browse

Front End

Publish

Member

Switch

Front End

Pub

Editor

Member -request s http://home.digitalci ty.com -Swi tch distributes reques t -Front End returns page with updated components

Front End

Poll

SOB/NCB 3 Front End Server -request s update from SOB server -c ac hes updated content

Pub Server -Adds image to Art servers -Updates SOB server -Sends cache flush notic e t o Front End servers

2/16/2000

Tcl in AOL Digital City

47

Digital City Servers


Servers at Digital City all share a common AOLserver core and set of extensions:
APPLICATIONS ADP PAGES APPLICATION TCL PROCS DCI TCL PROCS NCB ROSETTA POLL PROXY ART SOB NCF DCI Module NV NT

RPC
AOLserver OS (SUN, IRIX, LINUX)

2/16/2000

Tcl in AOL Digital City

48

Some Numbers...
The Digital City platform currently comprises:
6000+ ADP templates with 170,000+ lines of HTML and Tcl 100,000+ lines of Tcl in an additional 800+ library files 3,000+ Tcl procs and 450+ C functions, of which about 280 implement Tcl commands Multiple SQL/PLS databases with collectively over 1M records

All of which must daily:


Handle millions of page views Process 100,000+ database record updates Publish and index 7,000+ new articles Accumulate over 3gigs of log data

2/16/2000

Tcl in AOL Digital City

49

Examples
Seems like theres probably not enough time to look at all that! So, lets take a look at three interesting examples:
NV: Network shared variable arrays Proxy: Tcl proxy process interface Sob: Small Object server
NCB ROSETTA

POLL

NV

PROXY

ART

SOB NCF

RPC

2/16/2000

Tcl in AOL Digital City

NT

50

Example: NV
NV (Network Variable) is an extension of the nsv shared variable interface in AOLserver:
A client (e.g., front end server) can request streaming updates from a backend server Client variable interface remains the same

NV is useful for several applications, e.g.:


Sport scores: Continuous updates, streamed incrementally Movies Top 10: Recurring bulk-updates of aggregated data Meta data: Occasional updates of data which must be consistent on all client, e.g., list of known cities

2/16/2000

Tcl in AOL Digital City

51

Example: NV
1. Front end serveres connect to Pub for scores nv array Pub 2. Sports scores sent continuously to Pub by provider in weird format

3. Pub reformats as nv array and streams updates to connected clients

4. Tcl templates access scores nv array without regard to underlying network updates: <html> Current Scores: <%= [nv.get scores current] %> ...

2/16/2000

Tcl in AOL Digital City

52

Example: Proxy
The proxy interface is a modified Tcl-shell capable of communicating via pipes with AOLserver:
Processes are forked on demand and maintained in a pool Pools are initialized with application-specific startup scripts, e.g., open a particular PLS database

The proxy interface is used for several purposes:


Isolation of code which is not thread safe Evaluation of code which fiddles with env, e.g., env(TZ) A light wait process to fork background process (forking a 500meg AOLserver can be problematic)

2/16/2000

Tcl in AOL Digital City

53

Example: Proxy
2. Scripts sent to proxy with proxy.send: <html> Search Results: <% set script pls.search $query foreach doc [proxy.send db $script] { ns_adp_puts [putheadline $doc] } %> ... Proxy Shell

1. At startup, pool is initialized with init script, e.g., open db

AOLserver Process

4. Proxy results available in AOLserver interp->result

3. Script evaluated in proxy, results returned through pipe

2/16/2000

Tcl in AOL Digital City

54

Example: Sob
Sob (Small Object) is a highly optimized client/server interface:
Access through pools of persistent socket connections Aggressive caching and optimized I/O

Sob is a critical platform component used for:


Dynamic publishing of editorial content Storage of meta data for various service areas Comment board fetch and post

2/16/2000

Tcl in AOL Digital City

55

Example: Sob
1. Editor uses Pub tool to send article to SOB

2. Member requests article; template ignores complexity and simply executes: <html> Article: <%= [nsob.get articleid] %> ...

Pub 3. Clients checks for article in client cache and, if necessary, requests from server

SOB Server 4. SOB checks server cache and, if necessary, reads article from disk, and returns article to client

SOB Clients (Front end Server)

2/16/2000

Tcl in AOL Digital City

56

Sob-Powered Publishing Tools


Whats useful about Sob is support for forms-based publishing of content independent of presentation:

SOB

Templates

2/16/2000

Tcl in AOL Digital City

57

Extensions Working Together


The Digital City extensions provide a powerful set of interfaces and APIs for AOLserver However, theyre most useful when used together for a particular applications Lets take a look at MovieGuide as an example...

2/16/2000

Tcl in AOL Digital City

58

MovieGuide
The Digital City MovieGuide provides our members:
Theater, movie, and show time listing Boards for members to provide ratings and reviews My Theaters personalization Top Ten listings by member views and clicks

2/16/2000

Tcl in AOL Digital City

59

MovieGuide Features

Member Top Clicks (NV)

Movie Synopsis (Sob)

Member Ratings (Tally) Showtimes (PLS)

Movie / Theater Listing (PLS)


2/16/2000

My Theaters

Tcl in AOL Digital City

60

MovieGuide Components
MovieGuide uses many of our platform extensions including:
Fast front end PLS search database through Tcl proxies Network tally system to record site activity NV to broadcast aggregation of site activity Sob for editorial content And much more

However, it didnt always work this way...

2/16/2000

Tcl in AOL Digital City

61

MovieGuide 1.0
MovieGuide 1.0, launched summer 1997, utilized a straightforward SQL-based architecture to query listings and update Top-10s

Alamo Drafthouse, Regal Arbor 7... select movies where update views where Where is the English Patient showing?

2/16/2000

Tcl in AOL Digital City

62

MovieGuide 1.0 Issues


While it provided a convenient data model, the SQLbased MovieGuide was a disaster:
Threads would quickly backup waiting for database handles Squid caching proxy servers rushed into production reduced the load, but broke the 100% dynamic page model Direct Top-10 updates from the front ends caused locking problems with concurrent backend publishing

A more dynamic model which could handle direct traffic was required...

2/16/2000

Tcl in AOL Digital City

63

MovieGuide 2.0
MovieGuide 2.0, early 1998, utilized a new file-based caching mechanism and background Top-10 updates:

Access listings through cache Regal Arbor 7, Dobie 4... Where is Titanic showing? On cache miss, select movies where

Background Top-10: update views where update views where

2/16/2000

Tcl in AOL Digital City

64

MovieGuide 2.0 Issues


Unfortunately, the Top-10 updates where still a problem and the cache didnt work so well:
90 80 70

Cache hit %

60 50 40 30 20 10 0

Increasing data combinations e.g., more cities, with more theaters, with more showtimes

2/16/2000

Tcl in AOL Digital City

65

MovieGuide 3.0
Launched in mid-1998, MovieGuide 3.0 utilized a new fast PLS-based proxy database and a special network tally mechanism for Top-10s:
Proxy PLS Front End Proxy Switch PLS Front End Proxy PLS Front End Periodic Tally sweep and broadcast PLS Pub Proxy Sybase DB Asynchronous Tally messages

2/16/2000

Tcl in AOL Digital City

66

MovieGuide 3.0 Success


The use of PLS provided excellent, direct search performance The network tally interface eliminated contention with backend publishing tasks and reduced front end load Improved performance and scalability of MovieGuide 3.0 allowed us to double our MovieGuide cities and add cool new features such as My Theaters

2/16/2000

Tcl in AOL Digital City

67

Monitoring Performance
As demonstrated by the MovieGuide, one can easily fall into some deadly performance traps One of the first lesson learned by Digital City is to watch for trouble by monitoring whats happening under the covers Lets look at a few statistical interfaces...

2/16/2000

Tcl in AOL Digital City

68

URL Stats
The ns_server urlstats provides timing statistics of individual URLs, a good first place to look for performance hotspots:

2/16/2000

Tcl in AOL Digital City

69

Tcl Statistics
The ns_stats command returns the usage counts of individual commands, a great way to look for fat procedures which could be moved to C:

2/16/2000

Tcl in AOL Digital City

70

Anything Specific to Multithreading?


A common technique when a bottleneck is discovered is to utilize some high speed cache However, in multithreaded processes, caches require mutex locks which can result in lock contention The ensure high hit rate and low contention:
Write proper cache code! Monitor hit rates and contention closely

2/16/2000

Tcl in AOL Digital City

71

Cache Statistics
To monitor memory cache hit rate, use the ns_cache_stats command:

2/16/2000

Tcl in AOL Digital City

72

Lock Contention
To monitor lock contention, use the ns_info locks command:

2/16/2000

Tcl in AOL Digital City

73

Overall Performance
Finally, because multithreaded applications can be so unpredictable, be sure to track overall performance under actual load - Tk is a good choice:

2/16/2000

Tcl in AOL Digital City

74

Wrap Up

Who Developed and Operates Digital City?


The Digital City Tech Team!

2/16/2000

Tcl in AOL Digital City

76

Where To Get More Information


For more information on AOLserver and to download the AOLserver source visit: http://www.aolserver.com For information on the Tcl 8.x thread model and to download TclPro visit: http://www.scriptics.com For an excellent collection of tutorials and guides on AOLserver-based database-driven web sites visit: http://photo.net

2/16/2000

Tcl in AOL Digital City

77

You might also like