473,508 Members | 2,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why requests come sequentually, not in parallel?

Hi, all.

Need help with what seems to be either connection, or threading problem in
my ASP.NET 2.0 application.

The gist of the problem is this: IHttpHandler in my application serves an
HTML page that has two images (image A and image B) in it. Once the HTML page
is served, expected behavior is this:
1) receive request for image A,
2) receive request for image B almost at the same time as for A,
3) serve image A response,
4) serve image B response.
Actual behavior is instead:
1) receive request for image A
2) serve image A response
3) receive request for image B
4) serve image B response
The application acts as if it allows only ONE connection from the browser
instead of two. This decreases the performance (as experienced by users)
quite a bit.

Additional details.
My ASP.NET application has ASPX pages, ASMX web services and IHttpHandler
that serves resources described before. I suspected that the problem may be
caused by the running out of inbound connections on my (Vista/IIS7 with
classic pipeline) dev box, but the same behavior is observed on IIS6 on
Windows Server 2003.
The strangest thing is that when tracing HTTP sessions using Fiddler, I see
that *browser sends both image requests requests virtually at the same time*
but second request reaches my IHttpHandler only after first one was served! I
played with ASP.NET threading settings to no avail. Requests served by
IHttpHandler have somewhat longer latency by design: from milliseconds to up
to 9 seconds. Also, when I launch multiple browsers pointing to the html page
with images, I get requests from different browsers coming in parallel. It
looks like for some reason only requests from the same browser come in
sequentially. Tried turning keep-alive on and off on the application and it
made no difference.

Why would two requests sent by browser at the same time arrive in a manner
implying only one connection to the browser instead of two?

Thank you,
Vlad.
Nov 10 '08 #1
7 3134
you probably have session enabled for your handler. two requests to the same
session are serialized due to the design of session management. your image
handlers should not use session (IRequiresSessionState or
IReadOnlySessionState) as this will cause performance issues.

-- bruce (sqlwork.com)
"VH" wrote:
Hi, all.

Need help with what seems to be either connection, or threading problem in
my ASP.NET 2.0 application.

The gist of the problem is this: IHttpHandler in my application serves an
HTML page that has two images (image A and image B) in it. Once the HTML page
is served, expected behavior is this:
1) receive request for image A,
2) receive request for image B almost at the same time as for A,
3) serve image A response,
4) serve image B response.
Actual behavior is instead:
1) receive request for image A
2) serve image A response
3) receive request for image B
4) serve image B response
The application acts as if it allows only ONE connection from the browser
instead of two. This decreases the performance (as experienced by users)
quite a bit.

Additional details.
My ASP.NET application has ASPX pages, ASMX web services and IHttpHandler
that serves resources described before. I suspected that the problem may be
caused by the running out of inbound connections on my (Vista/IIS7 with
classic pipeline) dev box, but the same behavior is observed on IIS6 on
Windows Server 2003.
The strangest thing is that when tracing HTTP sessions using Fiddler, I see
that *browser sends both image requests requests virtually at the same time*
but second request reaches my IHttpHandler only after first one was served! I
played with ASP.NET threading settings to no avail. Requests served by
IHttpHandler have somewhat longer latency by design: from milliseconds to up
to 9 seconds. Also, when I launch multiple browsers pointing to the html page
with images, I get requests from different browsers coming in parallel. It
looks like for some reason only requests from the same browser come in
sequentially. Tried turning keep-alive on and off on the application and it
made no difference.

Why would two requests sent by browser at the same time arrive in a manner
implying only one connection to the browser instead of two?

Thank you,
Vlad.
Nov 10 '08 #2
Huh! Yes, my handler has to use session where some expensive-to-fetch
access-control info is cached. Is this behavior, where requests are
serialized, common to all ASP.NET requests (ASPX, ASMX), or is it
IHttpHandler-specific? One would think it would be enough to serialize access
to sessions themselves. Why block for entire time of request execution?
Also, would using of IAsyncHttpHandler help? If not, could you please
suggest any workarounds?

Thank you,
Vlad.

