简体   繁体   English

在Express.js / Web应用程序中管理OrientDB连接的最佳实践

[英]Best practice for managing OrientDB connections in Express.js / Web Applications

What is the recommended way to manage OrientDB connections in Express.js or any web application for that matter? 为此,建议使用什么方法来管理Express.js或任何Web应用程序中的OrientDB连接? Connection per request? 每个请求的连接? Would be using the oriento Node.js driver 将使用oriento Node.js驱动程序

If you are using Oriento, you can try connection pooling, as per PR #7 you can set it like this: 如果您使用的是Oriento,则可以尝试连接池,根据PR#7,您可以这样设置:

var server = Oriento({
  user: 'root',
  password: 'foo',
  pool: {
    max: 10 // use a maximum of 10 sockets in the pool
  }
});

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 ). 请记住,由于orientdb参考 )中的线程安全性问题,连接池配置有时在Oriento的自述文件中是隐藏的。 You may want to clear that before using it. 您可能需要在使用前清除它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM