Parse Server on Heroku Running on Web Worker Dynos - node.js

I am running a parse server on a heroku web dyno. I need to run a long requests on a worker dyno. Do I need to run two parse servers, one for web and one for the worker dyno?
How would one go about running worker dynos when working with parse? I see an example of a nodejs worker, but not sure if it applies to a parse server.

Related

Will requests get lost during initialization of Node.JS app on Heroku?

I have a Facebook Messenger bot written with Node.JS. Currently, it initializes the database (and cache) before initializing Express and receiving requests. I wonder if some requests are sent during initialization, will they get lost?
I'm using Heroku, it that matters.
For free or hobby dyno in heroku there is no zero-downtime setup or preboot as a feature available. While deployment, your Node.js dyno will not serve
the incoming request from the point it restarts the process on that dyno till your server is running successfully on the specified port.
If you have zero-downtime setup already, then your requests will be served by
previous deployed instance unless the new one is spawn and ready to serve.
here is reference link for more info. on zero-downtime heroku

Heroku stopping all processes with SIGTERM after HTTP request to another Heroku app

I recently deployed 2 different apps on free Heroku's dynos.
One is an API and the other one is an admin panel.Both are working with NodeJS. My admin panel needs to make calls on to this api.
Everything is working fine when I'm launching those apps on localhost and on different ports. But when I deploy them to Heroku, both apps are being shut down by Heroku with the same error saying: "Stopping all processes with SIGTERM" and "process exited with status 143"
Here are the error messages I got in the Heroku logs: Heroku logs
I tried to use the CORS package to the two apps, but the issue didn't change.
Some help or explanation would be appreciated. Thanks for your time !emphasized text
It's worth checking if this is expected behavior on the free dyno. I had one set up and switching to Hobby dyno fixed the issue. heroku node app exits after idling
this is due to inactivity, when there is a request on any endpoint heroku raises the dyno again
I confirm what Josué said, Eco dynos sleep automatically after a period of inactivity to conserve your dyno hours

Why is heroku so sluggish?

I deployed a very simple nodejs app using expressjs. It has a few routes and static content with no database connection or anything. The problem is the ridiculously slow response of service. This is the link:
nodejs app deployed on heroku
It literally takes 10 seconds to load up for the first time, though faster in next requests obviously because of cache. Do I need to add paid dyno or add-on to make it faster?
If your application is running on free dyno, it goes to sleep when unused for 30 mins. You could find the information here.
You could verify the sleep by checking the logs heroku logs --tail.
You could add additional dyno other than free type to make it not to sleep. Dyno Types

How can I keep a Node app running on Heroku which is not a server without providing $PORT?

I've written a web scraper using node.js which scrapes a particular website, gets some data from there and then tweets it. I've deployed this app on Heroku and app crashes by giving an error that $PORT couldn't be bound within 60 seconds. I've tried putting both worker: node index.js and web: node index.js in Procfile one by one, but it crashes.
Since my app is not a server hence does not need a port number, how can I keep it running with out making my app a server?
Turn on the worker process and off the default web process:
$ heroku scale web=0 worker=1
Take a look at the following link: http://pm2.keymetrics.io/docs/usage/use-pm2-with-cloud-providers/

Heroku multiple web processes

I am working with node.js and heroku and would like to have more than one webprocess running.
In the Procfile I have it looking like this:
web: node web.js
web: node differentWeb.js
However when I run it it will only run the last of the two. Is there a way to do this?
An application on Heroku can only have one process named web that gets routed HTTP requests. If you need another web process then that would be another application on Heroku.

Resources