SocketTimeoutException from one AppEngine Server to another - google-app-engine

We are a Premier Account User in GoogleAppEngine. We have two front-end servers running on Google AppEngine developed using Java.
Front-end server A communicates with another front-end server B using URLFetch(java.net) request.
We have set the maximum connectionTimeOut and readTimeOuts (60000ms) also for URLFetch in server A.
All the requests from server A to B works successfully 70% of the time.
But we are finding weird scenarios like 30% of the time where server A would have given URLFetch request to Server B and throwing java.net.SocketTimeoutException: Timeout while fetching URL.
Note: The request from Server A to B remains dead air for 60 seconds and there aren't any request being received at Server B for the same. There are no instance restarts on both the servers.
But when the client retries the request again, it runs successfully.
We have 2 idle instances and instance classes configured to F4 on both the servers.
Can we please know why the request from Server A timeouts out without a request being received at the other server end (ie) Server B?
Thanks.
Regards,
Anantha Krishnan

Related

How to check session timeout configured in Jboss application

I am using a spring based application with MS SQL server and using hibernate or native sql to fetch data from the database. However one of the problems I am facing is session timeout after around 2 minutes. The session timeout configured for the application in web.xml is 20 minutes. Ideally if session is idle it does not get logged out. But whenever there is a database related operation that would take more than 2 minutes to execute the session is killed. Can someone help me with this?
Using Jboss 7.3

Why does the App engine (python3 - standard environment) generate aborted connections when connecting to a cloud sql -2nd Gen Mysql instance?

I'm currently developing a project with python 3.7, Django 2.1, Mysql as database.
I'm deploying it in google cloud app engine standard environment and for the database I'm using a cloud SQL - MySql 2nd gen instance.
The application works well, however when I analyze the logs I see these errors:
"aborted connection - Got an error reading communication packets"
In this case the connection is being closed by my app (django).If I configure my app to have persistent connections and I put wait_timeout (i.e 60) in the config of the cloud sql, the error is:
"aborted connection - Got timeout reading communication packets".
I just determined that it's not a problem with sql cloud, or with the configuration of my application, but that it's an app engine problem. I came to this conclusion in the following way:
if I connect to the sql cloud instance through Mysql workbench, no connection is aborted
Similarly if I run my application on a local server, but connecting to cloud sql (through the cloud_sql_proxy), no error is generated and everything works perfect.
So my conclusion is that it is a problem of how the app engine connects to the cloud sql instance.
Why does this happen? How could it be solved?
The "Aborted connection" messages you're seeing, are usually triggered when a connection is closed improperly or there is a networking anomaly between the server and the client.
Sometimes Cloud SQL instances and GAE have long-live idle connections. In order to address this issue, it is recommended to set "wait_timeout' flag below 600 seconds - as you've already attempted to do so.
Another possible solution, is to implement application-level keepalives. SQLAlchemy provides “pre-ping” for this. Otherwise, generate activity on all open connections by sending a simple SQL statement such as "SELECT 1;" regularly, at least once every 5 minutes. Also consider using statements in your code like “with db.connect() as conn:” to control the connection’s lifetime.
I believe this is because requests from App Engine applications to Cloud SQL are subject to the following time and connection limits:
For apps running in the App Engine standard environment, all database requests must finish within the HTTP request timer, around 60 seconds. For apps running in the flexible environment, all database requests must finish within 60 minutes.
Offline requests like cron tasks have a time limit of 10 minutes.
Requests to Cloud SQL have limitations based on the scaling type of the App Engine module and how long an instance can remain in memory (residence).
Each App Engine instance running in a standard environment cannot have more than 60 concurrent connections to a Cloud SQL instance. For applications written in Java 8 or Go 1.8, the limit is 100.
Connection Issues: If you see errors containing "Aborted connection nnnn to db:", it usually indicates that your application is not terminating connections properly. It could also be caused by network issues. This error does not mean that there are problems with your Cloud SQL instance.

Communications link failure when connect to Google Cloud SQL(second gen) only from prod

Setting up a google cloud platform app with google cloud sql and for the life of me I cannot get a connection to the db when I run the code from google servers.
Following this example: https://cloud.google.com/appengine/docs/java/cloud-sql/?csw=1
I've gotten the non production url constructed properly and can connect with no issues to the cloud sql with this url
Class.forName("com.mysql.jdbc.Driver");
url = "jdbc:mysql://<ip-address>:3306/<database>?user=root";
So that's all good. This is the url I'm building for the prod connection.
Class.forName("com.mysql.jdbc.GoogleDriver");
url = "jdbc:google:mysql://<project-id>:<cloud sql instance name>/<database>?user=root";
I got the Project ID from the dashboard and the Instance ID SQL Instances List, database is the same as the non prod value and since non prod works I'm confident that's alright
Product and Instance ID locations I pulled them from
After deploying it all out I get the error message:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
appengine-web.xml does have use-google-connector-j set to true and I saw that for the second generation cloud sql you do not need to specify your app on the authorization list in cloud SQL.
Any help would be appreciated
https://cloud.google.com/sql/docs/dev-access#gaev1-csqlv2-connect
You should look at "instance connection name" in "Instance details" of your instance. For second generation, it's "project-id:region-name:cloud-sql-instance-name", not "project-id:cloud-sql-instance-name" as in the first generation.
When trying to connect to GCP SQL from google cloud run, do not forget to enable connection to GCP SQL from the google cloud run service level settings.
Having the setting disabled (default) can also cause the communications link faulure error.

SignalR performance drops when SQL Server Service Broker is turned on

I am trying to setup SignalR for use in a load balanced environment with two web servers behind a load balancer and a separate database server.
I am using the SQL Server Backplane. As recommended in the official documentation, I at first turned on the Service Broker for the database. I observed that with the Service broker turned on Messages take much longer to get pushed from server to client. Why would this be the case ?

apache web server for replication of web traffic to 2 app servers

I have 2 application servers, one is the real production server and another a "backup" server which can go live if the production app server is down. I want an apache webserver which will send incoming requests to both application servers. I do not expect the apache web server to crash, so am fine with "single point of failure".
I know that apache has a mod_proxy_balancer module, but can it be used for replication rather than load balancing? 99% of my http traffic is from some remote devices which do not need any kind of ui. UI is only used for maintenance and reports.

Resources