title: Delays in HTTP requests via Node.js compared to browser
body: <p>In using Node.js to query some public APIs via HTTP requests. Therefore, I'm using the <code>request</code> module. I'm measuring the response time within my application, and see that my application return the results from API queries about 2-3 times slower than "direct" requests via curl or in the browser. Also, I noticed that connections to HTTPS enabled services usually take longer than plain HTTP ones, but this can be a coincidence.</p>
  
  <p>I tried to optimize my <code>request</code> options, but to no avail. For example, I query </p>
  
  <p><a href="https://www.linkedin.com/countserv/count/share?url=http%3A%2F%2Fwww.google.com%2F&amp;lang=en_US" rel="noreferrer">https://www.linkedin.com/countserv/count/share?url=http%3A%2F%2Fwww.google.com%2F&amp;lang=en_US</a></p>
  
  <p>I'm using <code>request.defaults</code> to set the overall defaults for all requests:</p>
  
  <pre><code>var baseRequest = request.defaults({
      pool: {maxSockets: Infinity},
      jar: true,
      json: true,
      timeout: 5000,
      gzip: true,
      headers: {
          'Content-Type': 'application/json'
      }
  });
  </code></pre>
  
  <p>The actual request are done via</p>
  
  <pre><code>...
  var start = new Date().getTime();
  
  var options = {
      url: 'https://www.linkedin.com/countserv/count/share?url=http%3A%2F%2Fwww.google.com%2F&amp;lang=en_US',
      method: 'GET'
  };
  
  baseRequest(options, function(error, response, body) {
  
      if (error) {
          console.log(error);
      } else {
          console.log((new Date().getTime()-start) + ": " + response.statusCode);
      }
  
  });
  </code></pre>
  
  <p>Does anybody see optimization potential? Am I doing something completely wrong? Thanks in advance for any advice!</p>