Eric24
2016-05-23 03:09:06 UTC
Forgive me, because I know this question has been asked before, but it has
never really been answered (that I could find after a significant time of
searching).
I fully understand the basic sequence of events need to use orientjs:
instantiate the driver, connect to a server, select a database, execute one
or more queries, and close the database (and/or connection), but what isn't
clear is exactly what should be done when, in a nodejs server application,
particularly with regard to how to manage the orientjs connections during
the HTTP request lifecycle. A simple example of using orientjs with
express.js, would be great (all of the examples in the orientjs git
repository and every other code example that I've been able to find just
show code snippets that don't fully describe these details). But short of
an expressjs example, which of these functions should be called when?
1. create server object from OrientDB
2. create db object from server.use
3. use db object (potentially more than once in a given HTTP request
cycle)
4. close db
5. close server connection
Is it this?
1. [during initialization; before the HTTP request handler is invoked]
create server object from OrientDB
2. [during initialization or within (at the top of) the HTTP request
handler, for every individual request] create db object from server.use
3. [within the HTTP request handler, for every individual request] use
db object (potentially more than once in a given HTTP request cycle)
4. [upon shutdown or within (at the end of) the HTTP request handler,
for every individual request] close db
5. [upon shutdown or within (at the end of) the HTTP request handler,
for every individual request] close server connection
Also, it appears to me that connection pooling is always enabled on
orientjs 2.2 (with a default max of 5 connections); correct?
never really been answered (that I could find after a significant time of
searching).
I fully understand the basic sequence of events need to use orientjs:
instantiate the driver, connect to a server, select a database, execute one
or more queries, and close the database (and/or connection), but what isn't
clear is exactly what should be done when, in a nodejs server application,
particularly with regard to how to manage the orientjs connections during
the HTTP request lifecycle. A simple example of using orientjs with
express.js, would be great (all of the examples in the orientjs git
repository and every other code example that I've been able to find just
show code snippets that don't fully describe these details). But short of
an expressjs example, which of these functions should be called when?
1. create server object from OrientDB
2. create db object from server.use
3. use db object (potentially more than once in a given HTTP request
cycle)
4. close db
5. close server connection
Is it this?
1. [during initialization; before the HTTP request handler is invoked]
create server object from OrientDB
2. [during initialization or within (at the top of) the HTTP request
handler, for every individual request] create db object from server.use
3. [within the HTTP request handler, for every individual request] use
db object (potentially more than once in a given HTTP request cycle)
4. [upon shutdown or within (at the end of) the HTTP request handler,
for every individual request] close db
5. [upon shutdown or within (at the end of) the HTTP request handler,
for every individual request] close server connection
Also, it appears to me that connection pooling is always enabled on
orientjs 2.2 (with a default max of 5 connections); correct?
--
---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.