473,320 Members | 1,841 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,320 software developers and data experts.

ASPX Page Performance using Custom thread pool

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==============================================
Jul 21 '05 #1
0 2265

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...
8
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...
11
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...
11
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...
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: 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...
1
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 ...
2
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...
3
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.