Site Server - VC-Warp: Optimizing Performance with ISAPI Caching

September 1999 

Introduction

For those whose business relies on electronic commerce, performance is a major concern. If your commerce server is operating at or near capacity and if the user's experience is being compromised by long response times, then you are probably turning away potential shoppers and penalizing yourself with missed sales opportunities.

In the previous version of the Volcano Coffee site, VC Rocket, we focused on how to improve performance through more efficient Active Server Page (ASP) coding practices. The reality is that enhancements to ASP code can take us only so far in our goal of the ultimate performance. ASP is an interpreted language that must be dynamically parsed by the Web server each time the page is executed. The overhead of this process limits the performance of ASP. The solution is to translate critical ASP pages into compiled Internet Server Application Programming Interface (ISAPI) extensions, and to convert relatively static ASP pages into HTML. The ASP to ISAPI translation can provide 14 to 20 times page throughput improvement and the ASP to HTML conversion normally provides 8 to 10 times page throughput improvement. These translate to 50 to 60% more concurrent user capacity than previously achieved in VC Rocket.

Site Server 3.0 Commerce Edition

Site Server 3.0 Commerce Edition (SSCE) is a comprehensive Internet commerce server, optimized for Microsoft® Windows NT® Server and Microsoft® Internet Information Server (IIS), version 4.0. It enables businesses to cost-effectively engage in transactions with customers and business partners online. SSCE is designed to enable businesses to author new commerce sites, add commerce capabilities to existing Web sites, and to extend Intranet sites to select business partners. By integrating with IIS and Windows NT Server, SSCE provides a secure, reliable, and comprehensive Internet commerce platform with limited need for customization.

There are two resources provided with SSCE to facilitate the creation of a commerce site: the Site Builder Wizard and the SSCE sample sites. The Site Builder Wizard provides a simple, step-by-step interface for designing and creating an electronic commerce site. Based on options you choose the Site Builder Wizard creates the ASP files needed to produce a fully functional commerce site. You can then customize your site using the coding examples provided in the SSCE sample sites.

Volcano Coffee is one of the sample sites contained in the default installation of SSCE:

Sample Site

Description

Volcano Coffee

A fictitious retailer of products for coffee lovers, an example of a site providing more complex elements, such as shopper registration, product promotions, and more sophisticated navigation options.

This document compares different implementations of the Volcano Coffee site and demonstrates how translating of ASP pages into either ISAPI extensions or static HTML can greatly improve SSCE server performance.

How VC Warp Works

A Brief History 

