473,756 Members | 4,256 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Performance of ASPX Page when using Asynchronous Handlers

I am using Fritz Onion's "Asynchrono us 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.P age.
SyncPage.aspx is like any other Web page which inherits
System.Web.UI.P age.

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.)reques ts.
SyncPage.aspx page is processing a total of 2500 (approx.)reques ts.
THESE ARE THE EXPECTED RESULTS.EVERYTH ING 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.)reques ts.
SyncPage.aspx page is processing a total of 7500 (approx.)reques ts.

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(objec t sender, System.EventArg s e)
{
System.Threadin g.Thread.Sleep( 3000);
Response.Write( "This is Async Page after 3 seconds sleep");
}
}
SyncPage.aspx Code:
=============== ======
public Class SyncPage : System.Web.UI.P age
{
private void Page_Load(objec t sender, System.EventArg s e)
{
System.Threadin g.Thread.Sleep( 3000);
Response.Write( "This is Sync Page after 3 seconds sleep");
}
}
ASyncPage class Code:
=============== ======
public class AsyncPage : Page, IHttpAsyncHandl er
{
static protected DevelopMentor.T hreadPool _threadPool;

static AsyncPage()
{
_threadPool = new DevelopMentor.T hreadPool(2, 25, "AsyncPool" );
_threadPool.Pro pogateCallConte xt = true;
_threadPool.Pro pogateThreadPri ncipal = true;
_threadPool.Pro pogateHttpConte xt = true;
_threadPool.Sta rt();
}

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

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

public IAsyncResult BeginProcessReq uest(HttpContex t ctx,
AsyncCallback cb, object obj)
{
AsyncRequestSta te reqState = new AsyncRequestSta te(ctx, cb, obj);
_threadPool.Pos tRequest(new
DevelopMentor.W orkRequestDeleg ate(ProcessRequ est), reqState);

return reqState;
}

public void EndProcessReque st(IAsyncResult ar)
{
}

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

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

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

}

class AsyncRequestSta te : IAsyncResult
{
public AsyncRequestSta te(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 ManualResetEven t _callCompleteEv ent = null;

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

// IAsyncResult
//
public object AsyncState { get { return(_extraDa ta); } }
public bool CompletedSynchr onously { get { return(false); } }
public bool IsCompleted { get { return(_isCompl eted); } }
public WaitHandle AsyncWaitHandle
{
get
{
lock( this )
{
if( _callCompleteEv ent == null )
_callCompleteEv ent = new ManualResetEven t(false);

return _callCompleteEv ent;
}
}
}
}
=============== ======= END OF
POST=========== =============== =============== =====
Nov 18 '05 #1
0 1515

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

Similar topics

0
2299
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 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
1
1576
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. aspx page kicks off an asynchronous background task (on the same web server) to generate the report. The end result will be a file created on the website. 3. aspx page returns this message to the user: "your report is being generated, check back...
2
4751
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. The system itself is performing very fast but in combination with DB2 we are facing an I/O-problem. Our DB-scenaio is as follows: Loading a flat table over JDBC and splitting it into a more detailed datastructure. We are commiting after every...
6
3304
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 ADO to access the database. It was not written specifically for DB2 and I think almost all queries are running as dynamic queries. The performance issue arise when users are
35
2834
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 same generation) hardware. Benchmarking the disk throughput and CPU basically amounts to the same figures (+/- 10%).
13
2763
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 of C and I achieved that aim very early on. See, for example "The Design and Evolution of C++". -- Bjarne Stroustrup; http://www.research.att.com/~bs
5
383
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 nothing more than wait 15 seconds before serving a page. (You can try it if you want. www.337skymaster.com/mypost.php) Using this page, we can open four IE browsers on the same machine and start each browser at the same time, and have all four...
0
1278
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 to receive the page and it's size. the windows app uses a WebRequest and StreamReader to receive the http request. the strange information is for a page that took to receive about 218 ms i enabled the trace in the web.config of my pages, and trace...
46
13148
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 (raid 1/0 - 15k disks) but DB2 I/O seems to be significantly slower. Tablespaces are SMS with automatic prefetch set. My thought was to create the log buffer array as large as possible so I don't have to switch to disk much. I'm running circular...
0
9462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10046
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9886
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7259
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6542
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.