34

NET vs J2EE An Architectural and Performance Comparison of.NET and J2EE Applications Greg Leake, Microsoft Corporation Vertigo Software, Inc. James Duff

Embed Size (px)

Citation preview

.NET vs J2EE.NET vs J2EEAn Architectural and Performance Comparison An Architectural and Performance Comparison of .NET and J2EE Applicationsof .NET and J2EE Applications

Greg Leake, Microsoft CorporationGreg Leake, Microsoft Corporation

Vertigo Software, Inc.Vertigo Software, Inc.James DuffJames DuffMike HanleyMike HanleyScott StanfieldScott Stanfield

AgendaAgenda

Architecture discussionArchitecture discussion WinDNA, .NET and J2EEWinDNA, .NET and J2EE

Nile performance comparisonNile performance comparison WinDNA, .NET and J2EEWinDNA, .NET and J2EE

Demo: Performance walkthrough and tuning scenariosDemo: Performance walkthrough and tuning scenarios SQL Server: WinDNA SQL Server: WinDNA .NET .NET Database tuning Database tuning Middle Middle

tier tuning and output cachingtier tuning and output caching Oracle: .NET to Oracle using OleDB vs. new MS .NET Oracle Oracle: .NET to Oracle using OleDB vs. new MS .NET Oracle

providerprovider Pet Store re-visitedPet Store re-visited

.NET Pet Shop vs. latest Oracle Java Pet Store.NET Pet Shop vs. latest Oracle Java Pet Store

Architecture: DNA vs .NETArchitecture: DNA vs .NET.NET.NET

PresentationPresentation

Business Business LogicLogic

DataData

CLR.NET AssemblyADO.NET(Can use COM+Services; e.g. transactions)

Windows DNAWindows DNA

Web FormsServer ControlsCode-Behind

ASP.NETIIS

SQL ServerOracle

DB/2, etc.

COM

ASP and IIS

Inline ASPVBScript/JScript

VB/VCADO(Can use COM+Services; e.g. transactions)

SQL ServerOracle

DB/2, etc.

PresentationPresentation

Business Business LogicLogic

DataData

J2EEJ2EE

CLR.NET AssemblyADO.NET(Can use COM+Services; e.g. transactions)

Web FormsServer ControlsCode-Behind

ASP.NETIIS

JavaBeansEJBs

JSPServlets

Runs on most major application/web servers

Support for most databases via Type 4 drivers

J2SE/EEJDBC

.NET.NET

SQL ServerOracle

DB/2, etc.

SQL ServerOracle

DB/2, etc.

Architecture: J2EE vs .NETArchitecture: J2EE vs .NET

Java Design PatternsJava Design Patterns Model View Controller (MVC) design modelModel View Controller (MVC) design model

Separates the data representation from presentation (separate Separates the data representation from presentation (separate a Model from its View) a Model from its View)

Separates the application behavior from the data Separates the application behavior from the data representation (separate a Controller from the Model)representation (separate a Controller from the Model)

Client View Model

Web Browsersearch.html JavaBeans

J2EE MVC Design

search.jsp

Controller

find.jsp

actions.jsp

ServletsServlets

EntityEJB

SessionEJB

Request

Response

Forward Requests

.NET Design Patterns.NET Design Patterns

.NET Design

Techniques still apply – .NET makes Techniques still apply – .NET makes them easierthem easier

Client Web Forms Code-Behind

Web Browser

Request

Response

search.aspx

Server-Side Events

Server Controls

CustomUser Controls

.NET Assemblies

Enterprise Services

COM+

Nile Application Server Nile Application Server BenchmarkBenchmark

The Nile Application Server The Nile Application Server BenchmarkBenchmark Created by Doculabs and has been used Created by Doculabs and has been used

extensively by Ziff Davisextensively by Ziff Davis End-to-end ecommerce applicationEnd-to-end ecommerce application Application includesApplication includes

