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
Migrate to async futures with reqwest #46
Conversation
Wow! Awesome job! 👏 Let me test it with some common use cases to give you come feedback. |
In the Master Fetch users Total requests 10000
Fetch users Successful requests 10000
Fetch users Failed requests 0
Fetch users Median time per request 3ms
Fetch users Average time per request 3ms
Fetch users Sample standard deviation 1ms
Concurrency Level 10
Time taken for tests 3.0 seconds
Total requests 10000
Successful requests 10000
Failed requests 0
Requests per second 3321.76 [#/sec]
Median time per request 3ms
Average time per request 3ms
Sample standard deviation 1ms Async: Fetch users Total requests 10000
Fetch users Successful requests 10000
Fetch users Failed requests 0
Fetch users Median time per request 17ms
Fetch users Average time per request 19ms
Fetch users Sample standard deviation 6ms
Concurrency Level 10
Time taken for tests 21.3 seconds
Total requests 10000
Successful requests 10000
Failed requests 0
Requests per second 469.37 [#/sec]
Median time per request 17ms
Average time per request 19ms
Sample standard deviation 6ms Do you know the reason why the number of requests per second is much lower? |
Yes, it is expected to be slower in its current form, it still runs requests sequentially in each thread which isn't ideal. This patch is the minimal changes to make drill work with async-await, refactoring needed to actually utilize the async runtime. |
@fcsonline Can you try again with latest commit? On my local machine (MacBook Pro (15-inch, 2018) 2.2 GHz 6-Core Intel Core i7 16 GB 2400 MHz DDR4) the result is: drill sync
drill async
|
I've tested on a Linux server, async version is still slower. Sync
Async
|
By keep Sync:
Async
|
Client::new() | ||
}; | ||
|
||
// let client = ClientBuilder::default().danger_accept_invalid_certs(config.no_check_certificate).build().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a little refactor to pass no_check_certificate
config to reqwest::Client
in Request::new
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry about it for now. After merging this async branch I want to start dealing with the keep-alive feature. It is a requirement for a long time that will increase the throughput drastically.
The idea is to have a pool of clients, (domain -> Client), to be used here. The domain will be determined from the interpolated_url
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created this branch forked form this one to play a bit. e6b51ff
Keep Alive is awesome! 💪
Unlocking async will be an awesome milestone for What do you think about merging this? |
@fcsonline Let's merge it. |
No description provided.