CS491A Project Final Report

Web Galaxy

Abstract Web Technology has been popular since 1992. Numerous systems have been developed to meet the increasing demands of websites. The CGI technology originally used is still being used today and new ones keep emerging. It is still not easy for developers and private companies to know which technology is the best fit. There is no definite answer. In this project, three different web setups are built and a simple test of web request response time will be recorded. The test results will provide some useful information for developers and companies to choose the right configuration.

1. Introduction

With so many different setups to choose from, when a developer or a company wants to build an e-commerce site, choosing a good configuration is not always an easy task. In this class, I will build three web application systems with different combinations of operating systems, web servers, server side languages and databases. The web site content is a generic e-commerce site which includes product display, product search and a shopping cart. The reason building an e- commerce site is that an e-commerce site includes most of the common functionalities a web site would have, such as dynamic pages, search function and database interaction. After all, web sites are mainly used for searching for information and selling products. The programming involves displaying data statically or on demand, getting data from the user, retrieving data from the database and managing data in the database. My project includes all of these tasks.

There are several reasons I chose this project. I have done web programming for more than five years, including two years for eBay and one and half years for IdeaLab. The class requires us to build a project using a language we are most familiar with. After experiencing so many real life web site projects, building another one for this class is not a challenge. For class 437 software engineering, I have already done a similar project. On the other hand, there are other web programming technologies I have heard of or picked up pieces from time to time but I have not had any chance to work on it seriously. I’d like to take this chance to explore them.

The application will be run on a laptop with a Pentium III 700MHz and 128MB RAM. The first application will run on a Linux operating system and the other two will be developed under a Windows system. After the first one is completed, it will be erased to make room for application two and application three. So at the end I will have two applications in one computer. After the above development, I will do some comparison among them and do a simple performance test. A rough idea of what technologies to use for building an e- commerce site will be generated.

2. Technological Background

This project involves quite a lot of technologies, including operating systems, web servers, databases and server-side languages. Each application has its unique combinations. Some components have platform dependency. Some components have less dependency and can be developed under different platforms. I have chosen three popular configurations for this project. There is no doubt that there are many other ways to combine it. It is beyond the scope of this project.

2.1 Operating System

Windows 2000: Microsoft Windows 2000 Professional is the most reliable desktop operating system for business. Building on the power of Windows NT and the ease of using Windows 98, Windows 2000 is the best choice for work environments--big and small. Windows 2000 Professional offers the launching pad businesses need to benefit from the productivity and Internet applications that they use most. It's more reliable, secure, and manageable than Windows NT Workstation because of its new file encryption system and application management tools.

Red Hat: Red Hat Linux is a platform for open source computing. It is certified by top enterprise hardware and software vendors. From the desktop to the data center, Red Hat couples the innovation of open source technology and the stability of a true enterprise-class platform.

2.2 Web Server

IIS 5.0: IIS is an enterprise-level Web server that is included with several versions of Windows. According to Netcraft Web Server Survey, as of April 2005, around 21% of the web sites on the Internet are using IIS. It can only be run under a windows-based operating system.

Apache 1.3: Apache Web server has been the most popular Web server since April 1996 because of its stability, efficiency, portability, security and small size. It can run on Unix, Linux, Mac OS, Windows and numerous other platforms. According to Netcraft Web Server Survey, as of April 20005, more than 68% of web sites on the Internet are using Apache, thus making it more widely used than all other web servers. Apache is commonly run under an UNIX like system but it also supports windows-based systems.

2.3 Server Side Language

PERL/MOD_PERL: Perl is a stable, cross platform programming language and it takes the best features of other languages. PERL supports both procedural and object-oriented programming. Mod_perl is the marriage of Apache and PERL. It is said that mod_perl brings together two of the most powerful and mature technologies available to the web professionals today. It supports many operating systems. It’s more common to be used under an UNIX operating system. C# ASP.NET: ASP.NET was introduced in 2002. It takes advantage of Microsoft’s .NET Framework, which provides thousands of classes that deal with XML, text input, validation of user input, image processing and more. It can be only used under a Windows system.

JSP/SERVLETS: Since the late 1990s Java servlets and JavaServer Pages (JSP) have come into widespread use. It is said that web site developers have been switching from CGI scripting languages to servlets and JSPs. It supports many platforms. It’s common to be used under both Windows and Linux.

2.4 Database

MySQL: The most popular open source SQL database, is developed and provided by MySQL AB. The MySQL software delivers a very fast, multi-threaded, multi-user, and robust SQL database server. It is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. It supports numerous platforms and it’s very easy to install and upgrade.

SQL 2000: SQL Server 2000 offers a complete database and analysis solution for rapidly delivering the next generation of scalable Web applications. As a core component of Microsoft Windows Server System, it dramatically reduces the time required to bring e-commerce and data warehousing applications to market. SQL Server 2000 includes support for XML and HTTP and also takes full advantage of Microsoft Windows 2000, including support for Microsoft Active Directory.

3. System Architecture

Application 1:

Red Hat Linux Apache 1.3 PERL/MOD_PERL MySQL 4.1 Mason

Application 1 has been demonstrated as a powerful system to develop e- commerce web sites. It’s one of the most mature web technologies. Amazon, one of the largest e-commerce sites in the world, is using PERL. The PERL interpreter can be embedded in Apache server and it can run 2000% times faster than CGI. Mason was chosen as a template. Mason “Autohandler” technology make page inheritance easy and component calls re-use codes. Those evolved and new features have beat the claims that this older technology is out of date. MySQL is easy to use and its simplicity makes it very suitable for web transactions. The production version still does not have a lot of features that other commercial databases do, such as views, triggers and procedures etc… This application has excellent performance using less powerful hardware. The difficulty is to configure the whole system with all compatible versions of components due to its open source characteristic. It takes experience and practice to install them correctly.

Application 2:

Window 2000 Professional /IIS 5.0 C# ASP.NET/Visual Studio .NET 2003 SQL 2000

All packages from this application are made by one vendor, Microsoft. The functionalities are streamlined, especially between Visual Studio .NET 2003 and SQL 2000. From .NET, database connection can be created and database information is available by clicking the Tool menu. The installations are not difficult and most of the time the default settings are enough. The instructions for using them are clear. This application also supports page inheritance and code reuse. It has its unique tag and it can reduce the amount of code to achieve field validation. Visual Studio .NET has a very nice project editor as long as the computer is fast. The database procedure can be called by C# providing parameters and reduce the amount of code in C# programming.

Application 2 runs slower than application 1 with the same hardware. It is slow to open the project from Visual Studio .NET 2003 and it is slow when I try to see the result from the browser. It would be much better used on a faster computer. From VB script ASP to ASP.NET, Microsoft has dramatically changed its way to create web pages. Web sites that used VB script ASP have to be totally rewritten to upgrade to ASP.NET. Programmers who are good at VB script ASP have to learn one of the new languages, such as VB.NET, C#.NET or J#.NET etc. The odd thing I found is that each page can only have one web form. To perform a different function is through writing “ImageClicked” event function in the same script. Traditionally, the web developers use more than one form in one page to perform different actions. Also the user control label can not be registered by the web project if it’s created dynamically, so all user control labels have to be created in advance.

Since .NET was introduced in 2002, it has not been widely used but it is getting more popular. C# has very similar syntax as JAVA. Microsoft promoted that it does not hurt performance which language to use as long as it runs under .NET framework. Apparently, C# was created to attract JAVA programmer to switch to C# programming. PERL can be run under the .NET framework also.

Application 3

Window 2000 Professional Apache Tomcat MySQL JSP/SERVLETS

This application has a similar installation and configuration as application 1 and programming language’s syntax is like application 2. The reason the installation and configuration is like application 1 because each component needs to be installed individually and configured to work together, such as changing configuration file setup, set class path and install DB driver to the correct directory etc. It is easier than configuring application 1.

Application 2’s programming syntax is very similar to JSP/servlet. I would have never known how similar they are until I tried them both. The functionality is very similar also. The big difference is that C#.NET has a powerful editor and saves a lot of typing work. Besides overall performance in a defined web system, it really depends on preference when choosing between the two.

4. Design and Implementation Details

4.1 GUI Design

GUI design is not a concern for this project. The three applications will use the same design. No image will be used for the web site. Most of the pages are database driven. Each page maintains a similar look. It has a top menu, left menu and bottom menu. The left menu has search function, product display page and the link to advanced search. The top menu has a link to the shopping car and the bottom menu provides the links to static information pages which won’t be created for this project. The snapshots of the pages for application one are in appendix D and application two and three are part of my demo.

4.2 Project Work Steps

The first step of building the web application is to install all necessary software and tools including operating system, web sever, database and language, compatible editors and third party modules.

The second step is to do configuration and set up and get ready for development. The third step is to design the web pages.

The fourth step is to design databases and implement them.