90% Data-driven pages90% Data-driven pages Use of scripting and components Use of scripting and components Ad-hoc database searching and browsingAd-hoc database searching and browsing Database transactions Database transactions User authentication/loginUser authentication/login Realistic dataset Realistic dataset Session state (shopping cart)Session state (shopping cart) Optionally can highlight dynamic page output cachingOptionally can highlight dynamic page output caching

The Nile TestsThe Nile Tests

Implementations testedImplementations tested MS .NET implemented with C#/ASP.NETMS .NET implemented with C#/ASP.NET ASP using VB6 COM+ componentsASP using VB6 COM+ components ISAPI/ATL Server using VC++ 7.00ISAPI/ATL Server using VC++ 7.00 Two leading J2EE App Servers using JSPsTwo leading J2EE App Servers using JSPs Two leading J2EE App Servers using EJBsTwo leading J2EE App Servers using EJBs

Tested in large-scale performance labTested in large-scale performance lab All materials and source code published on All materials and source code published on

WebWeb .NET vs. WebSphere benchmark kit.NET vs. WebSphere benchmark kit Customers can replicate/test for themselvesCustomers can replicate/test for themselves

Hardware ConfigurationHardware Configuration

App Server: Compaq 85002, 4 and 8 550 MHz Pentium III

DB Server:Compaq 85008 x 550 MHz Pentium III

Network:Cisco gigabit ethernet

Clients and load test tool:100 clients running Benchmark Factory 2.6

The Nile J2EE Results: Peak ThroughputThe Nile J2EE Results: Peak Throughput

10001000

12501250

750750

500500

8 CPUs8 CPUs

Pages Served Per SecondPages Served Per Second4 CPUs4 CPUs

2 CPUs2 CPUs

15001500

17501750

J2EE App J2EE App Server A Server A

JSP/Linux 7.2JSP/Linux 7.2

537

957

1362

2-tier

668

890930

J2EE App J2EE App Server BServer B

EJB/Linux 7.2 EJB/Linux 7.2

3-tier

VB-COM+ VB-COM+ W2KW2K

478

874

1260

3-tier

J2EE App J2EE App Server B Server B

JSP/Linux 7.2 JSP/Linux 7.2

834

1280

1395

2-tier

489

905

1289

ASP/ ASP/ W2KW2K

2-tier

400

649

886

J2EE App J2EE App Server AServer A

EJB/Linux 7.2 EJB/Linux 7.2

3-tier

400

The Nile J2EE Results: Peak ThroughputThe Nile J2EE Results: Peak Throughput

25002500

30003000

20002000

15001500

8 CPUs8 CPUs

Pages Served Per SecondPages Served Per Second

4 CPUs4 CPUs

2 CPUs2 CPUs

35003500

40004000

J2EE App J2EE App Server A Server A

EJB/Linux 7.2EJB/Linux 7.2

668890 930

J2EE App J2EE App Server BServer B

EJB/Linux 7.2EJB/Linux 7.2

3-tier

VB-COM+ VB-COM+ W2KW2K

478

874

1260

3-tier

649886

3-tier

400

C++ ATL C++ ATL Server Server

W2KW2K

1633

2867

4004

3-tier

ASP.NET C#ASP.NET C#W2KW2K

1399

2713

3999

3-tier

10001000

500500

45004500

Nile .NET vs. Websphere 4.0 Nile .NET vs. Websphere 4.0 Benchmark KitBenchmark KitHttp://www.gotdotnet.com/team/compareHttp://www.gotdotnet.com/team/compareBenchmark kit allows customers to Benchmark kit allows customers to

benchmark .NET and WebSphere 4.0 benchmark .NET and WebSphere 4.0 directlydirectly

Based on Nile applicationBased on Nile application Customers can get full source, tuning Customers can get full source, tuning

guidelinesguidelines Customers can fully compare Customers can fully compare

implementations for .NET, ASP/COM+, ISAPI, implementations for .NET, ASP/COM+, ISAPI, JSP, and EJBJSP, and EJB

Nile BookstoreNile Bookstore

