在Express.js/Web应用程序中管理OrientDB连接的最佳实践 [英] Best practice for managing OrientDB connections in Express.js / Web Applications
本文介绍了在Express.js/Web应用程序中管理OrientDB连接的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Express.js或任何Web应用程序中,用于管理 OrientDB 连接的推荐方法是什么?每个请求的连接?将使用 oriento Node.js驱动程序
What is the recommended way to manage OrientDB connections in Express.js or any web application for that matter? Connection per request? Would be using the oriento Node.js driver
推荐答案
If you are using Oriento, you can try connection pooling, as per PR #7 you can set it like this:
var server = Oriento({
user: 'root',
password: 'foo',
pool: {
max: 10 // use a maximum of 10 sockets in the pool
}
});
请记住,由于 orientdb中带有线程安全性的问题[...] (
Please bear in mind that at some point connection pooling config was hidden from Oriento's README due to issues with thread safety [...] in orientdb (reference). You may want to clear that before using it.
这篇关于在Express.js/Web应用程序中管理OrientDB连接的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文