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

Performance issue on Linux #2

Open
blackghost1987 opened this issue Jul 16, 2017 · 4 comments
Open

Performance issue on Linux #2

blackghost1987 opened this issue Jul 16, 2017 · 4 comments

Comments

@blackghost1987
Copy link

I was looking for a way to get rid of the openSSL dependency, so this crate looks really promising. I've migrated my code from hyper-native-tls and found a weird performance issue, HTTPS requests taking too long, but only under Linux.
Here is a simple code to replicate the problem:

main.rs

#[macro_use]
extern crate log;
extern crate simple_logger;

extern crate hyper;
extern crate hyper_sync_rustls;

use hyper::Client;

use hyper::net::HttpsConnector;
use hyper_sync_rustls::TlsClient;

fn main() {

    simple_logger::init().unwrap();

    let client = Client::with_connector(HttpsConnector::new(TlsClient::new()));

    info!("Start");

    client
        .get("https://dev.endticket.com/api/healthcheck")
        .send()
        .unwrap();

    info!("Done");
}

Cargo.toml

[package]
name = "test_bin"
version = "0.1.0"
authors = ["Juhasz Sandor <blackghost1987@gmail.com>"]

[dependencies]
log = "0.3.8"
simple_logger = "0.4.0"
hyper = "0.10"
hyper-sync-rustls = "0.1.0"

On Ubuntu Zesty (running in Vagrant on Windows) the request takes 15 seconds. Running the same code on Windows, the request takes <1 seconds.

I attached both logs, note the ~15 seconds holdup between these two lines:
2017-07-16 12:47:52 DEBUG [hyper::net] http scheme
2017-07-16 12:48:07 DEBUG [hyper::net] https scheme

Same lines under windows:
2017-07-16 14:50:21 DEBUG [hyper::net] http scheme
2017-07-16 14:50:21 DEBUG [hyper::net] https scheme

log_linux.txt
log_windows.txt

What could be the reason for this? What do you think, could this be an issue in Hyper or in Rustls? Where else should I report this?

@blackghost1987
Copy link
Author

Update: I've tried it with the same vagrant box and host OS but on a different network, and it works fine. So it should be related to something network interface related. I've previously had some issues with small MTU sizes on the problematic network, but I have no idea how could that be related.
Fortunately the problem is not present in our production environment, so it's not so urgent, but it would be nice to find out the cause.

@ErikPartridge
Copy link

@blackghost1987 Did you ever find a reasoning behind this? I'm unfortunately having the performance issue in production

@SergioBenitez
Copy link
Owner

@ErikPartridge I wouldn't recommend using Rocket's built-in TLS support in production. Prefer to use TLS provided by a reverse-proxy like NGINX.

@blackghost1987
Copy link
Author

@ErikPartridge unfortunately no. We haven't encountered this issue in other networks and we had no time to investigate it further, sorry. Feel free to mention this issue in any new issues opened related to this. I will be able to help probably if you'll need me for testing something or verifying a possible solution, I think I still have access to the problematic network.

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

No branches or pull requests

3 participants