demodemo

Nile Load TestsNile Load Tests

1.1. Nile VB/COM+/ASPNile VB/COM+/ASP

2.2. Nile C# (Managed SQL Server Nile C# (Managed SQL Server Provider)Provider)

3.3. Database tuning for Nile C# (Index)Database tuning for Nile C# (Index)

4.4. Database tuning for Nile Database tuning for Nile VB/COM+/ASPVB/COM+/ASP

5.5. Output CachingOutput Caching

6.6. Nile C# Oracle (OLE DB Provider)Nile C# Oracle (OLE DB Provider)

7.7. Nile C# Oracle (Managed Oracle Nile C# Oracle (Managed Oracle Provider)Provider)

Performance ResultsPerformance Results

TestTest Pages / SecondPages / Second

Nile VB/COM+/ASP (Nile VB/COM+/ASP (Server / Library)Server / Library) 100 / 190100 / 190

Nile C# (Managed SQL Server Nile C# (Managed SQL Server Provider)Provider)

250250

Database tuning for Nile C#Database tuning for Nile C# 414414

Database tuning for Nile Database tuning for Nile VB/COM+/ASPVB/COM+/ASP

200200

Output CachingOutput Caching 500+500+

Nile C# Oracle (OLE DB Provider)Nile C# Oracle (OLE DB Provider) 195195

Nile C# Oracle (Managed Oracle Nile C# Oracle (Managed Oracle Provider Beta)Provider Beta)

280280

Implementing Sun’s J2EE Implementing Sun’s J2EE Pet StorePet Storein Microsoft .NETin Microsoft .NET

What is the Java Pet Store?What is the Java Pet Store?

Java Pet Store is Sun’s primary Blueprint Java Pet Store is Sun’s primary Blueprint application for J2EEapplication for J2EE Source code: Source code: http://java.sun.com/j2ee/blueprintshttp://java.sun.com/j2ee/blueprints

Illustrates J2EE best coding practices for Illustrates J2EE best coding practices for enterprise applicationsenterprise applications

Ships as sample application inShips as sample application in IBM WebSphere 4.0IBM WebSphere 4.0 Oracle Application Server 9iOracle Application Server 9i Sun iPlanetSun iPlanet BEA WebLogicBEA WebLogic

Highlighted extensively at JavaOne 2001 as Highlighted extensively at JavaOne 2001 as the primary J2EE showcase applicationthe primary J2EE showcase application

According to SUNAccording to SUN

Java Pet Store is….Java Pet Store is….

“A full-fledged online store illustrating how to best leverage J2EE technologies.”

“…a sample application which illustrates basic usage of J2EE technology, and demonstrates current best practices in system design.“

What is the .NET Pet Shop?What is the .NET Pet Shop?

An implementation of Java Pet Store using An implementation of Java Pet Store using a .NET best-practice architecturea .NET best-practice architecture Source code: Source code: http://www.gotdotnet.com/team/comparehttp://www.gotdotnet.com/team/compare

Implements the exact same functionality (v 1.1.2)Implements the exact same functionality (v 1.1.2) Fully factored 3-tier logical design using C#Fully factored 3-tier logical design using C# Illustrates best coding practices for .NET Illustrates best coding practices for .NET

FrameworkFramework

Application extension to illustrate targeting of Application extension to illustrate targeting of mobile devices with .NETmobile devices with .NET

Application extension to illustrate creating Application extension to illustrate creating and consuming Web Services with .NETand consuming Web Services with .NET

1500015000

75007500

1000010000

50005000

25002500

1750017500

1250012500

Porting Java Pet Store to .NETPorting Java Pet Store to .NET

Java Pet StoreJava Pet Store

Lines of Code RequiredLines of Code Required

3,484

.NET Pet Shop.NET Pet Shop

14,273

User User Interface Interface

1,881

5,891

Total Lines Total Lines of Codeof Code

Middle TierMiddle Tier

863

5,404

Data TierData Tier

684 412

ConfigConfig

56