The fifth step is to implement database drive web pages with server side languages.

The sixth step is do the testing and refinement.

The final step is to do a simple performance chart and analysis.

4.3 Database Schema

Two databases will be used. They are MySQL and SQL 2000.

5. Performance Evaluation

5.1 Experimental Setup

The performance evaluation is to test how fast the server responds to the web request. Several same functionality pages have been selected from application 2 and application 3. The tool “HTTP Analyzer” is used to record response time.

5.2 Experimental Results

The detailed results are shown in the charts in the appendix. Ten attempts were run for each language for each situation. The average results from the charts are shown in the chart below. Averages of All Charts

2.500

2.000 )

c 1.500 e

s C# ( e JSP/Servlet m i 1.000 T

0.500

0.000 Empty Cart Add to Cart Profile Search Category Page

5.3 Analysis

As can be seen from the averages, C# and JSP/Servlet have similar performance for empty cart page, add to cart and profile. There is a large performance gap for search and category. These two tests use the SQL database which might be affecting the results. As can be seen in the chart below, SQL2000 is faster than MySQL 3.23.46.

SQL2000: 0.006 sec Average SQL Database MySQL: 0.024 sec Average 0.035

0.030

0.025 )

c 0.020 e SQL2000 s (

e 0.015 MySQL 3.23.46 m i T 0.010

0.005

0.000 1 2 3 4 5 Attempt

The limitation of this performance is that we have to make sure both setup should have optimized coding. The performances of different versions of operating system, web server and database may vary. It is not clear whether more powerful hardware would make a big difference in performance. A typical E-commerce site has concurrent multi-users. How many users the site can support at the same time is very important also. It requires complex testing environment and it’s beyond a 20-week project.

6. Conclusion

Choosing a good configuration for an e-commerce site is never easy. This project tries to address this issue by building three different applications that use different common combinations of operating systems, web servers, server side languages and databases. The applications are all used to create a generic e- commerce site which has product display, product search and a shopping cart. These functions are common to most e-commerce web sites. These functions also include the most common functionalities a web site uses such as dynamic web pages, search function and database interaction.

The first application was built with a Linux operating system written in PERL and served by Apache server. The other two were developed under a Windows system. Application 2 is written in C# and runs under Window IIS and Application 3 is written in JSP/servlets and served by Tomcat.

Three server-side web-programming languages were created and improved to compete with each other. They are also influenced by each other. As of April 2005, 69% of web sites on the Internet use Apache which is written in PERL, JAVA and a small percentage in other languages. 21% of web sites are windows based and they are most likely written in VBscript and ASP.NET languages. It will be interesting to see how it goes in the future. Personally I have no strong preference to choose among the three languages because they all have similar features, such as object-oriented programming style, code reuse and inherence etc.

Two databases have been used for this application. I would definitely choose SQL 2000 over MySQL. SQL 2000 has better performance than MySQL and it has more features. The features comparison has been presented at my presentation slides.

Unfortunately, the performance test setup is very simple due to insufficient time. The performance result is disputable due to limitations analyzed in this report. It’s a large amount of work to setup three web applications and write in three different languages for three working e-commerce shopping carts. To get better performance results, I recommend production environment hardware, such as 3.4GHZ CPU, 1-2Gbytes RAM. A large amount of data, such as more than one hundred Mega bytes, would give more accurate performance results for database transactions. Instead of writing a shopping cart, limit the coding to product display, product search and user registration. This will give more time to optimize the coding and conduct performance testing. I believe this project could be a good starting point to further look into web applications in different setups.

7. References

Whitehead, Paul. Active Server Pages 3.0. IDG Books Worldwide, 2000. Rolsky, Dave and Williams, Ken. Embedding Perl in HTML with Mason. O’Reilly, 2003. Deitel, H.M., Deitel, P.J., and Goldberg, A.B. Internet & World Wide Web: How to Program. Pearson Education, 2004. Steelman, Andrea and Murach, Joel. Murach’s Java Servlets and JSP. Murach, 2003. Hunter, Jason and Crawford, William. Java Servlet Programming. O’Reilly, 1998. Nielsen, Paul. Microsoft SQL Server 2000 Bible. Wiley, 2003. Wainwright, Peter. Professional Apache. Wrox, 1999. Goodwill, James. Developing Java Servlets. Sams, 1999. Dubois, Paul. MySQL. Sams, 2003. Bekman, Stas; Cholet, Eric. Practical mod_perl. O’Reilly 2003 Meyne, Hank and Davis, Scott. Developing Web Applications with ASP.NET and C#. Wiley, 2002. Ruvalcaba, Zak. ASP.NET Website Using C# & VB.NET. Sitepoint, 2004. www.perl.org www.apache.org www.oracle.com www.microsoft.com www.mysql.com Language Comparison: http://www.epinions.com/inet-review-540-141E6FD0-3A0CAA3F-prod2 Java vs. PERL http://kreiger.linuxgods.com/kiki/?java+vs+perl+examples http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=25866 Java, c++, PERL http://www.flat222.org/mac/bench/ .NET vs. J2EE http://java.oreilly.com/news/farley_0800.html http://www.theserverside.net/news/thread.tss?thread_id=29747 http://www.theserverside.com/articles/article.tss?l=J2EE-vs-DOTNET Apache vs. IIS http://searchwin2000.techtarget.com/originalContent/0,289142,sid1_gci833798,00.html http://www.serverwatch.com/tutorials/article.php/3074841 Database Comparison http://dev.mysql.com/tech-resources/crash-me.php http://www.tpc.org/tpcc/results/tpcc_perf_results.asp http://www.tpc.org/tpcc/results/tpcc_price_perf_results.asp http://www.mssqlcity.com/Articles/Compare/sql_server_vs_mysql.htm http://www.mssqlcity.com/Articles/Compare/sql_server_vs_oracle.htm Window vs. Linux http://www.michaelhorowitz.com/Linux.vs.Windows.html http://www.devx.com/opensource/Article/16969

Appendix A. Functions Each application has its own codes for each functionality.

1. product display 2. product quick search 3. product advanced search 4. shopping cart

Appendix B. Database Schema Definitions

Application 2: CREATE TABLE [dbo].[Order_Items] ( [Order_Item_ID] [int] IDENTITY (1, 1) NOT NULL , [Order_ID] [int] NOT NULL , [Item_ID] [int] NOT NULL , [Category_ID] [int] NOT NULL , [Description] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [PricePerUnit] [money] NOT NULL , [Quantity] [int] NOT NULL ) ON [PRIMARY] GO

CREATE TABLE [dbo].[Orders] ( [Order_ID] [int] IDENTITY (1, 1) NOT NULL , [Shopper_ID] [int] NOT NULL , [Total_Cost] [money] NOT NULL , [Shipping_Cost] [money] NOT NULL , [Sales_Tax] [money] NOT NULL , [CC_Number] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [CC_Expiration_Date] [varchar] (7) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [CC_Type] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [CC_Holder_Name] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO

CREATE TABLE [dbo].[Shopper] ( [Shopper_ID] [int] IDENTITY (1, 1) NOT NULL , [First_Name] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Last_Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Address] [varchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [City] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [State_Code] [varchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Postal_Code] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Phone] [varchar] (24) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Email] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO

CREATE TABLE [dbo].[Shopping_Cart] ( [Shopping_Cart_Item_ID] [int] IDENTITY (1, 1) NOT NULL , [Shopper_ID] [int] NOT NULL , [Item_ID] [int] NOT NULL , [Category_ID] [int] NOT NULL , [Description] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [PricePerUnit] [money] NOT NULL , [Quantity] [int] NOT NULL ) ON [PRIMARY] GO

CREATE TABLE [dbo].[cs_User_Auth] ( [uid] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [pwd] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO

CREATE TABLE [dbo].[cs_category] ( [cate_num] [int] IDENTITY (1, 1) NOT NULL , [cate_name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO

CREATE TABLE [dbo].[cs_products] ( [p_name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [price] [money] NULL , [p_description] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [item_num] [int] IDENTITY (1, 1) NOT NULL , [cate_num] [int] NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[cs_products1] ( [p_name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [price] [decimal](18, 2) NULL , [p_description] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [item_num] [int] IDENTITY (1, 1) NOT NULL , [cate_num] [int] NULL ) ON [PRIMARY] GO

Application 3:

CREATE TABLE cs_category ( cate_num int(11) NOT NULL auto_increment, cate_name varchar(50) default NULL, PRIMARY KEY (cate_num) ) TYPE=MyISAM;

CREATE TABLE cs_products ( p_name varchar(50) default NULL, price decimal(18,2) default NULL, p_description text, item_num int(11) NOT NULL auto_increment, cate_num int(11) default NULL, PRIMARY KEY (item_num) ) TYPE=MyISAM;

CREATE TABLE cs_products1 ( p_name varchar(50) default NULL, price decimal(18,2) default NULL, p_description text, item_num int(11) NOT NULL auto_increment, cate_num int(11) default NULL, PRIMARY KEY (item_num) ) TYPE=MyISAM; CREATE TABLE order_items ( Order_Item_ID int(11) NOT NULL auto_increment, Order_ID int(11) NOT NULL default '0', Item_ID int(11) NOT NULL default '0', Category_ID int(11) NOT NULL default '0', Description varchar(100) default NULL, PricePerUnit decimal(8,2) NOT NULL default '0.00', Quantity int(11) NOT NULL default '0', PRIMARY KEY (Order_Item_ID) ) TYPE=MyISAM;

CREATE TABLE orders ( Order_ID int(11) NOT NULL auto_increment, Shopper_ID int(11) NOT NULL default '0', Total_Cost decimal(8,2) NOT NULL default '0.00', Shipping_Cost decimal(8,2) NOT NULL default '0.00', Sales_Tax decimal(8,2) NOT NULL default '0.00', CC_Number varchar(20) default NULL, CC_Expiration_Date varchar(7) default NULL, CC_Type varchar(30) default NULL, CC_Holder_Name varchar(100) default NULL, isProcessed enum('''N''','''Y''') default '''N''', when_placed datetime default NULL, PRIMARY KEY (Order_ID) ) TYPE=MyISAM; CREATE TABLE shopper ( Shopper_ID int(11) NOT NULL auto_increment, First_Name varchar(20) default NULL, Last_Name varchar(50) default NULL, Address varchar(60) default NULL, City varchar(15) default NULL, State_Code char(2) default NULL, Postal_Code varchar(10) default NULL, Phone varchar(24) default NULL, Email varchar(40) default NULL, PRIMARY KEY (Shopper_ID) ) TYPE=MyISAM;

CREATE TABLE shopping_cart ( Shopping_Cart_Item_ID int(11) NOT NULL default '0', Shopper_ID int(11) NOT NULL default '0', Item_ID int(11) NOT NULL default '0', Category_ID int(11) NOT NULL default '0', Description varchar(100) default NULL, PricePerUnit decimal(8,2) NOT NULL default '0.00', Quantity int(11) NOT NULL default '0', PRIMARY KEY (Shopping_Cart_Item_ID) ) TYPE=MyISAM; Appendix C. User Manual

No user manual needed for web site. The web site is designed for easy use by clicking through the links on the page, top, left and bottom menus.

Appendix D GUI

Appendix E Test Results

C#: 0.081 sec Average Empty Cart Page Java: 0.122 sec Average 0.160 C# 0.140 Java

0.120

) 0.100 c e s (

0.080 e m i

T 0.060

0.040

0.020

0.000 1 & 2 3 & 4 5 & 6 7 & 8 9 & 10 Attem pt C#: 0.177 sec Average Add to Cart Page JAVA: 0.151 sec Average 0.200 0.180 0.160 0.140

) 0.120 c

e C# s (

0.100 e JAVA m i 0.080 T 0.060 0.040 0.020 0.000 1 & 2 3 & 4 5 & 6 7 & 8 9 & 10 Attem pt

C#: 0.102 sec Average Profile Page JAVA: 0.094 sec Average 0.140

0.120

0.100 ) c

e 0.080

s C# (

e 0.060 JAVA m i T 0.040

0.020 C#: 0.163 sec Average 0.000 Search Page JAVA: 2.1891 & sec 2 Average3 & 4 5 & 6 7 & 8 9 & 10 2.500 Attempt

2.000

C# )

c 1.500

e JAVA s (

e m i 1.000 T

0.500

0.000 1 & 2 3 & 4 5 & 6 7 & 8 9 & 10 Attempt C#: 0.154 sec Average Category Page JAVA: 2.179 sec Average 2.500

2.000 )

c 1.500 e

s C# (

e JAVA m

i 1.000 T

0.500

0.000 1 & 2 3 & 4 5 & 6 7 & 8 9 & 10 Attempt

Averages of All Charts

2.500

2.000 )

c 1.500 e

s C# (

e JSP/Servlet m i 1.000 T

0.500

0.000 Em pty Cart Add to Cart Profile Search Category Page SQL2000: 0.006 sec Average SQL Database MySQL: 0.024 sec Average 0.035

0.030

0.025 )

c 0.020 e SQL2000 s (

e 0.015 MySQL 3.23.46 m i T 0.010

0.005

0.000 1 2 3 4 5 Attempt

Appendix F Presentation Slides