|
How would one manage database state under Node.js?
Thanks for your replies, Aaron and Kevin.
Aaron, there was a tickle in the back of my brain of there being an
additional interface to XMLSERVICE via Node.js DB access. But the dots were
not connecting in my mind. I found the following reference which
corroborates the information you shared:
https://www.ibm.com/developerworks/ibmi/library/i-native-js-app-ibmi-with-nodejs/
Figure 2. Node.js for IBM i infrastructure, was particularly illustrative.
I'll assume for the moment that the diagram labeled "Node.js Toolkit for
IBM i" uses the XMLSERVICE REST Web Services interface. As an alternative
it seems pretty clear that the diagram labeled "DB2 for i Access Library",
uses the SQL CLI interface.
I'd like to throw out another question. In my experience, complex business
applications rely quite a bit on the "state" of database tables being
maintained for paging and other purposes. How would one manage database
state under Node.js?
Kevin, your comment about pulling data off a data queue and handling
"blocking" issues with child processes sounds interesting. If I understand
correctly you're expressing a concern about "blocking". But I don't
understand the part about child processes.
I thought I read somewhere that although Node.js runs under one process, it
uses threads internally, so that say DB I/O blocking does not adversely
affect its handling of multiple concurrent HTTP connections. Or is there a
problem?
On Thu, Aug 27, 2015 at 2:10 PM, Aaron Bartell <aaronbartell@xxxxxxxxx>
wrote:
You are correct, you don't *need* Apache. Apache is just one way to get(effectively
around the DB2foriAccess blocking issue (or dataqueue blocking, in your
case). Good idea on using child_process. I wonder how well a database
connection would work doing the same. Or maybe even a guy could route an
entire request from start to finish to their own child_process
an IBM i job) as a means to release the primary Node.js thread to receiveand
in the next connection. That's potentially a lot of jobs :-( That's one
advantage of the Apache approach is the Node.js processes wouldn't end
instead stay "alive" to process the next request (a lot like RPG CGI).article
A complete side note, though on the blocking/non-blocking topic...
The following book helped me gain perspective on how and when things in
Node.js becoming blocking in nature. The book is more like a long
and is a quick read. The guy had a lot of the same questions I had andoff
cleared up a lot of questions.
http://bit.ly/node-beginner-book-manuel-kiessling
Aaron Bartell
litmis.com - Open Source and IBM i. No Limits.
On Thu, Aug 27, 2015 at 2:56 PM, Kevin Turner <
kevin.turner@xxxxxxxxxxxxxxxxxxxx> wrote:
I am using node.js and the IBM I toolkit and there is no Apache code in
the mix as far as I know. I am running a node server that pulls data
aworker
data queue. That is also a blocking process so I am using a child
tocan
do the job (basically a thread) using child_process.wrote:
On 27 Aug 2015, at 21:15, Aaron Bartell <aaronbartell@xxxxxxxxx>
youstored
You are correct that XMLSERVICE can be used in two ways - database
procedure and REST HTTP calls.
When doing 1-tier scenarios (i.e. Node.js is on same IBM i as the DB2
are after) then the stored proc approach is best (a lot faster). If2-tier
(Node.js is running on Linux or other) then the REST HTTP approach
beadapter
used.
The XMLSERVICE DB stored proc approach is using the Node.js DB2
nowhich is written in C and calls the SQL CLI APIs directly. There is
mine...Node.jsODBC or JDBC or MySQL layer in-between.respectively:
Here's the scenarios I have for calling RPG and accessing DB2,
Browser<==>Apache<==>Node.js/Ruby<==>toolkitfori**<==>RPGthough
Browser<==>Apache<==>Node.js/Ruby<==>db2foriaccess***<==>DB2
It's worth nothing that Apache isn't required in all circumstances,
right now it is somewhat a necessity since the DB2foriAccess for
is
blocking.
**http://bit.ly/nodejs_toolkitfori
***http://bit.ly/nodejs_db2foriaccess
What type of application code do you run under Node.JS?procedures?
What type of application code do you run under IBM i programs and
This is where opinions can greatly differ, and I will offer up
the<open-source-language>- You get significantly faster development if your
RPG".can go directly to the DB. Here's where some will say "I don't trustthose
Node.js devs, so they have to obtain all of their data via calls to
canBig productivity killer. Big slow-down in finding bugs. etc.
- It is wise to re-use existing RPG business logic because rewriting
take long enough that the time savings of going with<open-source-language>
would be lost. The toolkitfori (aka the XMLSERVICE interface forNode.js)
is an excellent stop-gap. My customers have a mix of logic in
<open-source-language> and RPG.
- How much logic you put in <open-source-language> depends a lot on
haveshop's future direction. For example, I have some customers that
ofleadsdetermined <open-source-language> is their new direction and will
eventually replace the majority of their existing code base. This
them to leverage existing RPG with XMLSERVICE *sometimes*, but a lot
(thinklogic is being put into <open-source-language>.
- <open-source-languages> have excellent packaging capabilities
Order*SRVPGMs on steroids). For example, you could keep your Node.js
adoptinginProcessing business logic in a Node Package Module (npm) and store it
athat
private repository. Then in your apps you could simply include thatOrder
Processing npm in the package.json file as an application dependency
basegets installed and updated in simple fashion (i.e. npm installapproach
order_processing, npm update order_processing).
- It's very interesting to read about Walmart Labs and how they've
adoption of Node.js. They have the same legacy issues as the IBM i
(their legacy is old-school Java Struts/Servlets from 10+ yrs ago).
Very good questions. These are the types of things every shop
Interface).open source needs to ask and spend some time doing tests.
Aaron Bartell
litmis.com - Open Source and IBM i. No Limits.
On Thu, Aug 27, 2015 at 1:33 PM, Nathan Andelin <nandelin@xxxxxxxxx
wrote:
My understanding is that XMLSERVICE provides 2 interface options for
various language environments:
1. XMLSERVICE via. ODBC / JDBC stored procedure calls (DB2
Interface).
2. XMLSERVICE via IBM i Apache-CGI calls (REST Web Service
intendedforI'll
Since Node.js has an excellent reputation for supporting socket I/O,
assume for the moment that the IBM i implementation makes calls to
XMLSERVICE via the REST Web Service Interface. But does anyone know
undersure?
The flow in my mind goes as follows:
Browser <==> Node.JS HTTP & Application Interfaces <==> IBM i Apache
Interface <==> XMLSERVICE CGI <==> IBM i SQL and PGM resources.
Does that sound about right?
If so, what would be good guidelines for structuring applications
mailingthis flow?
What type of application code do you run under Node.JS?
What type of application code do you run under IBM i programs and
procedures?
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailinglist--
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
___________________________________________
This email has been scanned by iomartcloud.
http://www.iomartcloud.com/
________________________________
NOTICE: The information in this electronic mail transmission is
copyingby CoralTree Systems Ltd for the use of the named individuals or entityto
which it is directed and may contain information that is privileged or
otherwise confidential. If you have received this electronic mail
transmission in error, please delete it from your system without
or--------------------------------------------------------------------------------
forwarding it, and notify the sender of the error by reply email or by
telephone, so that the sender's address records can be corrected.
mailing
CoralTree Systems Limited
Company Registration Number 5021022.
Registered Office:
12-14 Carlton Place
Southampton
Hampshire
SO15 2EA
VAT Registration Number 834 1020 74.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
--list--
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.