High CPU Utilisation Issue due to more Open connections of Oracle NOSql

173 Views Asked by At

When running an NodeJs application with OracleNosql, found multiple connections are being open and not getting closed after execution. When there is a high throughput or request timeout issue case also the connections are opening large in count and not getting closed. Can anyone suggest how to control huge open connections between nodejs application and oraclenosql.

https://oracle.github.io/nosql-node-sdk/global.html#Config Here at this documentation too, could not find any max connection pool-size property configuration.

Edit1:

 public noSQLClient: NoSQLClient = new NoSQLClient({
        serviceType: ServiceType.KVSTORE,
        endpoint: env.DB_HOST
    });
2

There are 2 best solutions below

1
Yevgeniy P On BEST ANSWER

You can add httpOpt as follows:

public noSQLClient: NoSQLClient = new NoSQLClient({
    serviceType: ServiceType.KVSTORE,
    endpoint: env.DB_HOST,
    httpOpt: {
       keepAlive: true,
       maxSockets: 128,
       maxFreeSockets: 64,
       .....
    }
});

The particular numbers above are just as example.

Another thing that you can do is to set keepAlive to false (by default it is set to true currently):

public noSQLClient: NoSQLClient = new NoSQLClient({
    serviceType: ServiceType.KVSTORE,
    endpoint: env.DB_HOST,
    httpOpt: {
       keepAlive: false
    }
});

This will make sure that no free sockets are open, but may affect the performance.

0
George On

Make sure that your application shares a single NoSQLClient handle rather than creating more than one in the same process. And when you are done with it be sure to call its close() method to release resources.