问题
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
回答1:
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
}
});
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.
来源:https://stackoverflow.com/questions/30522999/best-practice-for-managing-orientdb-connections-in-express-js-web-applications