closuresOpenLink Virtuoso HTTP连接

我们使用OpenLink Virtuoso作为NodeJS项目的主要数据库pipe理器。 我们只通过HTTP SPARQL端点使用SPARQL查询来查询数据库。 为此,我们使用request-promise库,具有以下configuration:

const queryRequest = rp({ method: "POST", uri: queryObject.fullUrl, form: { query: queryObject.query, maxrows: queryObject.maxRows, format: queryObject.resultsFormat }, headers: { 'content-type': 'application/x-www-form-urlencoded' }, json: true, forever : true, // Keep connections alive instead of creating new ones timeout : Config.dbOperationTimeout, }) .then(function (parsedBody) { 

运行我们的testing时,我们启动应用程序(新的快速应用程序对象和nodejs服务器)数百次,并试图closures它干净。 应用程序closures,服务器也,但我认为,virtuoso连接保持开放,因为连接的数量不断增加,尽pipe我们正试图重用现有的连接。

close()方法(将应用程序closures)运行这些函数:

 const closePendingConnections = function(callback) { async.map(Object.keys(self.pendingRequests), function(queryID, cb) { if(self.pendingRequests.hasOwnProperty(queryID)) { self.pendingRequests[queryID].cancel(cb) //try to abort all requests in the queue } }, callback); }; const destroyQueue = function(callback) { self.q.destroy(callback); }; 

经过大约150次testing(启动和closures)后,查询开始失败并停止testing。 我们尝试使用队列来确保在给定的时间内,每个应用程序启动只有一个到virtuoso的连接处于活动状态。 打印挂起连接的数目在队列中不断显示0或1个请求,所以我知道这不是队列的问题。

运行这些testing之后,virtuoso分析器的屏幕截图如下:

在这里输入图像说明

有没有办法强制所有的HTTP连接到虚拟机closures后,每个服务器和应用程序closures,再次启动之前(因为我们必须为每个testing做这个)?