Microsoft Application Center 2000 is a suite of tools designed to make it easy to build, manage, and monitor multiple-server web sites and web application platforms. Its main features include: simple-to-implement scalability, automated high availability, automatic synchronization of content and configuration, simple deployment of COM+ applications, and single-point monitoring of individual machines and the cluster overall.
This book shows how you can use Application Center to make your web sites more scalable, more robust, more reliable, and easier to maintain. It looks at the configuration and administration options you need to get started, and gives examples of bow to build pages, components, and whole applications that take advantage of Application Center's capabilities. Also discussed are issues such as testing your sites and applications, and measuring the loads that they can support.
Who is this book for?
This book is for application designers, programmers, and administrators who need
to implement or work with a scalable web site or web application based on
Windows 2000.
To run all the examples in this book you will need a minimum of four machines of
similar type and specification, running Windows 2000 Server or above.
What does this book cover?
How to install, configure and manage Application Center 2000
How to deploy web sites, and web applications on a server cluster
How to manage client state on a server cluster
How to load-balance requests on web sites and application components
How to stress test your web applications
How to monitor your server cluster and web applications
Introduction
What Does This Book Cover?
Who Is This Book For?
What Do I Need To Use This Book?
Conventions
Tell Us What You Think
Chapter 1: Scalable Web Sites and Web Applications
The Search for Scalability and Reliability
Making Hardware More Robust
Making Software More Robust
Making Systems More Scalable
System Monitoring and Performance Measurement
The Future of Application Development
Application Service Providers
Reliability and Scalability on the Web
Reliability through Multiple Machines
Scalability through Multiple Machines
So Which is Best?
What Does Application Center Do?
Simple-to-Implement Scalability
Windows Network Load Balancing
'Heartbeat' Network Cluster Management
Automated High Availability
Automatic Content and Configuration Synchronization
Simple COM+ Application Deployment
Single-Point Monitoring
Third-party Load Balancing Solutions
So, Does It Actually Perform?
Setting Up Application Center
Hardware Requirements
Windows Network Load Balancing
Third-party Load Balancing Solutions
An Inexpensive Test Platform
Installing the Application Center Software
Running Setup
Configuring Your Network Connections
Planning Your Own Network Topology
Automatic Network Configuration
Exploring the NLB Configuration
Summary
Chapter 2: Creating and Managing Web Clusters
Application Center Cluster Types
Creating Web and Stager Clusters
Creating a New NLB Cluster
Selecting the Cluster Type
Automatic Configuration of the NLB Settings
Completing the Wizard
Creating a Non-NLB Cluster
Creating a Stager Cluster
Viewing the New Cluster
Checking the Cluster and Server Status
Deployments and Synchronization Status
Viewing Performance Information
Viewing Information About a Single Server
Viewing Event Log Entries
Viewing the Cluster Monitors
Changing the Cluster IP Addresses
Adding Servers to a Web Cluster
Starting the Add Cluster Member Wizard
Specifying the Load Balancing Options
Errors while Creating or Adding Machines to a Cluster
Renaming Clustered Servers
Managing Web Clusters
Connecting to a Web Cluster
Setting Servers Online and Offline
Forcing Synchronization
Changing the Cluster Controller
Restarting Servers and Services
Setting the Cluster Properties
Specifying the Synchronization Properties
Specifying the Pre-Deployment Drain Time
Specifying the Load Balancing Affinity Options
Specifying the Request Forwarding Properties
Setting Member Server Properties
Managing Synchronization
Setting the Load Balancing Options
Setting Event Collection Properties
Disabling Performance Counter Logging
Viewing Cluster Synchronizations
Setting Synchronization Properties
Using the Browser-Based Administration Tool
Securing the Application Center Administration Web Pages
Command-line Administration Options
Using the Ioadbalance Argument
Using the cluster Argument
Removing Member Servers from a Cluster
Problems When Removing Cluster Members
Disbanding a Web Cluster
Summary
Chapter 3: Deploying Web Sites and Web Applications
The Content Synchronization Process
Synchronization Modes
Monitoring Manual Synchronizations
Deployment Options
Incrementally Updating a Cluster
Synchronization of Simple Content
Synchronization of IlS Property Settings
Synchronization of Sites and Virtual Directories
Synchronization of Components and ISAPI Filters
Synchronization of the Registry
Synchronization of COM+ Applications
What is an Application?
Publishing a Simple Web Site
Connecting to the Cluster Controller
Adding a New IP Address for the Site
Creating a New Disk Folder for the Site
Connecting to Internet Services Manager
Creating the New Web Site
Publishing the Web Site Content
And Finally, the Result
Publishing a COM+ Application
Managing Incremental Deployment
An Example Site and Classic COM Component
Installing and Testing the Component
Creating a COM+ Application
The Component Services Snap-in
Creating a New Application
Installing the Component into the COM+ Application
Using a System DSN to Define a Database Connection
Creating a New Application Package
Adding a COM+ Application to the Package
Adding a Data Source to the Package
Data Sources and the Registry
Adding Registry Keys to the Package
Adding Other Resources to the Package
Deploying Complete Web Sites and Virtual Directories
Deploying Content with a File System Path
Viewing the Application Package Contents
Deploying the New Application
Selecting the Target Server
Selecting the Applications to Deploy
Setting the Deployment Options
Viewing the Deployment Result
Deploying the New Application across the Cluster
Synchronizing Installed Applications
Planning Deployment and Synchronization
Are Application Packages Worth the Effort?
Synchronizing ASP.NET Applications
The ASP.NET Configuration and Deployment Model
Application Center and ASP.NET
Summary
Chapter 4: Managing Client Session State
Managing State for Clients
Client~Server and Executable Applications
Web-based Distributed Applications
Do You Need to Maintain Client State?
How Do You Manage Client State?
How Long Does a Client Session Last?
How Long Should You Maintain State For?
Managing Client State on Web Farms
Redirecting Visitors to Specific Servers in a Cluster
Programmatically Redirecting Requests to a Cluster Member
Storing State Globally for a Cluster
State Storage in the ,NET Framework with ASP.NET
Examples of Client State Management
Form Controls and Query Strings
The Code for this Example
Using Cookies to Maintain State
The Code for this Example
Using IE5-Specific Features
The lES UserData Persistence Behavior
lES Hypertext Applications
Using ASP Sessions to Maintain State
The Code for this Example
Accessing a Back-end Database
The Code for this Example
Using Text and XML Files on the Server
Summary
Chapter 5: COM+ Application Clusters and Routing Clusters
What is a COM+ Application Cluster?
How Do COM+ Application Clusters Work?
How Does Component Load Balancing Work?
Design issues for CLB Components
What Do COM+ Application Clusters Involve?
The Sample WroxBank Application
The Database Tables
The Application Components
The ASP Pages
Connection to the Back-End Database
Creating a COM+ Application Cluster
Connecting to the Server
The New Cluster Wizard
Client Application Component Clusters
Completing the New Cluster Wizard
Adding Servers to a COM+ Application Cluster
COM+ Application Cluster Properties
Configuring Client Application Component Clusters
Deploying our Sample Application
Creating the COM+ Application
Creating the COM+ Application
Creating the Application Packages
Deploying the BankWebApp Application to the Web Cluster
Deploying the BankCOMApp Application to the COM+ Application Cluster
Configuring the Sample Application
Enabling CLB for the Components
Specifying the CLB Request Routing Details
Running the Sample Application
But Is It Component Load-Balanced?
What is a COM+ Routing Cluster?
Creating a COM+ Routing Cluster
Configuring a COM+ Routing Cluster
Summary
Chapter 6: Web Stress Testing
The Importance of Web Testing
Web Testing and Web Stress Testing Defined
Server-Side Web Stress Testing
Goals of Server-Side Web Performance Testing
How an Application Performs Under Load
Locating What Prevents the Application From Performing More Efficiently
Testing Requirements
Determining Load Requirements for Your Cluster
Cluster Availability Requirements
Hardware Requirements
Network Requirements for the Test Environment
Locating the Bottleneck
Memory Bottlenecks
Caching
Leaking COM Components
Memory Bottleneck indicators
Other Ways to Improve the Memory Situation
Processor Bottlenecks
Processor Bottleneck indicators
COM Component Bottlenecks
COM Component Bottleneck indicators
Optimizing Database Access Via COM
Thread Gating
Network Bottlenecks
Network Bottleneck Indicators
Hard Disk Bottlenecks
Hard Disk Bottleneck indicators
Establishing a Performance Metric
Megahertz Cost Formula
Some Examples
Request Rates For Common Sites
Cluster Capacity Planning
Understanding the Effects of Slow Client Connections
A Deeper Look at Web Traffic
Baseline IlS Performance
Baseline Application Center 2000 performance
Maximum Number of Servers in a Cluster
Common ASP Performance Problems
Optimizing ASP Script Design
Working Toward Non-Blocking ASP
Secure Socket Layer
Optimizing IlS Performance and Stability
Troubleshooting Web Applications
Using Network Monitor to Look at Request Errors
Tools Available for Web Stress Testing
Application Center Test
Object Models
Data Storage Format
Stress Engine
Reporting
Performance Management Tools
Additional Resources
Summary
Chapter 7: Using Web Application Stress
The WAS Test Platform
The Goal of Your Stress Test
Where to Get the WAS Tool
Installation
Opening the Tool for the First Time
The Script View
The Script Items View
The Sample Script Files
The Script Item Details View
Reports
What Are Percentiles?
Exporting and Printing Reports
Using the Report Data
Query Strings and the Query String Editor
What's a Query String?
Why Do We Need to Edit Them?
Script Nodes
Content Tree Node
Settings Node
Perf Counters Node
Page Groups Node
Users Node
Clients Node
Cookies Node
Creating Scripts with the Script Wizards
Manual Script Creation
Browser Record Script Creation
Static or Dynamic?
Recording Wizard Options
Recording Troubleshooting
Log File Script Creation
Content Tree Script Creation
Creating a Script Using the Object Model
General Guidelines for Scripts
Preparing Your Cluster for a Stress Test
Stress Testing a Network Load-Balanced Cluster
Web Application Stress Tool Name Resolution
Name Resolution for Web Stress
Name Resolution for Client Communication
Achieving High Concurrent Connections
Determining Your Requirements
Total Number of Users
Total Concurrent Users
Peak Request Rate
Common Web Stress Testing Problems
Web Stress Troubleshooting
The Stress Test Environment
Limitations to Using Microsoft Web Application Stress
Summary
Chapter 8: Monitoring Servers and Applications
The Role of Monitoring
Application Center Monitoring
The Monitoring Architecture
Performance Monitor
Time Periods
Performance Counters
The Dangers of Aggregation
Monitors
Events
Remote Monitoring
Health Monitor
Health Monitor Agent
Monitor Types
Data Collectors
Scheduling
Thresholds
Data Collection Actions
Health Monitor - The Practicalities
What and When to Monitor
What Action to Take
Health Monitor Console
Creating Actions
Data Collectors
The Property Pages of a Data Collector
Thresholds
Summary
Chapter 9: Custom Monitors and Alerts, and the Monitoring Database
Windows Management Instrumentation
WMI Providers
Namespaces and Classes
WMI Query Lanaguage
The WMI SDK
ClM Studio
Object Browser
WBEMTest
WBEMDump
The Application Center and Health Monitor WMI Providers
Namespaces
Using the WMI Event Providers
Application Center Event Classes
Health Monitor Event Classes
Building a Monitoring Tool
The Sample Monitoring Tool
The Application Center Administration Interface
Using the ACAI
An ACAI Class Structure
WMI Events
Creating an Event Sink
Using the Event Context
Receiving Events
The Application Center Database
Connecting to the Database
Database Structure
Tables
Stored Procedures
Views
Viewing Data
Adding Performance Counters
MOF Files
Compiling MOF Files
The Future of Application Center Monitoring
Summary
Appendix A: Command-Line Administration Utility
The APPLICATION Command
The/create Parameter
The/delete Parameter
The/list Parameter
The/addresource Parameter
The/removeresource Parameter
The/listresources Parameter
The CLB Command
The/setclbmembers Parameter
The/Ioadclbmembers Parameter
The/addclbmember Parameter
The/removeclbmember Parameter
The /listclbmembers Parameter
The CLUSTER Command
The/create Parameter
The/delete Parameter
The/add Parameter
The /remove Parameter
The/setcontroller Parameter
The/clean Parameter
The/listmembers Parameter
The /listnics Parameter
The DEPLOY Command
The/start Parameter
The/listdeployments Parameter
The/terminate Parameter
The/enablesync Parameter
The/disablesync Parameter
The/status Parameter
The LOADBALANCE Command
The/online Parameter
The/offline Parameter
The/setnlbweight Parameter
The/status Parameter
The HELP Command
Appendix B: Health Monitor Defaults
Data Groups
Default Actions
'E-Mail Administrator' Properties
'Log to offline.log' Properties
'Log to websitefailures.log' Properties
Default Synchronized Monitors
Application Center Monitors (Data Group)
Cluster Service
Health Monitor Action Failure
Request Forwarding Failure
Server Offline
Synchronization Sessions (Disabled)
Application Center Log Monitors (Data Group)
Log Agent Job Failure (disabled)
Log Agent Service (disabled)
Log Database Server (disabled)
Log Database Size (disabled)
Online/Offline Monitors (Data Group)
W3SVC
System Monitors (Data Group)
Logical Disk (disabled)
Memory
Processor
Web Site Monitors (Data Group)
http://127.0.O.1
Index
Okay, so you've got your Internet connection set up, installed Windows 2000, knocked together a simple e-commerce site, and you're going public on the Web! With a bit of luck, and some determined effort adding your URL to the major search engines, you'll have visitors coming to see what all the fuss is about. You can start selling your wares, publicizing your products and services, collecting contact information and sales leads, and generally getting 'into' this whole e-commerce thing.
Then there comes that subtle shift - it takes time, but it happens - and you start to depend more and
more on that web site. It takes up more of your time, and more of your company's investment. At the same time, it brings in a larger proportion of your company's sales and leads, and before you know it you've become a fuUy-fledged dot-com without even realizing! Your future is inexorably linked to the global marketplace of the Internet...
And then the server dies. With it go all your sales, all your leads, all contact with your customers. When they come back for a repeat purchase, they get nothing but a '404 - Page not found' error. It's not like a sign on the door that says 'Gone for lunch, back in 5 minutes' - as far as visitors to your site are
concerned this just says 'Gone'. They'll find someone else to buy their custom widgets from.
Yes, at this point you need to start thinking like a real online company. You're no longer just playing on the Web as a sideline to your business. Once you start to depend on the Internet to provide input for you and your company, you need to start thinking seriously about what might happen if you suffer from system failures.
What Does This Book Cover?
As you can probably guess by now, this book is about how you can protect your systems from some of the catastrophic failures that can potentially bring your business to a grinding halt. We're not going to cover all the issues that might arise - that would cover a multitude of different issues at every level of
your site's implementation, and even then wouldn't guarantee 100% uptime.
We are, however, going to concentrate on two specific questions:
How can your web site or web application survive server failures?
How can it cope with an increasing and often variable loading from visitors?
Microsoft has recently released a product that is aimed squarely at helping to resolve these two issues:
Microsoft Application Center 2000 (MSAC). This book is all about what MSAC is, and how you can use it to make your web sites more scalable, more robust, more reliable, and easier to maintain.
In fact, these four issues are at the heart of what we're going to be covering in this book. We'll see how each component of MSAC relates both to these terms, and to the general problems of building, running and managing a web site or application.
So, what exactly is Application Center? It's a combination of tools and features that are designed to make it easy to build, manage, and monitor multiple-server web sites and web application platforms.
The major feature areas that the product provides are:
Simple-to-implement scalability, using multiple servers to 'scale out'
Automated high availability through load sharing and automatic fail-over
Automatic synchronization of content and machine configuration across a cluster
Simple deployment of Windows 2000 COM+ applications that use components
Single-point monitoring of individual machines and the cluster overall
In the course of this book, we'll look at all of these issues, mainly from a programmer's point of view. Of course, building and managing a web farm is a technological and administrative process, and not just a programming issue. So, we'll aim to provide a mixture of information that takes you all the way from zero to ground zero!
We'll start off by taking a look at the configuration and administration options you'll need to get started using Application Center, and then see examples of how you can build pages, components and whole applications that take advantage of its capabilities. We'll also discuss issues like testing your sites and applications, and measuring the loads that they can support.
Just in case you're thinking that you have to spend hundreds of thousands of dollars to get started with Application Center, we should point out that our test system ('which you'll see in Chapter 7) was built from scratch for less than US$4,000. Something simple like this is ideal for experimenting with the technology and getting your feet wet; and with luck, you get to keep the machines afierwardsfor your own office or department/
Who Is This Book For?
Obviously, we're aiming this book at people who are likely to need to implement some kind of scalable web site or web application. This includes application designers, programmers and administrators, all of whom probably need (or want) to have some input into the process. SO, whether you're an individual or corporation with your own Internet connection, an Internet Service Provider (ISP), or perhaps even an Application Service Provider (ASP), this book is aimed at you. The only caveat is that you must be using Microsoft Windows 2000.
Of course it's quite possible that you, as an individual, won't initially find you need the entire book: you might just be interested in programming, administration, monitoring, or some other specific aspect of the technology. However, you may well find (as we did) that the more you look at Application Center, the more you want to learn about it, and the more you want to do with it. Its inherently extensible monitoring environment, for example, just begs to be used in all kinds of exciting new ways.
Even if you never intend to build your own web farm, you might be thinking about using a host that does. In the not-so-distant furore, we're likely to see ISPs implementing Application Center on behalf of their customers. In such circumstances, it will be very useful to understand its underlying concepts, and important to appreciate how they affect the environment in which your programs and web applications will execute.
What Do I Need to Uso This Book?
If you intend to experiment with Application Center, you will need a little more ill terms of hardware than the odd spare server that might be lying around unused. To build a test cluster, you need at least two machines of the same type and specification, with Windows 2000 Server (or above) installed. This will allow you to experiment with load balancing for web clusters, and cluster management. You can also build a load-balanced COM+ application cluster from two machines. However, to really see all the features of the product in use, especially where you want to experiment with web clustering and COM+ application clustering together, you'll need a minimum of four such machines. Each of these should have:
A 400 MHz (or higher) Pentium-compatible processor
MS Windows 2000 Server, Advanced Server, or Datacenter Server (with Service Pack 1)
At least 256 MB RAM
100 MB of available hard-disk space for MSAC services, plus additional space for site content and databases
A CD-ROM drive
One Network Interface Card (2 recommended)
In Chapter 1, we discuss the specifications and network architecture requirements in more detail.
To use Windows Network Load Balancing (NLB), you'll need two network cards in each machine (preferably the more recent types of card - some old ones do not perform well with Windows NLB), as well as two network hubs and interconnecting cables in order to connect the machines. Other equipment, such as a KVM (Keyboard/Video/Mouse) switch can be very useful, allowing all the machines to be managed via a single keyboard, mouse and monitor. Finally, of course, you'll need the
Application Center software itself.
Alternatively, you can simply read along and just believe everything we tell you.
As to experience, we'll be assuming that you are reasonably familiar with the basic programming techniques of the Web, such as:
Visual Basic/VBScript
JavaScript/JScript
Microsoft Active Server Pages
and with how web servers and the Internet work in general. We won't delve into complex programming issues, so you don't need to be an expert with these languages. Instead, we'll simply use them to demonstrate how to build applications that are Application Center-friendly, or take advantage of its special features.
All the source code for the examples this book is available for download from our web site, at http://www.wrox.com.
Conventions
To help you get the most from the text and keep track of what's happening, we use a number of stylistic conventions throughout the book. For instance:
These boxes hold important, not-to-be forgotten information that is directly relevant to the surrounding text.
While this style is used for asides to the current discussion.
As for styles in the text:
When we introduce important words, we highlight them.
We show keyboard strokes like this: Ctrl-A
Filenames and code within a passage of text are in a fixed-width font: doGet ( )
URLs and text on user interfaces are shown as: Menu
We present example code in two different ways:
This style is used for code that!s new, important, or pertinent to the current discussion,
while this style is used for code that's less important in the
present context, or which has been seen before.
Tell Us What You Think
We've worked hard to make this book as useful to you as possible, so we'd like to know what you think.
We're always keen to know what it is you want and need to know.
We appreciate feedback on our efforts and take both criticism and praise on board in our future editorial efforts. If you've anything to say, let us know via e-mail:
feedback @ wrox.com
or via the feedback links on our web site:
http ://www.w rox. co m