473,795 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASPX Page Performance using Custom thread pool

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 813

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

Similar topics

0
2300
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
8
2062
by: DP | last post by:
I read some articles and post how to optimize te speed of asp pages regarding opening and closing DB connections but I am still not sure about this. Is it true that it doesn't matter how many times I open and destroy a DB connection on 1 single page? ---------------------------------------------------------- Set DataConn = Server.CreateObject("ADODB.Connection") Call DataConn.Open (...)
11
8882
by: Steve | last post by:
Hi, I'm using a std::vector to store a list of user defined objects. The vector may have well over 1000 elements, and I'm suffering a performance hit. If I use push_back I get a much worse perfomance than if I first define the vector of a given size, then write to the elements with myvec = However, I'm currently thinking that it isn't feasible to obtain the vector size, so really need to resize the vector dynamically as I go. Is...
11
2900
by: Bob | last post by:
In our new .NET web applications, we try to limit the use of SqlConnection to just one instance per page, even if there are multiple accesses to various queries. The thinking behind is that this reduces the need to getting and returning connections to the pool repeatedly if a page has multiple calls to the DB, and each one manages its own connection. However, this does requires more deliberate coding, like calling the...
0
1516
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
2150
by: buzz | last post by:
I am evaluating Mike Woodring's custom thread pool classes (Developmentor) for use with an ASP.NET project that will be implementing pages derived from IHttpAsyncHandler. (Recommended by the famous Fritz Onion article on IHttpAsyncHandler...) I understand most of the code, however I am at a losss of the purpose of the ThreadInfo class. It appears that it is used to get the current HTTP context object for a worker thread?? But, can't...
1
2134
by: digitalego | last post by:
Sorry if the title is a little confusing... Here is the problem. I am working with a "default.aspx" page that uses a user control I made: ------------------------------ | default.aspx | ------------------------------ <%@ Page language="C#" CodeBehind="ChartPage.cs"
2
1376
by: Sanjay Pais | last post by:
We are using ASP.2.0 and I was wondering if any one knew how I could modify the default.aspx. What I want to do is add some new HTML to the aspx page as well as either change the code behind or use some new code beside on the page itself. For example, I want to change this <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
4
2904
by: Frankie | last post by:
I'm writing a small C# utility application that creates new Web Sites via ADSI. It seems to work just fine for the most part -- meaning that IIS Metabase entries look either identical or "different where expected" - when comparing Web Sites created with my utility against Web Sites created "manually" with IIS Manager. I'm comparing the sites visually (eye balling it) with Metabase Explorer. The problem I have with Web Sites created with...
3
4893
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable g_sConnectionString and leave this connection open and not close it until it exits the application. Then on each thread/each subsequent sub that needs the connection I create a local OleDBConnection variable, open the connection using the exact...
0
9673
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
10443
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...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10002
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9044
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...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2921
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.