Communication between two processes on geroku (which port to use)

I have a Procfile file:

web:     bundle exec rails server -p $PORT
em:      script/eventmachine

The process emfires eventMachine using start_server(port ENV['PORT']), and my web process sometimes needs to communicate with it.

My question is, how does the web process know which port it is talking to? If I understand the hero correctly, he assigns you a random port when the process starts (and it can change if ps is killed or restarted). Thank!

+5
source share
3 answers

Processes are isolated and cannot communicate directly with each other.

http://www.12factor.net/processes

, , . - , ​​ Redis, Postgres, - - FIFO .

http://en.wikipedia.org/wiki/FIFO

, , , .

+3

Heroku,

, , TCP/IP, , .

, , TCP/IP. memcached Heroku .

+1
source

All Articles