ibmdb/node-ibm_db

Slow response to retrieve 11577 records took 20sec

KalyanMolakalapalli opened this issue · 3 comments

Please provide below information while opening an issue to understand your problem

  • Operating System Name where ibm_db is installed: windows
  • Target Db2 Server Version or output of db2level command from Db2 database system:

For non-Windows system, output of below commands from terminal:

uname
uname -m
node -v
npm ls ibm_db
db2level
echo $IBM_DB_HOME
echo $PATH
echo $LD_LIBRARY_PATH $DYLD_LIBRARY_PATH

For Windows system, output of below commands from windows command prompt:

node -v 20.14.0
npm ls ibm_db ibm_db@3.2.4
db2level 2.7.1
echo %IBM_DB_HOME% node_modules\ibm_db\installer\clidriver
echo %PATH%
echo %LIB%

  • Value of any other ibm_db specific environment variable if in use.

Please provide below problem specific info:

=========================================

For Installation related issue

For Connection related issue - connection is good , retrieving the data from DB2 is taking 20 sec for 11K records

  1. Are you trying SSL connection or non-SSL connection?
  2. For SSL Connection, please read and follow this documentation
  3. For SSL connection, do you have ssl certificate from server?
  4. If you have certificate, are you using SSLServerCertificate keyword in connection string or using your own keystore db?
  5. Share the connection string used for connection by masking password.
  6. update database connection info in ibm_db/test/config.json file and share complete output of below commands:
  • cd .../node_modules/ibm_db
  • npm install
  • node test/test-basic-test.js
  1. For non-SSL connection, update connection info for db2cli validate command in file ibm_db/installer/testODBCConnection.bat for windows or ibm_db/installer/testODBCConnection.sh for non-Windows. Then execute testODBCConnection.bat from Administrator command prompt on Windows or testODBCConnection.sh script from terminal on non-Windows and share complete output of script along will all generated 1.* files in zip file.
  2. Complete output of db2cli validate command.

For SQL1598N Error

For other issues

  • Test script to reproduce the problem.
    var cn = "DATABASE=DB2D;HOSTNAME=zos.ais.ucla.edu;PORT=5025;PROTOCOL=TCPIP;UID=brxdev;PWD=br1xdev";
    // ibmdb.debug(true); // ==> ENABLE CONSOLE LOGS, but do not log params. <==
    // ibmdb.debug(2); // ==> ENABLE CONSOLE LOGS and log parameter values too if passed. <==
    ibmdb.open(cn, function (err, connection) {
    if (err)
    {
    console.log(err);
    return;
    }
    var query = ""
    onnection.query(query, function (err1, rows) {
    if (err1)
    console.log(err1);
    else
    console.log("numberof rows : " + rows.length);
    logger.info("after calling the query>>>>");
    Steps to Reproduce:

Can someone take a look into this issue and let us know what we should need to do to resolve the performance issue of ibm_db

@KalyanMolakalapalli I think you observe more time consumption for large data because nodejs need to store all data in memory as an object and then return to the caller. To avoid it, you can try prepare, execute and then fetch() in a loop as in the example of fetchSync() API here

Also, to avoid buffering of data in nodejs memory, you can use queryStream() API in your program as used in test-queryStream.js test file. Try these methods and let me know your observations. Thanks.

thankyou @bimaljha will work on the above solutions.