"bruce barker" wrote:
you probably have session enabled for your handler. two requests to the same
session are serialized due to the design of session management. your image
handlers should not use session (IRequiresSessionState or
IReadOnlySessionState) as this will cause performance issues.

-- bruce (sqlwork.com)
"VH" wrote:
Hi, all.

Need help with what seems to be either connection, or threading problem in
my ASP.NET 2.0 application.

The gist of the problem is this: IHttpHandler in my application serves an
HTML page that has two images (image A and image B) in it. Once the HTML page
is served, expected behavior is this:
1) receive request for image A,
2) receive request for image B almost at the same time as for A,
3) serve image A response,
4) serve image B response.
Actual behavior is instead:
1) receive request for image A
2) serve image A response
3) receive request for image B
4) serve image B response
The application acts as if it allows only ONE connection from the browser
instead of two. This decreases the performance (as experienced by users)
quite a bit.

Additional details.
My ASP.NET application has ASPX pages, ASMX web services and IHttpHandler
that serves resources described before. I suspected that the problem may be
caused by the running out of inbound connections on my (Vista/IIS7 with
classic pipeline) dev box, but the same behavior is observed on IIS6 on
Windows Server 2003.
The strangest thing is that when tracing HTTP sessions using Fiddler, I see
that *browser sends both image requests requests virtually at the same time*
but second request reaches my IHttpHandler only after first one was served! I
played with ASP.NET threading settings to no avail. Requests served by
IHttpHandler have somewhat longer latency by design: from milliseconds to up
to 9 seconds. Also, when I launch multiple browsers pointing to the html page
with images, I get requests from different browsers coming in parallel. It
looks like for some reason only requests from the same browser come in
sequentially. Tried turning keep-alive on and off on the application and it
made no difference.

Why would two requests sent by browser at the same time arrive in a manner
implying only one connection to the browser instead of two?

Thank you,
Vlad.
Nov 10 '08 #3
Never mind my previous post. Of course, all requests accessing Session should
be serialized, unless they were required to be written in a thread-safe
manner. I wish there were a way to declare a page or a handler as thread-safe
to avoid perf penalty due to request serialization.

Thanks again,
Vlad.

"bruce barker" wrote:
you probably have session enabled for your handler. two requests to the same
session are serialized due to the design of session management. your image
handlers should not use session (IRequiresSessionState or
IReadOnlySessionState) as this will cause performance issues.

-- bruce (sqlwork.com)
"VH" wrote:
Hi, all.

Need help with what seems to be either connection, or threading problem in
my ASP.NET 2.0 application.

The gist of the problem is this: IHttpHandler in my application serves an
HTML page that has two images (image A and image B) in it. Once the HTML page
is served, expected behavior is this:
1) receive request for image A,
2) receive request for image B almost at the same time as for A,
3) serve image A response,
4) serve image B response.
Actual behavior is instead:
1) receive request for image A
2) serve image A response
3) receive request for image B
4) serve image B response
The application acts as if it allows only ONE connection from the browser
instead of two. This decreases the performance (as experienced by users)
quite a bit.

Additional details.
My ASP.NET application has ASPX pages, ASMX web services and IHttpHandler
that serves resources described before. I suspected that the problem may be
caused by the running out of inbound connections on my (Vista/IIS7 with
classic pipeline) dev box, but the same behavior is observed on IIS6 on
Windows Server 2003.
The strangest thing is that when tracing HTTP sessions using Fiddler, I see
that *browser sends both image requests requests virtually at the same time*
but second request reaches my IHttpHandler only after first one was served! I
played with ASP.NET threading settings to no avail. Requests served by
IHttpHandler have somewhat longer latency by design: from milliseconds to up
to 9 seconds. Also, when I launch multiple browsers pointing to the html page
with images, I get requests from different browsers coming in parallel. It
looks like for some reason only requests from the same browser come in
sequentially. Tried turning keep-alive on and off on the application and it
made no difference.

Why would two requests sent by browser at the same time arrive in a manner
implying only one connection to the browser instead of two?

Thank you,
Vlad.
Nov 10 '08 #4
session sharing is more complex than just threadsafe. inproc is pretty
simple, you could require all access to session to threadsafe, but out of
proc sessions are more complex. as session is loaded at start of request, and
saved at end of request, the session manager would still need to serialize
on load, and hold off on save via some reference counting.

you should still look at rewriting your image handler to be sessionless and
use the url parameters to access the session data (which would need to be
stored outside session)

-- bruce (sqlwork.com)
"VH" wrote:
Never mind my previous post. Of course, all requests accessing Session should
be serialized, unless they were required to be written in a thread-safe
manner. I wish there were a way to declare a page or a handler as thread-safe
to avoid perf penalty due to request serialization.

Thanks again,
Vlad.

"bruce barker" wrote:
you probably have session enabled for your handler. two requests to the same
session are serialized due to the design of session management. your image
handlers should not use session (IRequiresSessionState or
IReadOnlySessionState) as this will cause performance issues.

-- bruce (sqlwork.com)
"VH" wrote:
Hi, all.
>
Need help with what seems to be either connection, or threading problem in
my ASP.NET 2.0 application.
>
The gist of the problem is this: IHttpHandler in my application serves an
HTML page that has two images (image A and image B) in it. Once the HTML page
is served, expected behavior is this:
1) receive request for image A,
2) receive request for image B almost at the same time as for A,
3) serve image A response,
4) serve image B response.
Actual behavior is instead:
1) receive request for image A
2) serve image A response
3) receive request for image B
4) serve image B response
The application acts as if it allows only ONE connection from the browser
instead of two. This decreases the performance (as experienced by users)
quite a bit.
>
Additional details.
My ASP.NET application has ASPX pages, ASMX web services and IHttpHandler
that serves resources described before. I suspected that the problem may be
caused by the running out of inbound connections on my (Vista/IIS7 with
classic pipeline) dev box, but the same behavior is observed on IIS6 on
Windows Server 2003.
The strangest thing is that when tracing HTTP sessions using Fiddler, I see
that *browser sends both image requests requests virtually at the same time*
but second request reaches my IHttpHandler only after first one was served! I
played with ASP.NET threading settings to no avail. Requests served by
IHttpHandler have somewhat longer latency by design: from milliseconds to up
to 9 seconds. Also, when I launch multiple browsers pointing to the html page
with images, I get requests from different browsers coming in parallel. It
looks like for some reason only requests from the same browser come in
sequentially. Tried turning keep-alive on and off on the application and it
made no difference.
>
Why would two requests sent by browser at the same time arrive in a manner
implying only one connection to the browser instead of two?
>
Thank you,
Vlad.
Nov 10 '08 #5
Thank you, Bruce. That explains it: if session items cannot always be shared
between parallel requests even if access to Session collection was required
to be thread-safe, then you're right, requests need to be serialized. I will
need to rewrite my handler to save session-specific items in a in-process,
thread-safe structure outside of the Session collection.

Vlad Hrybok.
http://UltiDev.com/Products/HttpVPN/

"bruce barker" wrote:
session sharing is more complex than just threadsafe. inproc is pretty
simple, you could require all access to session to threadsafe, but out of
proc sessions are more complex. as session is loaded at start of request, and
saved at end of request, the session manager would still need to serialize
on load, and hold off on save via some reference counting.

you should still look at rewriting your image handler to be sessionless and
use the url parameters to access the session data (which would need to be
stored outside session)

-- bruce (sqlwork.com)
"VH" wrote:
Never mind my previous post. Of course, all requests accessing Session should
be serialized, unless they were required to be written in a thread-safe
manner. I wish there were a way to declare a page or a handler as thread-safe
to avoid perf penalty due to request serialization.

Thanks again,
Vlad.

"bruce barker" wrote:
you probably have session enabled for your handler. two requests to the same
session are serialized due to the design of session management. your image
handlers should not use session (IRequiresSessionState or
IReadOnlySessionState) as this will cause performance issues.
>
-- bruce (sqlwork.com)
>
>
"VH" wrote:
>
Hi, all.

Need help with what seems to be either connection, or threading problem in
my ASP.NET 2.0 application.

The gist of the problem is this: IHttpHandler in my application serves an
HTML page that has two images (image A and image B) in it. Once the HTML page
is served, expected behavior is this:
1) receive request for image A,
2) receive request for image B almost at the same time as for A,
3) serve image A response,
4) serve image B response.
Actual behavior is instead:
1) receive request for image A
2) serve image A response
3) receive request for image B
4) serve image B response
The application acts as if it allows only ONE connection from the browser
instead of two. This decreases the performance (as experienced by users)
quite a bit.

Additional details.
My ASP.NET application has ASPX pages, ASMX web services and IHttpHandler
that serves resources described before. I suspected that the problem may be
caused by the running out of inbound connections on my (Vista/IIS7 with
classic pipeline) dev box, but the same behavior is observed on IIS6 on
Windows Server 2003.
The strangest thing is that when tracing HTTP sessions using Fiddler, I see
that *browser sends both image requests requests virtually at the same time*
but second request reaches my IHttpHandler only after first one was served! I
played with ASP.NET threading settings to no avail. Requests served by
IHttpHandler have somewhat longer latency by design: from milliseconds to up
to 9 seconds. Also, when I launch multiple browsers pointing to the html page
with images, I get requests from different browsers coming in parallel. It
looks like for some reason only requests from the same browser come in
sequentially. Tried turning keep-alive on and off on the application and it
made no difference.

Why would two requests sent by browser at the same time arrive in a manner
implying only one connection to the browser instead of two?

Thank you,
Vlad.
Nov 10 '08 #6

I belive that is what EnableSession=ReadOnly does on aspx pages.
Not sure how to do it on a Handler level

George

"VH" <VH@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.com...
Never mind my previous post. Of course, all requests accessing Session
should
be serialized, unless they were required to be written in a thread-safe
manner. I wish there were a way to declare a page or a handler as
thread-safe
to avoid perf penalty due to request serialization.

Thanks again,
Vlad.

"bruce barker" wrote:
>you probably have session enabled for your handler. two requests to the
same
session are serialized due to the design of session management. your
image
handlers should not use session (IRequiresSessionState or
IReadOnlySessionState) as this will cause performance issues.

-- bruce (sqlwork.com)
"VH" wrote:
Hi, all.

Need help with what seems to be either connection, or threading problem
in
my ASP.NET 2.0 application.

The gist of the problem is this: IHttpHandler in my application serves
an
HTML page that has two images (image A and image B) in it. Once the
HTML page
is served, expected behavior is this:
1) receive request for image A,
2) receive request for image B almost at the same time as for A,
3) serve image A response,
4) serve image B response.
Actual behavior is instead:
1) receive request for image A
2) serve image A response
3) receive request for image B
4) serve image B response
The application acts as if it allows only ONE connection from the
browser
instead of two. This decreases the performance (as experienced by
users)
quite a bit.

Additional details.
My ASP.NET application has ASPX pages, ASMX web services and
IHttpHandler
that serves resources described before. I suspected that the problem
may be
caused by the running out of inbound connections on my (Vista/IIS7 with
classic pipeline) dev box, but the same behavior is observed on IIS6 on
Windows Server 2003.
The strangest thing is that when tracing HTTP sessions using Fiddler, I
see
that *browser sends both image requests requests virtually at the same
time*
but second request reaches my IHttpHandler only after first one was
served! I
played with ASP.NET threading settings to no avail. Requests served by
IHttpHandler have somewhat longer latency by design: from milliseconds
to up
to 9 seconds. Also, when I launch multiple browsers pointing to the
html page
with images, I get requests from different browsers coming in parallel.
It
looks like for some reason only requests from the same browser come in
sequentially. Tried turning keep-alive on and off on the application
and it
made no difference.

Why would two requests sent by browser at the same time arrive in a
manner
implying only one connection to the browser instead of two?

