Confirming Heroku Preboot - heroku

My Question:
If I see these lines in heroku logs, does that imply that preboot is disabled? If not, why not?
2015-02-04T14:48:00.674205+00:00 heroku[web.1]: State changed from up to starting
2015-02-04T14:48:00.720515+00:00 heroku[web.2]: State changed from up to starting
My understanding is that preboot should fire up brand new dynos, get them ready to serve requests, start routing requests to them, then shut down the old dynos. Nowhere in that process would I imagine dynos changing from up to starting.
The Background:
I'm working on a deploy script that automatically toggles preboot depending on whether any database changes will be made. In testing the script, I'm watching the logs hoping to determine whether preboot is actually being used when it should. I see preboot turning on in the console output of my script:
Enabling preboot for <snip>... done
Yet in the logs I am seeing what I pasted at the top. I'm trying to reconcile these facts.

One way to verify this is to watch the dyno ID number change. You can see the dyno ID by adding log-runtime-metrics to your app.
source=web.1 dyno=heroku.2808254.d97d0ea7-cf3d-411b-b453-d2943a50b456 sample#load_avg_1m=2.46 sample#load_avg_5m=1.06 sample#load_avg_15m=0.99
You can watch for that "dyno" value to change once the new dynos are accepting requests.

Related

Does Heroku preboot halts the rollout if the newly created dynos fail to serve successful requests?

From Heroku preboot docs:
When you make releases with preboot, Heroku switches the routing from the old dyno to the new dyno at one point. It is possible to have a very short time overlap where the requests go to both dynos during the switchover.
Instead of stopping the existing set of web dynos before starting the new ones, preboot ensures that the new web dynos are started (and receive traffic) before the existing ones are terminated.
I couldn't find anywhere stating if the new dynos need to be healthy (serving successful requests) before the rollout successfully completes or what happens otherwise.
Documentation: https://devcenter.heroku.com/articles/preboot

Stop Heroku Dyno from cycling

I have a Hobby Dyno that hosts an application in Heroku in which users can upload images.
What I've noticed is the Dyno restarts during his cycle causing all images to be gone.
2018-07-27T16:23:09.914767+00:00 heroku[web.1]: Cycling
2018-07-27T16:23:09.915421+00:00 heroku[web.1]: State changed from up to starting
I am aware of solutions that involve a third-party storage or host the app in another platform altogheter.
I am wondering if there is a way to stop a dyno cycle and never make it restart such as is always in the up state?
Thank you.
There is no way to prevent dyno cycling. Heroku does this automatically at least once per day.
Heroku's entire design is based on The 12-Factor App, which states that your app's processes are disposable. Heroku accomplishes this (in part) with its ephemeral file system, which is why you must persist files using an external service.

Heroku dyno automatic restart - are the stopped functions preserved?

I have two web dynos in my heroku app, and at times get a dyno automatic restart (as per heroku policy). Is the function that was going on during the restart automatically restored in the new restarted dyno? If not, is there a way I can control this restart?
Is the function that was going on during the restart automatically restored in the new restarted dyno?
no
If not, is there a way I can control this restart?
no
What you can do, is trap the SIGTERM signal that is sent to your process 10 seconds before it is SIGKILLed. This would give you time to finish current computation, stop taking web requests, do cleanup, etc. More details on the process is in the Heroku Devcenter.

How can I push to Heroku, and still keep the web app live?

Say for example you had two web dynos set up for your account (0 worker dynos).
To save on switching to maintenance mode, how would one push to one web dyno, and then the other update once the first has finished booting?
You can't do that - pushing to Heroku will result in both dynos being restarted with the contents of the new slug.
However, there is a labs feature called preboot (https://devcenter.heroku.com/articles/labs-preboot) which might accomplish exactly what you want.

Is there any down time when committing to a clojure app running on Heroku?

Is there any potential downtime when I do a commit to a clojure/Java app running on Heroku?
I am guessing not - but can't find out for sure.
Thanks.
When you push to Heroku, you invoke the slug compiler, which does all the heavy lifting needed to turn your application into a self-contained archive. That can take a little while, as you see whenever you run git push. However, during this time, your application is running normally.
When your slug finishes compiling, Heroku then pushes it out to the dyno grid. This causes existing web dynos to stop and causes new ones to start. Your application will be unresponsive between the time that the old dynos stop and the new ones begin serving requests -- probably only a few seconds. During this interval, Heroku's routing layer will queue incoming requests.
TL;DR: users might notice a pause (but not an error!) as your application is updated. You can simulate this at any time by running heroku restart.

Resources