Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   What is the fastest way to deliver a "pass-through" document? (http://www.velocityreviews.com/forums/t71047-what-is-the-fastest-way-to-deliver-a-pass-through-document.html)

Benjamin Joldersma 01-20-2004 08:22 PM

What is the fastest way to deliver a "pass-through" document?
 
Hello all,

My company is installing a Bluecoat caching machine to help serve some
of our dynamic content. This is fine for free documents, but we have
to make a minor architectural tweak for the documents that require
authorization.

Our solution is to run the requests through an HttpModule that
determines if the request is cacheable, and the user is authorized to
view it (if the document is not cacheable, it is just processed
regularly and bypasses the bluecoat machine.) Assuming the user is
authorized, the HttpModule generates a System.Net.WebClient instance,
and requests the document from the cache machine, which manages the
private origin servers. We then take the stream from the OpenRead
method, and ReadToEnd directly into the Response buffer.

Preliminary tests seem reasonable, but I am in my gut a bit concerned
about scalablity.

Is this the fastest way we can retrieve a document? Would it be
faster/ more performant to open a socket ourselves and avoid the
overhead of the WebClient class?

Is there a better way to transfer whole documents from a private
server to a public server, a la Response.WriteFile, but via a URI
instead of a physical file path?

Thanks in advance for any feedback.

Benjamin Joldersma,
Sr. Software Engineer,
Citadel Media, Inc.

Steven Cheng[MSFT] 01-21-2004 04:26 AM

RE: What is the fastest way to deliver a "pass-through" document?
 
Hi Benjamin,


Thank you for using MSDN Newsgroup! My name is Steven, and I'll be
assisting you on this issue.
From your description, you're developing an ASP.NET web application in
which you need to transfer a document from a private server to another
public server. And currently you are using the webclient class to perform
the transfering function, so you'd like to look for some suggestions on
whether there're some other means to implement this or the strong points
and weak points of each?
If there is anything I misunderstood, please feel free to let me know.


Based on my experience, since the webclient class itself just encapsulate
the using of the socket and http layer communication, so the efficiency or
performance is hard to conclude simply. The result may be different under
all kinds of conditions. But as for the convenience and higher abstracted,
I recommend that you use the webclient class rather than manually implement
yourself using socket programming. That'll save alot of time, do you think
so? Also, I think you may have a detailed test on them if you think the
runtime condition is not very hard to estimate in a certain range.

In addition, since you use the webclient class to transfer a document
between two different server. Are they are in the same intranet, is there
any net bandwidth problem with the network between them? If the bandwidth
is ok ,I think you may consider the ASP.NET XML Webservice, it is also a
very wonderful feature on distribute operations. And the webservice provide
a light weight component for implement may newwork computing functionality.
Here is tech references on the XML webservice for DOTNET in MSDN:

#Getting Started with XML Web Services in Visual Basic.NET and Visual C#
http://msdn.microsoft.com/library/de...us/dv_vstechar
t/html/vbtchgettingstartedwithxmlwebservicesinvisualstudi onet.asp

#Remote Scripting in a .NET World
http://msdn.microsoft.com/library/en...g11122001.asp?
frame=true

#How ASP.NET Web Services Work
http://msdn.microsoft.com/library/de...us/dnwebsrv/ht
ml/howwebmeth.asp

#Large Data Strategies
http://msdn.microsoft.com/library/en...11072001.asp?f
rame=true

You may have a look to see whether they'll be helpful to you. In the mean
time, if you need any further assistance, please feel free to let me know.



Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


=?Utf-8?B?QmVuamFtaW4gSm9sZGVzbWE=?= 01-29-2004 06:41 PM

RE: What is the fastest way to deliver a "pass-through" document?
 
Steven

Thanks so much for your response. Your suggestion about the relationship between the WebClient class and the socket layer was reassuring

We've since put out the code and tested it against live traffic. Mixed results. The good news is that it uses very little CPU (which makes sense), about 1% or so. The retrieval time is very quick, just a few milliseconds, sometimes it doesn't even register

The problem we are having though, is that there seems to be a bottleneck. We can only get to around 200 - 250 connections on the machine, before it the queue starts oscillating pretty wildly, but the CPU still stays low

We've tried to change the ServicePoint ConnectionLimit for the Cache Host IP to 100, and close / dispose the WebClient objects as soon as possible. But I'm not sure how to check to ensure that the new connection limit is taking - the ServicePoint classes are a bit confusing, and I can't find any examples that relate them to the WebClient (or WebRequest/Response) class(es.

Do you just have to call ServicePointManager.FindServicePoint( "Cache-Ip", null ); - and then set the ConnectionLimit once, and that is it? Could we set it to a very large number, like 2,000 or 3,000? During our big days we run about 3,000 - 3,500 connections per box, so 200 - 250 is still too low

thanks again for the help

ben

=?Utf-8?B?QmVuamFtaW4gSm9kZXJzbWE=?= 01-29-2004 11:21 PM

RE: What is the fastest way to deliver a "pass-through" document?
 
Okay, I think we are looking good, I found this article (very helpful) http://msdn.microsoft.com/webservice...rch14.asp?_r=1

In the article, they mention the System.Net configuration setting --
<system.net><connectionManagement><add address="*"
maxconnection="100"
/></connectionManagement></system.net>

We put this in our machine.config, and now we are rocking full on - we are at 800 connections, and hoping to go much higher.

thanks for the help,

ben

Steven Cheng[MSFT] 01-30-2004 07:45 AM

RE: What is the fastest way to deliver a "pass-through" document?
 
Hi Ben,


Thanks for your followup. I'm very glad that my suggestions has helped you.
Also, I've viewed the
<connectionManagement><add address="*" maxconnection="100"
/></connectionManagement>

setting, it looks so cool :). In addtion, as for the potential bottleneck
of the high connections requirement, would you consider implement a pooling
mechanism on the connections? Just like what is widely used for many other
reuseable
objects, for example, database connection pool , thread pool, .... In the
meantime, if you've got any good ideas , please feel free to post here. I
believe that'll be very helpful to many other community customers. Thanks.



Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




All times are GMT. The time now is 12:27 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.