Syntactic Fructose
Syntactic Fructose

Reputation: 20076

Does running on mulitple web dynos mean I have multiple server instances?

I'm a little bit confused about the whole dyno business with heroku . On their site, they define a dyno as:

A dyno is a lightweight Linux container that runs a single user-specified command. A dyno can run any command available in its default environment (what we supply in the Cedar stack) or in your app’s slug (a compressed and pre-packaged copy of your application and its dependencies).

This (somewhat?) makes sense in my head, but when I think about dynos in the context of multiple dynos running for one web app, my brain gets twisted.

Lets I'm building a web app with a server which runs a very important task only once every 3 hours for all users. If I am running multiple web dynos for this site, does that mean there is a separate server instance running on each dyno? And would that very-important-task that is run every 3 hours be run on each dyno every 3 hours?

Thanks a lot for any clarification!

Upvotes: 0

Views: 420

Answers (1)

Damien MATHIEU
Damien MATHIEU

Reputation: 32629

Each dyno is an LXC container running in one of the heroku instances. Depending of your dyno size, there might be other containers on the same instance or not.

But the rough idea is that yes, each dyno you have running is a different instance, and a task set to run on any web dyno each 3 hours will run on all of them.

You may want to look into the heroku scheduler addon. It will run a one-off dyno at a specified interval, allowing you to run cron-like tasks.

Upvotes: 1

Related Questions