Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notes #1

Open
wants to merge 1 commit into
base: sources
Choose a base branch
from
Open

Notes #1

wants to merge 1 commit into from

Conversation

vfarcic
Copy link

@vfarcic vfarcic commented Aug 20, 2018

No description provided.

@joostvdg
Copy link
Owner

@vfarcic reshaped the outline, what do you think?

Gracefully Shutting Down Applications in Docker

I'm not sure about you, but I like it when my neighbors leave our shared spaces clean and don't take up parking spaces when they don't need.

I firmly believe that applications which do the same - release their resources and close down their connections - are also more excellent neighbors than those that don't.

There is Docker in the title for a reason, as I want to explain how your Docker application can be a good neighbor by cleaning up its mess or Gracefully Shutdown.

The Case For Graceful Shutdown

  • processing your notes

Start Good So You Can End Well

  • (How to run processes in Docker)
  • connecting How to run processes in Docker to the central theme:

Your Docker container is in the end, a container for a process. If your container wants to be a good neighbor, it should start in such a way that Docker and orchestrators such as Kubernetes can shut it down well.

As we say in Dutch: a good beginning is half the work. We will start with how you can run a process in a Docker container that is beneficial to Graceful Shutdown.
....

Make Sure Your Process Listens

  • (How to run processes in Docker)

Your process starts and can be told to shut down. Great, but does your process listen? Can it interpret the message it gets from Docker or Kubernetes? And if it does, can it relay the message correctly to its Child Processes?

Some processes do, but many aren't designed to listen or tell their Children. They expect someone else to listen for them and tell them and their children - process managers.

If you're still reading this, I assume you want to know how to take of these signals. There are two ways:

we let Docker manage the process and its children
we use a process manager

How To Be Told What You Want To Hear

  • (Signals management)

You've made it this far; your process now starts knowing it can be talked to, it has someone who takes care of listening for it and its children. Now we need to make sure Docker or Kubernetes tells us what we want to hear.

...

How To Be Told When You Want To Hear It

Our process now will now start knowing it will hear what it wants to hear. But we now have to make sure we hear it when we need to hear it. An intervention is excellent when you can still be saved, but it is a bit useless if you're already dead.
...

@vfarcic
Copy link
Author

vfarcic commented Aug 25, 2018

Gracefully Shutting Down Applications in Docker

I like the analogy with parking lots. However, I'd extend it with a disaster scenario as well. If we do not close the apps gracefully, we loose connections, do not respond to ongoing requests, and so on. What would be the parking spaces analogy? Something related to towed cars? Angered drivers destroying abandoned cars? I'm not sure what is the right analogy but I do think that it should be more complete since abrupt shutdown of applications is more than leaving mess, it has serious negative effects.

Also, don't forget to mention Kubernetes if you'd still planning to use it in the rest of the article.

The Rest of Sections

This is excellent. I enjoyed reading it and I felt I wanted to know more. It really captures ones attention. Great work!!! (I rarely say that to anyone).

@joostvdg
Copy link
Owner

joostvdg commented Sep 5, 2018

An analogy for cleaning up your resources.

I'm not sure about you, but I like it when my neighbors leave our shared spaces clean and don't take up parking spaces when they don't need.

Imagine you live in an apartment complex with the above-mentioned parking lot. Some tenants go away and never come back. If nothing is done to clean up after them - to reclaim their apartment and parking space - then after some time, more and more apartments are unavailable for no reason, the parking lot fills up with cars which belong to no one.

Some tenants did not get a parking lot and are getting frustrated that none are opening up. When they moved in, they were told when others leave, they would be next in line. While they're waiting, they parked outside the complex. Eventually, the entrance is blocked and no one can enter or leave. The end result is a completely unlivable apartment block with trapped tenants - never to be seen or heard.

If you agree with me that if a tenant leaves, the tenant should clean the apartment and free the parking spot to make it ready for the next inhabitant; then please read on. We're going to dive into the equivalent of doing this with Docker!

@vfarcic
Copy link
Author

vfarcic commented Sep 7, 2018

That text is brilliant.

The only thing you might want to change is the last sentence. Are you going to dive into the equivalent of doing this with Docker or with Kubernetes, or both? You might, for example, want to change it to containers.

joostvdg added a commit that referenced this pull request May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants