Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Http request with Fiddler is blazing fast

Tags:

I wrote a multithread program in c# that crawls a web site, but when I started Fiddler in the background request completed 12x faster, it is really strange for me and when I close Fiddler download rates slows downs. how it is possible please help, (there is no proxy setting for my connection to the ineternet and for Fiddler too) If i can inject the performance of fiddler in my application it would be wonderful, any solution? Is there any magic behind the scenes ?? :)

Thanks

like image 425
Ehsan Avatar asked May 03 '12 08:05

Ehsan


People also ask

How do I request a fiddler?

To create a GET request inside Fiddler, choose the GET method and type the server URL in the URL box. Then click the Execute button. NOTE: Once the request is sent to the server, use the Inspectors to inspect the response. There is a different inspector type for almost all response content types like JSON, Web, etc.

Why does fiddler slow down HTTP connections?

The reason is the limit on the number of simultaneous http connections which is ignored when using Fiddler. I've run into the same behavior while using System.Net.Http.HttpClient to perform multiple (~80) concurrent requests. With Fiddler running, all the requests were completing much faster. Keep-alive was certainly enabled.

Why don't all web requests appear in Fiddler?

However, not all web requests appear in fiddler unless the client application using a system Default Proxy. By default Fiddler doesn’t show the content of Web requests made to HTTPS Url (Secure site) because it’s encrypted. Perform the following steps if you want to see HTTPS Traffic.

How do I create a request in Fiddler?

You can access everything you need to create new request from the Composer tab in Fiddler. It supports two different modes, but you’ll probably need the Parsed one. There you can specify the HTTP method, the URL, the HTTP version, the Headers and the Body of the request.

How do I see https traffic in Fiddler?

By default Fiddler doesn’t show the content of Web requests made to HTTPS Url (Secure site) because it’s encrypted. Perform the following steps if you want to see HTTPS Traffic. Once your web requests appear on the left side panel. Simply double click on the request entry to view. On your right side, you will see two panels.


2 Answers

The reason is the limit on the number of simultaneous http connections which is ignored when using Fiddler.

I've run into the same behavior while using System.Net.Http.HttpClient to perform multiple (~80) concurrent requests. With Fiddler running, all the requests were completing much faster. Keep-alive was certainly enabled.

I used Wireshark to see what's happening and first thing I noticed that the manner of the http traffic was different. With Fiddler requests were thrown all at once and responses followed nicely grouped as well. Without Fiddler the requests were interleaving with responses.

Secondly, tcpview showed that my code without Fiddler opened only 2 tcp connections to the server. With Fiddler started, the number of connections significanly increased. There were tens of them from my app to Fiddler and then from Fiddler to the server.

It is well known that the http standard recommends the number of http connections should be no more than 2 and it seems the limit is implemented as a default setting in http clients.

In .NET applications we can control the limit with ServicePointManager.DefaultConnectionLimit static property. As an experiment, having it set to 100 made the requests completing with the same time with and without Fiddler.

The setting can also be controlled through app.config:

    <system.net>
    <connectionManagement>
        <add address="*" maxconnection="100" />
    </connectionManagement>
</system.net>

Now, why is the default connection limit not respected while using Fiddler? Looks like the limit is different when an http client uses a proxy and Fiddler does act as a proxy. I did not find much information about the proxy connection limit besides this old article.

like image 96
v.shashenko Avatar answered Sep 30 '22 10:09

v.shashenko


Can you show some sample code so people can confirm this? Otherwise it'll become wild guessing.

My best guess: Fiddler uses keepalive which will save the trouble of opening the connection over and over again. You can confirm this by disabling both Reuse client connections and Reuse connections to servers: if it's then as slow as usual (or slower), the benefit is gained from keeping the connection alive.

like image 33
CodeCaster Avatar answered Sep 30 '22 09:09

CodeCaster