edgemicro: Increasing server.keepAliveTimeout value

etienned
Participant III

Hi,

What is the default values for server.timeout & server.keepAliveTimeout on the microgateway. (is it the node defaults of 2 minutes and 5 seconds respectively?)

Is it possible to change these values from the config file or do you have to change it on the node scripts and where should I change it if it is on the node scripts? I know in Node you can change it with adding a parameter like: server.keepAliveTimeout = 60000.

1 4 743
4 REPLIES 4

Target request time value in Apigee Edge Microgateway is configured using `request_timeout` parameter in its configuration file. Information on this can be found on the below documentation page:

request_timeout: Sets a timeout for target requests. The timeout is set in seconds. If a timeout occurs, Edge Microgateway responds with a 504 status code. (Added v2.4.x)

https://docs.apigee.com/api-platform/microgateway/2.5.x/operation-and-configuration-reference-edge-m...

As I see, there is no configuration parameter for setting the keep-alive timeout value. We may need to set it using Node:

https://github.com/apigee/microgateway-core/search?q=keepAlive&unscoped_q=keepAlive


etienned
Participant III

Thank you Imesh,

After searching for a while it looks like there is no default Server.timeout and server.keepAliveTimeout within the microgateway, I see that the gateway uses "net" and not "http" as an API framework. Server.timeout and server.keepAliveTimeout is from using "http".

const net = require('net');

The "net" framework states the following

socket.setTimeout(timeout[, callback])[src]#


Added in: v0.1.90


timeout <number>callback <Function>Returns: <net.Socket> The socket itself.
Sets the socket to timeout after timeout milliseconds of inactivity on
the socket. By default net.Socket do not have a timeout.

When an idle timeout is triggered the socket will receive a 'timeout'
event but the connection will not be severed. The user must manually call
socket.end() or socket.destroy() to end the connection.

socket.setTimeout(3000);
socket.on('timeout', () => {
  console.log('socket timeout');
  socket.end();
});

If timeout is 0, then the existing idle timeout is disabled.

So I assume you can probably add it in the json-socket.js like below

var JsonSocket = function (socket) {
  this._socket = socket;
  this._contentLength = null;
  this._buffer = '';
  this._closed = false;
-->  socket.setTimeout(3600);
  socket.on('data', this._onData.bind(this));
  socket.on('close', this._onClose.bind(this));
  socket.on('err', this._onError.bind(this));
};

Value of the fundamental portion is filled for the automatic use of the offs for the individuals. It is sharply followed for the use of the https://aussiessayservices.com/au-edusson-com-review/ for all depictions for the humans. The slot is opened for the meaningful means and all offers for the parked items for the candidates and all offers for the candidates in the territory of the writing for the students.

Not applicable