Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to request? #15

Closed
dmyers opened this issue Apr 28, 2015 · 3 comments
Closed

Switch to request? #15

dmyers opened this issue Apr 28, 2015 · 3 comments
Labels

Comments

@dmyers
Copy link
Collaborator

dmyers commented Apr 28, 2015

Have you ever experienced Superagent be slow compared to the request package?

I switched from one API server to Azure API management and it came to a crawl and when I started debugging I've narrowed it down to that Superagent.

If I use the request package in another script with the same request my calls go through fine, but in the Superagent version it takes about 120 seconds.

@dmyers dmyers changed the title Update superagent Superagent slow vs request package Apr 28, 2015
@dmyers
Copy link
Collaborator Author

dmyers commented Apr 29, 2015

@matteofigus I know it is Superagent because if I update the request-agent.js file and switch it over to request package then it works and doesn't have the delay at all and everything works (well minus the response output in the html file).

@matteofigus
Copy link
Owner

Uhm, ok, this is definitely interesting but I suspect there is something more. Before switching, in case it would be a good investment (I would need to microbenchmark both scenarios to be sure it is), I would like to know more about what is causing your failure to happen.
Things that come in my mind that happened in the past are

  1. bugs with self-signed certificates with https - different libraries may have different settings for handling that (are you benchmarking https?)
  2. auto-follow 3xx redirects
  3. something else?

@matteofigus matteofigus changed the title Superagent slow vs request package Switch to request? Apr 14, 2016
@matteofigus
Copy link
Owner

@dmyers I think this topic is coming back over and over (#35 for example). Specifically, request seems to be more popular and have more features, which would be a good benefit for this module.

What if we could do a spike for switching to request?
The idea would be to make a different branch and then trying it with some real data.

My biggest worry is that we don't trade off too much performance. More specifically: when using featured http clients (that wrap node's http module) we definitely add some features but they usually have a cost. In a single threaded context as node, if a client makes some cpu operations for the sake of adding functionality that may conflict with this module's goal. Basically because the goal of this module is to make millions of concurrent requests, and realistically in a live scenario you would use some of this clients for doing some dozens. When something requires CPU and blocks the event loop, then, measurements end up being not accurate. This is why I would like to switch to request and compare request+superagent results to see if we have a decent level of consistency in the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants