Results 1 to 3 of 3

Thread: .NET performance

  1. #1

    Thread Starter
    Lively Member Nator's Avatar
    Join Date
    Nov 1999
    Location
    East Larryville, GA
    Posts
    80

    .NET performance

    Can someone here share their experiences dealing with ASP.NET's performance compared to ASP 3.0? I've just recently started learning .NET and have found a lot of concepts that go against what I have been told to do as a programmer. .NET seems to be heavily reliant on server side controls and variable storage. What kind of load could I expect if many users wer hitting my web app? In old ASP, I was told from day one to avoid using a lot of Session variables if possible because of the load they put on the server. How are .NET server-side controls different? Beyond the improved developement environment, what other benefits have you seen with .NET over ASP 3.0? Thanks.

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Location
    Connecticut
    Posts
    98
    I have found the performance of ASP.NET apps to be faster than Classic ASP apps. This is mostly due to the code being pre-compiled into a .dll.
    The server side controls are great, storing their state in the page's Viewstate as opposed to in a Session variable. Sessions can still be used in ASP.NET and carry the same performance hit as before. The availability of the server controls does away with quite a few circumstances where you would have needed to store info in a Session variable in Classic ASP.
    As far as the amount of server resources being used under a high load, it depends. The code is in a pre-compliled dll which makes the app function much faster than waiting for the ASP parser to render your page in Classic ASP. And caching in .NET is super easy and can speed your app even more.
    There are tons of improvements over Classic ASP. Authentication, built in Validation, Code separation, and not to mention VB.NET is now a full OO language. If VB isn't your thing, choose your weapon, the framework supports many languages, even some obscure ones like OZ and Haskell.

    I have been a lurker here for quite a while and have seen some pissing and moaning about .NET. It was hard to make the transition in the beginning, but if you know how to use the framework properly it is 10x better than ASP 3.0. I would never go back. Get a good book or two, I highly recommend ASP.NET by Wrox. And check out the mailing lists at ASPng.com where me and quite a few others collaborate. Some of .NET's actual development team from MS can be found there as well. A great resource!

    HTH,
    ~ Piz

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Just to make an addition to Piz's comments

    ASP .NET manages session and server resource usage alot better than ASP so this pretty much balances out increased server side usage. But as far as I have seen ASP .NET still out performs ASP.

    It is worth the learning curve which really isnt that bad..you just need to learn the new stuff and realize that you program ASP .NET in FULL VB now and not VBScript. The main change is in ASP .NET, it is event based. You use the ASP server controls and use the events(onclick, onfocus, etc) by specifying a function/sub to run. It then posts back to the ASP .NET page and runs that procedure.

    See this code for example;

    Code:
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OleDb"%> 
    
    <html>
    	<script language="VB" runat="server">
    		' ---------------------------------
    		' Code by Chris Andersen
    		' This example shows how to show data from an access database in the DataGrid control
    		' and how to write a new record to the database.
    		' ---------------------------------
    		
    		' Recordset no longer exists for ADO .NET. Create DataSets and populate it from the data you get from
    		' a DataAdapter or other source. In this case we are getting ADO DataSet using the System.Data.OleDb.OleDbDataAdapter Class
    		Dim myDS As New DataSet
    		Dim myConn As OleDbConnection
    		Dim myCommand As OleDbDataAdapter
    		Dim strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.Mappath("/candersen/db/test.mdb")
    		Dim strSQL As String
    		
    		Sub Page_Load(Sender As Object, E As EventArgs)
    			' This sub is called everytime the Page Loads
    		End Sub
    		
    		Sub Go_Click(Sender As Object, E As EventArgs)
    			Dim strName As String = Name.Text
    			Dim strAge As String = Age.Text
    			
    			' Write posted data to the lables
    			lblName.Text = strName
    			lblAge.Text = strAge
    
    			' Insert Posted Data to database
    			strSQL = "Insert Into Test(Name,Age) VALUES('" & strName & "','" & strAge & "')" 
    			
    			' Populate DataSet
    			FillDataSet()
    			
    			' Update DataGrid
    			UpdateGrid()
    		End Sub
    		
    		Sub UpdateGrid()
    			' Updates the DataGrid
    			strSQL = "Select * FROM Test"
    			
    			'Populate DataSet
    			FillDataSet()
    			
    			' Now set the DataGrid's source to the Dataset and bind it
    			MyDataGrid.DataSource = myDS.Tables("Test").DefaultView
    			MyDataGrid.DataBind()
    			
    		End Sub
    		
    		Sub FillDataSet()
    			' Reusable code to populate the Dataset from the SQL statement
    			'Start Connection to ADO source
    			myConn = New OleDbConnection (strConnString)
    		
    			' Run the Sql statement and get the Data into the DataAdapter
    			myCommand = New OleDbDataAdapter(strSQL, myConn)
    
    			' Fill the DataSet and name the table
    			myCommand.Fill(myDS, "Test")
    			         
    			myConn.Close()
    		End Sub
    		
    	</script>
    	<body>
    		<form action="aspnet1.aspx" method="post" runat="server">
    			<!-- ASP .NET server control textbox  -->
    			<table>
    				<tr>
    					<td>Name</td>
    					<td><asp:textbox BackColor="#ccccff" id="Name" 
    						BorderColor="black"
    						runat="server"/></td>
    				</tr>
    				<tr>
    					<td>Age</td>
    					<td><asp:textbox BackColor="#ccccff" id="Age"
    						BorderColor="black"
    						runat="server"/></td>
    				</tr>
    			</table>
    					
    			<!-- ASP .NET sever control button -->
    			<asp:button id="btnGo" text="Go" OnClick="Go_Click" runat="server"/><br/>
    			
    			<!-- ASP .NET server control Label-->
    			Your name is <asp:label id="lblName" runat="server"/><br/>
    			Your age is <asp:label id="lblAge" runat="server"/><br/>
    			
    			<!-- ASP .NET server control DataGrid -->
    			<asp:DataGrid id="MyDataGrid" runat="server"
    			    Width="700"
    			    BackColor="#ccccff" 
    			    BorderColor="black"
    			    ShowFooter="false" 
    			    CellPadding=3 
    			    CellSpacing="0"
    			    Font-Name="Verdana"
    			    Font-Size="8pt"
    			    HeaderStyle-BackColor="#aaaadd"
    			    EnableViewState="false">
    			  
    			  	<Columns>
    				<asp:HyperLinkColumn
    				            DataNavigateUrlField="Name"
    				            DataNavigateUrlFormatString="test_details.aspx?id={0}"
    				            Text="View"
    				          />
    				</Columns>
    			  </asp:DataGrid>
    		</form>
    	</body>
    </html>
    To get some ideas on new stuff in VB .NET/ASP .NET read and keep an eye on the .Net Tip Thread as I and other people add tips on many .NET topics
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width