-
Notifications
You must be signed in to change notification settings - Fork 298
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
SqlConnection.Open first time very slow android - 10 times slower than windows #2193
Comments
@thevirtualdj, this does not seem like a SqlClient issue, can you provide a sample application? |
@thevirtualdj what hardware did you use for testing? |
Hardware is Android 10 device with QuadCore CPU up to 1.8 GHz and 2GB of RAM. Lowest I can go is Microsoft.Data.SqlClient tds ssl layer. Even when we try without server certificate validation (#1656 (comment)) it will still send handshake and encrypt connection. And still take this 5 seconds to open first connection. If javax.net.ssl.Socket is used, this could be the problem. Because this is could be very slow. Maybe this could be the underlying problem. |
|
Tried to install it to android trusted root certificates. Have it installed. Still the same problem. |
@JRahnama note that SslStream.AuthenticateAsClientAsync has a flag to enable/disable CRL; Npgsql exposes this via the connection string, allowing users to control whether to do this or not. |
Have tried to manually override it thru Microsoft.Data.SQLClient code. Set it to false. Our cert is in application itself. |
Any progress on this issue, anyone? |
This looks like due to host name resolution timing out on Android devices, for which you can try to connect to an IP address or flush DNS cache and try to fix DNS entries to speed up connection duration. |
Could you capture event source traces and share with us for investigation? Additionally, can you share:
|
Greetings all,
We have s strange issue and cannot get the reason behind.
We are using this connection string:
string connectionString = @"Server=webserver;" +
"Database=MyDB;" +
"User Id=sa;" +
"Password=mysecretpass;" +
"Persist Security Info=False;" +
"Encrypt=True;" +
"TrustServerCertificate=True";
Connection encryption is forced by SQL server. In our project we have that certificate so we can make the connection.
When we use:
Microsoft.Data.SqlClient.SqlConnection con = new Microsoft.Data.SqlClient.SqlConnection(connectionString);
con.Open(); // <-- on Windows this is around 500 ms to 1s on android same code goes above 5s on Android device, in emulator this is bellow 2s.
Already tried everything with ConnectionString properties, non of it works. It is something underlying.
Anybody got any ideas, we can mask this by opening our connection on startup but if we have 2 different connections, it is a hustle.
So if anyone has any idea why is this so slow please advise..
It is huge pitfall for our apps..
Android
[0:] First connection open: 5236ms
[0:] Second connection open: 20ms
[0:] Third connection open: 0ms
Windows:
First connection open: 499ms
Second connection open: 5ms
Third connection open: 0ms
The text was updated successfully, but these errors were encountered: