Discussion:
[orientdb] Definitive documentation for orientjs connection lifecycle management in a nodejs server application
Eric24
2016-05-23 03:09:06 UTC
Permalink
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?
--
---
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.
'Jovica Aleksic' via OrientDB
2018-05-01 10:05:59 UTC
Permalink
I'm having very similar questions and issues finding proper examples or
documentation. Will be a typical learning-by-doing/trial-and-error
onboarding. Somewhat discouraging, especially when it comes to choosing a
stack for a serious/lengthy project..
Post by Eric24
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).
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.
Fabrice Martellucci
2018-05-01 15:28:39 UTC
Permalink
Me, the sample with on Angular 5, for testing multi instance application
client Angular 5 on asynchrone and charge can supported server Oriend .

the same question. :-)

2018-05-01 12:05 GMT+02:00 'Jovica Aleksic' via OrientDB <
Post by 'Jovica Aleksic' via OrientDB
I'm having very similar questions and issues finding proper examples or
documentation. Will be a typical learning-by-doing/trial-and-error
onboarding. Somewhat discouraging, especially when it comes to choosing a
stack for a serious/lengthy project..
Post by Eric24
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).
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
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.
Loading...