2,566

What About Performance and What About Performance and Scalability?Scalability?

Oracle’s 9i Application Server Performance Challenge Oracle’s 9i Application Server Performance Challenge Published using Java Pet StorePublished using Java Pet Store

Oracle-published data and benchmark kit allowed us Oracle-published data and benchmark kit allowed us to replicate their tests with .NET Pet Shopto replicate their tests with .NET Pet Shop

Ran tests on similar hardwareRan tests on similar hardware 100 mbit network100 mbit network 2 CPU Application Server (J2EE vs. MS .NET)2 CPU Application Server (J2EE vs. MS .NET) 4 CPU Database Server (Oracle 9i vs. SQL Server 2000)4 CPU Database Server (Oracle 9i vs. SQL Server 2000)

Tested Oracle-published load levels using same think Tested Oracle-published load levels using same think time and Oracle’s own test scriptstime and Oracle’s own test scripts

Tested .NET version at even higher load levels than Tested .NET version at even higher load levels than Oracle’s J2EE testsOracle’s J2EE tests

Response Time vs. User Load

0

0.2

0.4

0.6

0.8

1

1.2

0 500 1000 1500 2000 2500 3000 3500 4000

User Load

Per

Pag

e A

vg.

Res

po

nse

Tim

e (s

eco

nd

s)

.NET Response Timewith Output Caching

.NET Response Timewith no OutputCaching

J2EE Response Time

.NET vs. J2EE Performance .NET vs. J2EE Performance MetricsMetrics

.NET Pet Shop is 28 times faster than Oracle’s J2EE version

with caching

.NET Pet Shop is 15 times faster than Oracle’s J2EE version

with no caching

.NET Supports 8 times as many concurrentusers as Oracle’s J2EE Version

(at 1-second page response level)

New Oracle DataNew Oracle DataUsersUsers Oracle 9iAS July Oracle 9iAS July

2001 Sun Original 2001 Sun Original Java Pet Store Java Pet Store

1.1.21.1.2

(seconds)(seconds)

Oracle 9iASOracle 9iAS

March 2002March 2002

““New Optimized” Java New Optimized” Java Pet StorePet Store

(seconds)(seconds)

.NET Pet Shop 1.5.NET Pet Shop 1.5

December 2001 December 2001 100% functionally 100% functionally

equivalent to Java Pet equivalent to Java Pet Store 1.1.2Store 1.1.2

(seconds)(seconds)

100100 .231.231 Not testedNot tested .032.032

200200 .308.308 Not testedNot tested .034.034

250250 .348.348 Not testedNot tested .035.035

300300 .361.361 Not testedNot tested .038.038

350350 .451.451 Not testedNot tested .048.048

400400 .538.538 Not testedNot tested .052.052

450450 .952.952 Not testedNot tested .063.063

10001000 Not testedNot tested .037.037 .111.111

15001500 Not testedNot tested .038.038 Not testedNot tested

20002000 Not testedNot tested .042.042 .231.231

25002500 Not testedNot tested .046.046 .479.479

30003000 Not testedNot tested .050.050 .900.900

35003500 Not testedNot tested .057.057 Not testedNot tested

40004000 Not testedNot tested .069.069 Not testedNot tested

45004500 Not testedNot tested .097.097 Not testedNot tested

50005000 Not testedNot tested .302.302 Not testedNot tested

New Oracle DataNew Oracle Data

Oracle new optimized Java Pet Store Oracle new optimized Java Pet Store 2500% faster than original Sun Java Pet 2500% faster than original Sun Java Pet StoreStore

Oracle reports it is now 22 times faster Oracle reports it is now 22 times faster than .NET!than .NET!

Is this possible?Is this possible?

The Answer: NoThe Answer: No New Oracle version is a faster implementation than original Java New Oracle version is a faster implementation than original Java

PetStore…..PetStore…..

BUT IT’S NOT BUT IT’S NOT THATTHAT FAST: FAST:

Fact: Oracle ran test scripts with no error checkingFact: Oracle ran test scripts with no error checking Cannot distinguish between Http error (e.g. Error 404) and valid pageCannot distinguish between Http error (e.g. Error 404) and valid page Issue found by and verified by Mercury InteractiveIssue found by and verified by Mercury Interactive

Suspect: Oracle equated “response time” to Suspect: Oracle equated “response time” to time to first bytetime to first byte delivered to delivered to browser vs. browser vs. time to last bytetime to last byte (completion of page/transaction time) (completion of page/transaction time) Based on extensive internal testing over past 2 weeksBased on extensive internal testing over past 2 weeks First byte delivered to browser before server-side processing complete First byte delivered to browser before server-side processing complete

(top static banner vs. database-driven portions of pages)(top static banner vs. database-driven portions of pages) Time to first byte is not true transaction time, although it is sometimes Time to first byte is not true transaction time, although it is sometimes

called “response time” depending on load test toolcalled “response time” depending on load test tool .NET results based on “time to last byte” and completion of entire page.NET results based on “time to last byte” and completion of entire page

Full error checking on all .NET tests runsFull error checking on all .NET tests runs

But How to Prove?But How to Prove?

1.1. We will show you here in a live load test bakeoffWe will show you here in a live load test bakeoff

2.2. We are calling for an independent audit of the We are calling for an independent audit of the

results, with both solutions tested by a third party in results, with both solutions tested by a third party in

neutral lab with same load test softwareneutral lab with same load test software

We will fully participate in this auditWe will fully participate in this audit

Hopefully Oracle will participateHopefully Oracle will participate

3.3. Best of all, you can easily test both apps for Best of all, you can easily test both apps for

yourself, all source code available as well as test yourself, all source code available as well as test

scripts. We absolutely encourage you to do your scripts. We absolutely encourage you to do your

own testing and decide for yourself!own testing and decide for yourself!

.NET PetShop.NET PetShop

demodemo

.NET PetShop Load Tests.NET PetShop Load Tests

1.1. Oracle Java Pet StoreOracle Java Pet Store

2.2. .NET PetShop.NET PetShop

Performance Results: Performance Results: ThroughputThroughput

User LoadUser Load

(no think time)(no think time)

.NET Pet Shop .NET Pet Shop 1.5 Pages/sec1.5 Pages/sec

Oracle New Oracle New Java Pet Store Java Pet Store Pages/secPages/sec

2525 7878 52525050 113113 5151100100 129129 5151200200 143143 4444500500 149149 errorserrors

User LoadUser Load

(no think time)(no think time)

.NET Pet Shop .NET Pet Shop 1.5 Response 1.5 Response TimeTime(seconds)(seconds)

Oracle New Oracle New Java Pet Store Java Pet Store Response Response Time (seconds)Time (seconds)

2525 .14.14 .48.485050 .39.39 1.61.6100100 .90.90 2.712.71200200 1.841.84 6.726.72500500 4.884.88 errorserrors

Performance Results: Performance Results: Transaction timesTransaction times

(time to (time to lastlast byte) byte)

SummarySummary

.NET Web applications significantly outperform WinDNA apps.NET Web applications significantly outperform WinDNA apps

.NET outperforms IBM WebSphere 4.0 and WebLogic 6.1 on .NET outperforms IBM WebSphere 4.0 and WebLogic 6.1 on

Nile benchmark by factor of 4Nile benchmark by factor of 4

Testing and tuning under load is criticalTesting and tuning under load is critical

PetShop: Test it for yourself:PetShop: Test it for yourself:

http://www.gotdotnet.com/team/compare/petshop.aspxhttp://www.gotdotnet.com/team/compare/petshop.aspx

http://otn.oracle.comhttp://otn.oracle.com

All materials on Web, customers can run their own testsAll materials on Web, customers can run their own tests

http://www.gotdotnet.com/team/comparehttp://www.gotdotnet.com/team/compare

© 2002 Microsoft Corporation. All rights reserved.© 2002 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.