Definitive documentation for orientjs connection lifecycle management in a nodejs server application

116 views
Skip to first unread message

Eric24

unread,
May 22, 2016, 11:09:07 PM5/22/16
to OrientDB
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?


Jovica Aleksic

unread,
May 1, 2018, 9:41:51 AM5/1/18
to 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..

Fabrice Martellucci

unread,
May 2, 2018, 5:22:26 AM5/2/18
to orient-...@googlegroups.com
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. :-)

--

---
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages