Friday, 27 January 2023

Cattle and Pets

A term we hear a lot is systems are either Cattle or Pets.  But what does this really mean? What makes a system a “pet“ and what makes a system “cattle” and why is everyone trying to have cattle? Aren’t we all supposed to be eating less meat?

Okay so it has nothing to do with meat, and I am sure, as I explain it many farmers would disagree with the analogy, however like it or not, it does seem to have become a term that is ingrained in IT today.

What are “Cattle” Systems?

For a system to be considered “Cattle” it must be deployable and rebuildable, so, for example, it is created using something like Terraform, it is configured by something like Puppet and it contains no specific data.  To use another buzzword, it should be ephemeral.

This means it is replaceable/deployable automatically.  And ideally, it is part of a group, even better a load-balanced or auto-scaling group so an instance can disappear and be replaced with no interruption of service.  It can appear to increase resources when the load is high and then disappear again.

There is no need to back it up, it can be recreated automatically and holds no data so why would you?

There is a need for anyone to log in by hand and do anything, so you won’t need to be able to log in to the operating system.

There is no need to patch the system, you can just deploy a new version of the system with a later operating system. Perhaps even using the “blue green” deployment methodology to run a rolling update.

A system can disappear, and the workload just keeps on running, with no interruption of service.

This all sounds wonderful; it is the brave new world … however is it achievable? Let’s think about what makes a system a pet…

What makes a system be classed as a “Pet”?

A pet system has special needs, it has most likely been touched by hand to make it perform its functions and it is a requirement of a system if it is missing then things don’t work.  To recreate it some processes or configurations might have to be done.  Perhaps if it is restarted it has to have a human log into it and change some stuff or start something. If it was to vanish a workload would fail, and an outage will occur.

The system needs to be backed up as it holds some data that changes. To update it you need to patch the operating system and then test the application in lower environments

To be classed as a pet you just have to fall at one of these hurdles really, not all of them, just one may make your system a pet.

Traditional systems

For the last 20 years most systems that have been created have been pets, they were all special and had special needs.  Their needs would be known and documented, and system admins would install, configure and start things as required.  Systems had checks running to make sure everything that had a special process had that process running to deliver what was required. 

Why can’t we just change our Pets to Cattle?

There is only so far you can go in the process to change a Pet system into a Cattle system, To a degree, they can be automated in creation and rebuildable, but they may still not achieve “cattle” status.  At some point you have to redesign or reengineer the workloads; applications, services, and processes running on these systems to be able to make the resources that run them be indeed cattle

No comments:

Post a Comment