page multithreading

  • Thread starter Thread starter Ireney Berezniak
  • Start date Start date
I

Ireney Berezniak

Hi,

I'm loading images into a client by specifing an aspx page as a source,
as shown in the example below, which uses the webclient to load the
image from a remote resouce, and stream it back to the client:

<img src="/streamer.aspx?src=image1" >
<img src="/streamer.aspx?src=image2" >
<img src="/streamer.aspx?src=image3" >
<img src="/streamer.aspx?src=image4" >
<img src="/streamer.aspx?src=image5" >
<img src="/streamer.aspx?src=image6" >
....

The problem is, it appears that the streamer.aspx is locked, so that
images load sequentially, as one call waits for another to end the
operation before proceeding with it's own operation ... requests are
being qued. Looks like it's a single threaded operation? Is there a
way to force streamer.aspx to span multiple threads of itself, or accept
a number of request, and stream the images back to the client
asynchronously, so that all of them load at the same?

I tried putting the webclient operation in a new thread of its own, but
that doesn't fix it, obviously, as the main thread (that of
streamer.aspx) still waits before all threads it call are completed.

Any pointers would be appreciated. I could write a separate image
delivery server, but that is out of scope of my application, and really
the last resort.

Thanks!

ib.
 
Ireney Berezniak said:
Hi,

I'm loading images into a client by specifing an aspx page as a source, as
shown in the example below, which uses the webclient to load the image
from a remote resouce, and stream it back to the client:

<img src="/streamer.aspx?src=image1" >
<img src="/streamer.aspx?src=image2" >
<img src="/streamer.aspx?src=image3" >
<img src="/streamer.aspx?src=image4" >
<img src="/streamer.aspx?src=image5" >
<img src="/streamer.aspx?src=image6" >
...

The problem is, it appears that the streamer.aspx is locked, so that
images load sequentially, as one call waits for another to end the
operation before proceeding with it's own operation ... requests are being
qued.

Unless you are doing something to serialize the code inside streamer.aspx,
then it should run concurrently. However Internet Explorer only uses
something like two threads per browser window to retrieve images instead of
requesting them all at the same time. This will cause the images to
download somewhat sequentially. Making the download faster, say by turning
on caching for streamer.aspx may reduce the appearence that the images are
loading one at a time.

David
 
You may want to try EnableSessionState="false" in the @ Page
directive. Requests attached to a specific session are serialized.
 
Back
Top