暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle 节点可靠性问题

ASKTOM 2021-02-18
287

问题描述

我们正在使用Node-oracledb 4.0驱动程序为Oracle EBS 12.2和12.1开发rest api
我们按照Oracle Node文档中的示例代码片段打开连接池,关闭连接并执行查询。
我们正在使用Express Server,并注意到Node Server的一些可靠性问题。我们找不到确切的问题。

只是想问以下问题:
1.是否存在任何已知的可靠性问题?
2.Node-OracleDB驱动程序是否具有在生产环境中部署的能力?
3.目前我们在池中有50个开放的连接。我们有一些1000并发用户的客户端。我们如何将连接池扩展到这么多用户?
4.任何使节点可靠的最佳实践/案例研究?
5.ISG和节点之间的任何比较?由于我们有很多节点问题,我们正在考虑使用ISG开发应用程序。

感谢您的帮助,非常感谢。

查询执行代码:
const executeSQLQuery = (query, params, options = {}) => {
  return new Promise(async (resolve, reject) => {
      let conn;
      let throwTimeOutError = true;
      console.log('@@@@@  QUERY EXECUTING @@@@: ', query, params);
      try {
        console.log('connecting to pool...',oracledb.poolAlias);
        conn = await oracledb.getConnection('PoolConn122');
        //console.log('connecting to pool...',oracledb.poolAlias);
        console.log('connection details:',conn);  
        let result;
        setTimeout(()=>{
          if(throwTimeOutError){
            //console.log('came');
            reject({message:'Check whether Params and PLSQL Query are valid or not'});
          }
        },60000);
        result = await conn.execute(query, params);
        //console.log('executed');
        throwTimeOutError = false;
        resolve(result);
      } catch (err) {
        reject(err);
        throwTimeOutError = false;
        console.log(err,'coming');
      } finally {
        if (conn) { // conn assignment worked, need to close
          try {
            console.log('conn pool:',conn.getPool);
                       await conn.close();
            
            console.log('closing connection new SQL');
          } catch (err) {
            console.log(err);
          }
        }
      }    
     
  });
}


连接池:
module.exports = {    
    hrPool: {
      user: process.env.user || "xxxx",
      password: process.env.password || "xxxx",
      connectionString: process.env.connectionString || "xxxxxx",
      threadPoolSize: process.env.UV_THREADPOOL_SIZE || 60,
      poolMin: 50,
      poolMax: 50,
      poolIncrement: 0,
      queueTimeout:240000,
      poolAlias:'PoolConn122',
      _enableStats:true
    }
  };

API-服务:
async function getLocators(req, res, next) {
    let output;
    let query;
    let paramsForQuery;
    
    try {       
        const reqParams = req.params;   
        const reqQuery = req.query;
        if(null!=reqParams){
            query = masterDataQueries.getLocatorsQuery20D; 
            let model=getLocatorsModel20D;
            if(reqQuery.hasOwnProperty('system') && Object.is(reqQuery['system'],'CLD')){
                cloudApiResult = await modelutil.callCloudApi(req.url,model);
                  if(!cloudApiResult['error']){
                     res.status(200);
                     res.send(cloudApiResult['response']);
                     }
                 }
                 else{
                    paramsForQuery = modelutil.constructParamsForQuery(reqParams.orgId,
                        reqParams.lastSyncTime,
                        reqParams.isFullRefresh,
                     'Response');  
                   const result =  await sqlutils.executeSQLQuery(query,paramsForQuery);                

                   if(null!=result.outBinds.Response){
                   output = JSON.parse(result.outBinds.Response); 
//console.log("@@@@@@" , output);       

             if(null!=output.data) {                  
              output = output.data;
              output = modelutil.assignOutputToModel(model, output);              
              output = {
              ActiveLocators: output,
              success: true,
              }
               res.status(200);
               res.send(output);
            }else {                   
                 modelutil.showEmptyOutputInResponse(res);                    
                }
                }else { //when output is empty
                 modelutil.showEmptyOutputInResponse(res);                
                  }    
                 }
    
        }      
    } catch (error) {        
        const request = {
        params:req.params,
        body:req.body
    }    
    const errorHandlingDetails = modelutil.showErrorOutputInResponse(error,query,paramsForQuery,request);      
    res.status(errorHandlingDetails['status']);
   req.log.error(errorHandlingDetails['errorDetails']); 
   res.send(errorHandlingDetails['output']);       
    }
}



专家解答

1. Are there any known reliability issues?

节点驱动程序团队在此处为驱动程序保留更新的问题文档

https://github.com/oracle/node-oracledb/issues

2. Is the Node-OracleDB driver has the capability to deploy in the Production Environment?

是的。许多客户都在积极生产它。

3. Currently we have 50 open connections in the Pool. We have some clients with 1000 concurrent users. How do we scale the connection pool to this many users?

这里有很多关于如何正确利用池的信息;https://oracle.github.io/node-oracledb/doc/api.html#connpooling

4. Any best practices/case studies to make Node reliable?

一些关于这一切的好甲骨文博客

https://jsao.io/
https://blogs.oracle.com/opal/

5. Any comparisons between ISG and Node? Since we are having lot of node issues, we are thinking of developing apps using ISG.

我对ISG一无所知,但是如果您正在查看设施的REST启用,那么明显的候选对象不是Node或ISG,而是ORDS。这正是它的设计目的,

https://www.oracle.com/database/technologies/appdev/rest.html




文章转载自ASKTOM,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论