Thank you,
Vlad.
Nov 10 '08 #7
Forgot to add
You can easily write your own custom Session object..
Google it, I recall it was a KB on Microsoft.com with full implementation

George.
"VH" <VH@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.com...
Never mind my previous post. Of course, all requests accessing Session
should
be serialized, unless they were required to be written in a thread-safe
manner. I wish there were a way to declare a page or a handler as
thread-safe
to avoid perf penalty due to request serialization.

Thanks again,
Vlad.

"bruce barker" wrote:
>you probably have session enabled for your handler. two requests to the
same
session are serialized due to the design of session management. your
image
handlers should not use session (IRequiresSessionState or
IReadOnlySessionState) as this will cause performance issues.

-- bruce (sqlwork.com)
"VH" wrote:
Hi, all.

Need help with what seems to be either connection, or threading problem
in
my ASP.NET 2.0 application.

The gist of the problem is this: IHttpHandler in my application serves
an
HTML page that has two images (image A and image B) in it. Once the
HTML page
is served, expected behavior is this:
1) receive request for image A,
2) receive request for image B almost at the same time as for A,
3) serve image A response,
4) serve image B response.
Actual behavior is instead:
1) receive request for image A
2) serve image A response
3) receive request for image B
4) serve image B response
The application acts as if it allows only ONE connection from the
browser
instead of two. This decreases the performance (as experienced by
users)
quite a bit.

Additional details.
My ASP.NET application has ASPX pages, ASMX web services and
IHttpHandler
that serves resources described before. I suspected that the problem
may be
caused by the running out of inbound connections on my (Vista/IIS7 with
classic pipeline) dev box, but the same behavior is observed on IIS6 on
Windows Server 2003.
The strangest thing is that when tracing HTTP sessions using Fiddler, I
see
that *browser sends both image requests requests virtually at the same
time*
but second request reaches my IHttpHandler only after first one was
served! I
played with ASP.NET threading settings to no avail. Requests served by
IHttpHandler have somewhat longer latency by design: from milliseconds
to up
to 9 seconds. Also, when I launch multiple browsers pointing to the
html page
with images, I get requests from different browsers coming in parallel.
It
looks like for some reason only requests from the same browser come in
sequentially. Tried turning keep-alive on and off on the application
and it
made no difference.

Why would two requests sent by browser at the same time arrive in a
manner
implying only one connection to the browser instead of two?

Thank you,
Vlad.
Nov 10 '08 #8

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

Similar topics

16
7453
by: noah | last post by:
Does PHP have a feature to associate Cookie sessions with a persistent database connection that will allow a single transaction across multiple HTTP requests? Here is how I imagine my process: I...
11
4894
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
2
1347
by: Alex | last post by:
Hello, All. I encouraged some strange behaviour of either IIS, ASP.NET, IE or donn't know what... I have a simple wait.aspx page private void Page_Load(object sender, System.EventArgs e) {...
4
4584
by: rzimerman | last post by:
I'm hoping to write a program that will read any number of urls from stdin (1 per line), download them, and process them. So far my script (below) works well for small numbers of urls. However, it...
14
9298
by: Sergei Shelukhin | last post by:
Hi. I have a session started in php and two browser windows (IE)/tabs (FF) open. In one window, I execute a very slow report, immediately after that, I execute a fast simple page in another. I...
8
2416
by: vunet | last post by:
I'd like to perform multiple XMLHTTP requests but one after the other, ie. do next when previous one comes back ok. Identifier to determine when to start the next one is a global variable whose...
7
5433
by: Brent | last post by:
I'm trying to figure out how to iterate over an array that would send a series of XMLHttp requests. I'd like to have each request finish before the next one begins, but I believe that this is not...
21
2759
by: mark | last post by:
Hello, I want to create a php scraper that will get some information from e.g. 5 sites simultaneously. I tried the following script:...
0
7225
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,...
0
7124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7385
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...
0
7498
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...
0
5629
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,...
1
5053
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...
0
4707
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...
0
1558
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 ...
0
418
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...

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.