VC-Warp builds on previous enhancements to the Volcano Coffee sample site. (For more information on Volcano Coffee, VC-Turbo, or VC-Rocket, see the Site Server 3.0 Commerce Edition Resource Kit, available at https://www.microsoft.com/siteserver/commerce/DeployAdmin/ResKit.asp .)

VC-Warp is the third performance enhancement to the Volcano Coffee sample site shipped with Site Server 3.0 Commerce Edition. There are four versions of the Volcano Coffee sample site shipped with SSCE 3.0: VC-30, VC-Turbo, VC-Rocket, and VC-Warp. VC-Warp requires that VC-Turbo or VC-Rocket be installed before it can be used. These four versions can be compared as follows:

Version

Features

VC-30

The original site, containing examples of shopper registration, price, cross-sell and up-sell promotions, search, buy-now, navigation buttons, and manager pages.

VC-Turbo

This version implemented performance optimizations in site design, pipeline design, database schema, database queries, object creation, and URL generation.

VC-Rocket

Further enhancements were achieved by caching pre-rendered Listing.asp and Product.asp pages.

VC-Warp

Writing precompiled catalog listing and product information page.

ISAPI Extensions 

An ISAPI extension is a C++ or Visual Basic® DLL file which implements a specific API. This specific API allows the DLL to be plugged into a Web server where it dynamically process requests and produces HTML output, which is returned to the client. The difference between ISAPI and ASP is that ASP is essentially interpreted and dynamically compiled by the server for every request to the page. With ISAPI, the code is pre-compiled and does not require any translation overhead. By translating ASP code into equivalent ISAPI code, the performance differences that can be produced are dramatic. Commonly they are two to ten times greater in terms of page throughput.

VC Warp Overview 

VC-Warp reduces ASP overhead associated with previous versions of Volcano Coffee by doing the following:

  • Replacing Listing.asp with Listing.dll and Product.asp with Product.dll. Both DLL's are implemented in ISAPI. 

  • Replacing ASP pages that are relatively static with static HTML pages (Default.asp and Welcome.asp) 

  • Preserving caching techniques used by VC-Rocket 

ASP execution is CPU-intensive and slower because ASP is an interpreted language. ISAPI execution is fast because it is compiled. On the other hand, the overhead associated with writing ISAPI code in C or C++ is much higher than the overhead of writing ASP pages. Consequently, we recommend that ISAPI be used selectively for high-traffic or performance-critical pages.

For a small site like Volcano Coffee, it is possible to translate each ASP page manually into HTML. For larger sites, an ASP-to-HTML translator like Xbuilder can be used. To translate a page manually into HTML, browse to the page in a Web browser and save the page from the browser giving it a .html extension. Any links that previously pointed to the ASP page must now be modified to point to the new HTML page. If the page was likely to have been bookmarked by users, or if it is not the default document in its virtual directory, then you may want to have an ASP page with the same old name that notifies users of the name change and re-directs them to the HTML page. Be sure to keep the ASP page so you can dynamically rebuild the HTML file in case your data or design changes.

The VC-Warp package contains two Microsoft Visual C++® projects in two directories:

Directory

Contents

Listing

ISAPI version of Volcano Coffee's Listing.asp file caches the product listing after the first access so that no SQL query needs to be performed for subsequent access. There is only one product listing page in Volcano Coffee. A String (BSTR) data type is used to cache the page.

Product

ISAPI version of Volcano Coffee's Product.asp file caches the product pages after the first access for each product so that no SQL query needs to be performed for subsequent access. The cache is reset periodically, and the expiration period can be specified in the source code. Since there are multiple product pages, a BSTR array is used to cache the pages. There is only one timer for the cache. Once the time expires, all product pages are flushed.

See VC-Warp Readme for details on how to install VC-Warp and run the Product.dll and Listing.dll pages.

Performance and Capacity

Throughput and Cost
  • Moving from ASP to ISAPI implementation with catalog caching (Product.dll and Listing.dll), effective page throughput was increased by 14 to 20 times. 

  • Moving from ASP to HTML improves performance by 8 to 10 times. 

The result is shown in Figure 1:

Figure 1 ASP Throughput 

Transaction Costs 

From the maximum throughput data from the previous section, we calculate the transaction cost. For detail information about how transaction cost is calculated, please refer to the "Transaction Cost" section of the "Optimizing ASP Performance in Site Server 3.0 Commerce Edition" white paper in the Volcano Rocket package at located at https://www.microsoft.com/siteserver/commerce .

Figure 2 Transaction Costs 

Shopper Profile

VC Warp uses the same shopper profile as in the pervious versions of the Volcano Coffee performance kit.

Table 2 Shopper Profiles Used in this Report 

VC Shopper ProfileShopper Operations

Low purchase = 1.0%Transactions per 8-minute session

Mid purchase = 2.0%Transactions per 12-minute session

High purchase = 5.0%Transactions per 16-minute session

Additem

0.17

0.24

0.45

Add+Checkout

0.01

0.02

0.05

Add+Clearitems

0.02

0.04

0.10

Basket

0.40

0.75

1.00

Default

1.00

1.00

1.00

Listing

1.20

2.50

3.50

Lookup

0.75

0.75

0.75

New

0.25

0.25

0.25

Product

2.50

4.20

5.50

Search

0.70

1.25

2.40

Welcome

1.00

1.00

1.00

Total operations per session

8.00

12.00

16.00

Shopper Capacity

Figures 3, 4, and 5 show predicted shopper capacity for the Volcano Coffee sample site at different levels of performance enhancements, using the three shopper profiles defined in Table 2. Each figure illustrates 50 to 60% more user capacity for VC-Warp vs. VC-Rocket.

Figure 3 Calculated Shopper Capacity for VC30, VC-Turbo, VC-Rocket and VC-Warp (session = 8 minutes and purchase = 1.0%) 

Figure 4 Calculated Shopper Capacity for VC30, VC-Turbo, VC-Rocket and VC-Warp (session = 12 minutes and purchase = 2.0%) 

Figure 5 Calculated Shopper Capacity for VC30, VC-Turbo, VC-Rocket and VC-Warp (session = 16.0 minutes and purchase = 5.0%) 

Appendix A

VC-Warp Caching Methodology and Design

VC-Warp uses the same caching algorithm as in VC-Rocket. The catalog listing ISAPI extension, Listing.dll, caches the catalog page for a fixed period configurable in the C++ source code. After the caching period expires, or when the catalog is first requested, Listing.dll queries the SQL server for the catalog listing, refreshes the cache with the SQL data, and time-stamps the cacheTime variable with the current time.

The data structure for Listing.dll's cache is a simple _bstr_t type string, which is used to store the catalog page as straight HTML text.

The Product.dll ISAPI DLL has the same cache design, except it uses an array of _bstr_t instead of a single _bstr_t. The product listing ISAPI has a single time stamp for all the products. This means that all the product pages are purged at the same time when the time stamp expires. You can provide separate time stamps for each product if you create an array of time stamps.

The caching algorithm is shown in Figure 6:

Figure 6 The Caching Algorithm 

The following code fragment illustrates a simple cache data structure:

Listing.dll structure 

static long cacheTime=0; // Time when the cache is filled.
static long currentTime=0;
static _bstr_t cache; // The cache itself is a simple bstr.
long expires = 60*5; // the time length, in seconds, for which the cache is valid.
time(¤tTime); // get current time
if(cacheTime && (currentTime < (cacheTime + expires))) //if cache has not expired
{
// code to output cache copy
}
else //if cache has expired
{
cache = ""; // Flush the cache.
time(&cacheTime); // reset the cache timer to now.
// code to query DB and build page
// code to assign the newly built page to the cache
// code to output the page
}

 

Appendix B

Test System Configuration

VC-Warp performance was tested with Microsoft® SQL Server™ 7, SSCE 3.0 SP3, and Windows NT 4.0 SP4 on the following server hardware:

  • Compaq Proliant 4 x 400MHz PII 

  • 2 gigabytes of memory 

  • 9 GB Seagate Barracuda 10,000rpm Ultra Wide SCSI 

Testing VC-Warp

The Web Application Stress Tool (downloadable from https://homer.rte.microsoft.com/ ) is used to stress test VC-Warp.

Figure 7 shows the number of pages Listing.dll generates per second versus CPU utilization.

Figure 7 Test Results for Listing.dll 

Figure 8 shows the number of pages Product.dll generates per second versus CPU utilization

Figure 8 Test Results for Product.dll