Would setting up Apache as a reverse proxy diminish the speed associated
with the NodeJS event loop?

I don't believe Apache would slow down the Node event loop because Node is
running within its own job.

Would the Apache web server slow down requests getting put into the queue
of the NodeJS event loop, or slow down the responses coming back from the
NodeJS event loop?

Yes, having anything in front of anything will slow it down, though I don't
believe it would be enough to worry about. I do not have any metrics (yet)
to point you at.

Here's the kicker: Are all the things you are doing non-blocking? Some
links to read:
- http://www.nodewiz.biz/your-doing-node-js-wrong-avoid-synchronous-code/
- http://www.aaronstannard.com/intro-to-nodejs-for-net-developers/

Here's some SO discussions on fronting Node.js with Apache/nginx:
-
http://stackoverflow.com/questions/16770673/using-node-js-only-vs-using-node-js-with-apache-nginx
-
http://stackoverflow.com/questions/9967887/node-js-itself-or-nginx-frontend-for-serving-static-files

On final note, I believe the idb2 Node.js adapter is blocking/synchronous.
I am researching confirmation on that. If true that means, in my mind, you
MUST have load balancing so separate jobs can process requests (much like
RPG-CGI) in true parallel.


Aaron Bartell
litmis.com - Open Source and IBM i. No Limits.


On Fri, Aug 21, 2015 at 12:23 PM, Kelly Cookson <KCookson@xxxxxxxxxxxx>
wrote:

Aaron,

Thanks again. I really appreciate the help.

I am a little curious about using Apache as a front-end (same as reverse
proxy?) for a web server or a REST service running in NodeJS. Would setting
up Apache as a reverse proxy diminish the speed associated with the NodeJS
event loop? Would the Apache web server slow down requests getting put into
the queue of the NodeJS event loop, or slow down the responses coming back
from the NodeJS event loop?

I'm asking, not suggesting. I have no idea. It would be nice to know why
it would slow things down or why it would not. Maybe it's not even a well
formed question.

Thanks,

Kelly Cookson
IT Project Leader
Dot Foods, Inc.
1.217.773.4486 ext. 12676
kcookson@xxxxxxxxxxxx



-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Aaron
Bartell
Sent: Friday, August 21, 2015 12:10 PM
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] Starting a node program so it keeps running without
interactive jobs staying open.

In its simplest form you can do the following. Eventually you will want
to add more options (i.e. start multiple instances on different ports for
load balancing with a front-ending Apache/nginx instance).

SBMJOB JOB(QSH CMD('/dir/start.sh'))

---start.sh---
#!/usr/bin/sh
cd /dir
node sample.js


Aaron Bartell
litmis.com - Open Source and IBM i. No Limits.


On Fri, Aug 21, 2015 at 12:04 PM, Kelly Cookson <KCookson@xxxxxxxxxxxx>
wrote:

I have developed a "hello world" web server using JavaScript and
NodeJS. I am starting the web server using interactive sessions. I
open a 5250 session, then open an interactive qshell session, then run
the following
command:

node /mydirectory/sample.js

When the "hello world" web server is running, there are three jobs
active:
1. My interactive 5250 session.
2. The qshell interpreter (QZSHSH)
3. A job that appears to be the node program (QP0ZSPWT).

But when I end the qshell session the node program (the QPOZSPWT job)
also ends. So my "hello world" web server is no longer running.

How do I get my "hello world" web server to run in NodeJS without me
having to leave an interactive qshell session open?

Thanks,

Kelly Cookson
IT Project Leader
Dot Foods, Inc.
1.217.773.4486 ext. 12676
kcookson@xxxxxxxxxxxx

--
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.

--
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 thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.