473,378 Members | 1,138 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Performance of ASPX Page when using Asynchronous Handlers

I am using Fritz Onion's "Asynchronous Pages" approach as mentioned in
the article http://msdn.microsoft.com/msdnmag/is...g/default.aspx
to increase the performance of my ASPX page.I am using the Custom
thread pool as given in the article's sample.

Implementation:
===============
In AsyncPage.aspx I inhereted AsyncPage class instead of
System.Web.UI.Page.
SyncPage.aspx is like any other Web page which inherits
System.Web.UI.Page.

Problem/Issue:
===============
When I run Application Center test (ACT) on two different environments
I am getting following test results.
Environment 1:
---------------
ACT client is running on Windows XP and Web server(where ASPX pages
are hosted) is running on Windows 2003 advanced server.
ACT is running for 5 minutes with 100 simultanious browser
connections.
Results on Environment 1:
--------------------------
AsyncPage.aspx page is processing a total of 7500 (approx.)requests.
SyncPage.aspx page is processing a total of 2500 (approx.)requests.
THESE ARE THE EXPECTED RESULTS.EVERYTHING IS WORKING AS EXPECTED.

Environment 2:
---------------
ACT client is running on Windows XP and Web server(where ASPX pages
are hosted) is running on Windows 2003 server/Windows 2000 Server.
ACT is running for 5 minutes with 100 simultanious browser
connections.
Results on Environment 2:
--------------------------
AsyncPage.aspx page is processing a total of 7500 (approx.)requests.
SyncPage.aspx page is processing a total of 7500 (approx.)requests.

IAM NOT ABLE TO RESOLVE THE ISSUE IN ENVIRONMENT 2.WHY BOTH THE PAGES
ARE ABLE TO PROCESS APPROXIMATELY SAME NUMBER OF REQUESTS?IS THERE ANY
TYPE OF CACHING ON CLIENT SIDE OR SERVER SIDE? PLEASE
SUGGEST..............

AsyncPage.aspx Code:
=======================
public Class AsyncPage : AsyncPage
{
private void Page_Load(object sender, System.EventArgs e)
{
System.Threading.Thread.Sleep(3000);
Response.Write("This is Async Page after 3 seconds sleep");
}
}
SyncPage.aspx Code:
=====================
public Class SyncPage : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
System.Threading.Thread.Sleep(3000);
Response.Write("This is Sync Page after 3 seconds sleep");
}
}
ASyncPage class Code:
=====================
public class AsyncPage : Page, IHttpAsyncHandler
{
static protected DevelopMentor.ThreadPool _threadPool;

static AsyncPage()
{
_threadPool = new DevelopMentor.ThreadPool(2, 25, "AsyncPool");
_threadPool.PropogateCallContext = true;
_threadPool.PropogateThreadPrincipal = true;
_threadPool.PropogateHttpContext = true;
_threadPool.Start();
}

public new void ProcessRequest(HttpContext ctx)
{
// not used
}

public new bool IsReusable
{
get { return false;}
}

public IAsyncResult BeginProcessRequest(HttpContext ctx,
AsyncCallback cb, object obj)
{
AsyncRequestState reqState = new AsyncRequestState(ctx, cb, obj);
_threadPool.PostRequest(new
DevelopMentor.WorkRequestDelegate(ProcessRequest), reqState);

return reqState;
}

public void EndProcessRequest(IAsyncResult ar)
{
}

void ProcessRequest(object state, DateTime requestTime)
{
AsyncRequestState reqState = state as AsyncRequestState;

// Synchronously call base class Page.ProcessRequest
// as we are now on a thread pool thread. Once complete,
// call CompleteRequest to finish
base.ProcessRequest(reqState._ctx);

// tell asp.net we are finished processing this request
reqState.CompleteRequest();
}

}

class AsyncRequestState : IAsyncResult
{
public AsyncRequestState(HttpContext ctx, AsyncCallback cb,
object extraData )
{
_ctx = ctx;
_cb = cb;
_extraData = extraData;
}

internal HttpContext _ctx;
internal AsyncCallback _cb;
internal object _extraData;
private bool _isCompleted = false;
private ManualResetEvent _callCompleteEvent = null;

internal void CompleteRequest()
{
_isCompleted = true;
lock (this)
{
if (_callCompleteEvent != null)
_callCompleteEvent.Set();
}
// if a callback was registered, invoke it now
if (_cb != null)
_cb(this);
}

// IAsyncResult
//
public object AsyncState { get { return(_extraData); } }
public bool CompletedSynchronously { get { return(false); } }
public bool IsCompleted { get { return(_isCompleted); } }
public WaitHandle AsyncWaitHandle
{
get
{
lock( this )
{
if( _callCompleteEvent == null )
_callCompleteEvent = new ManualResetEvent(false);

return _callCompleteEvent;
}
}
}
}
====================== END OF
POST==============================================
Nov 18 '05 #1
0 1494

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Santa | last post by:
I am using Fritz Onion's "Asynchronous Pages" approach as mentioned in the article http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/default.aspx to increase the performance of my ASPX...
1
by: Carl Johansen | last post by:
I'm not sure of the best way to do what I want. Users of my website want to run reports that take a long time to generate. This is what I would like to happen: 1. User requests aspx page 2....
2
by: joerg | last post by:
Hello, we have quite a lot of troubles with our new installation of DB2 8.1.4 on a Linux-System. The server is a Dual-Xeon with 2.4 GHz and 2GB Ram, with installed Raid 1 mirrored 75 GB harddisks....
6
by: George McLean | last post by:
Hello, I am trying to isolate some performance issues. The database is DB2 v8.1 running on a Win2000 server with 4 processors and 1gb of RAM. The application is a GIS application that uses...
35
by: sacha.prins | last post by:
Hi, I read a lot about DB2 INSERT performance here. I have a nice story as well. The thing is, I work on 2 installations of DB2 (on completely different locations) which run on different (but...
13
by: bjarne | last post by:
Willy Denoyette wrote; > ... it > was not the intention of StrousTrup to the achieve the level of efficiency > of C when he invented C++, ... Ahmmm. It was my aim to match the performance...
5
by: TomR | last post by:
We are having problems with synchronus web request calls blocking our ASP.NET performance. Here is the setup: We have a php script running on Apache at Site A on the internet. This script does...
0
by: z. f. | last post by:
Hi, i have asp.net vb.net wep application. i try to investigate performance issue. so first i built a vb.net windows application that makes http requests to my pages and show me the time taken...
46
by: dunleav1 | last post by:
I have a process that does inserts that runs 50% slower that Oracle and Mssql. Queries normally take 50% slower than normal. DB2, Oracle, Mssql all are configured on same os, same disk array...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.