Microservices facts for kids
Imagine building a giant robot. In the old way, you'd build one huge robot that does everything: walks, talks, cleans, and cooks. If one part breaks, the whole robot might stop working. Also, if you need it to cook faster, you have to upgrade the whole robot, which is hard!
Microservices are like building a robot out of many smaller, specialized robots. One tiny robot just walks, another just talks, another just cleans, and another just cooks. They all work together. If the cooking robot needs to be faster, you just upgrade or add more cooking robots without touching the others. This makes everything easier to manage and faster to change!
Contents
What is Software Architecture?
Software architecture is like the blueprint for a computer program. It shows how different parts of the program are put together. Think of it as the design plan for a house. It tells you where the kitchen, bedrooms, and bathrooms go.
Old Way: The Layered House
In older computer programs, the design was often "layered." Imagine a house with three main floors:
- Top Floor (User Interface): This is what you see and click on, like a website or an app screen.
- Middle Floor (Application Logic): This is where the program does its thinking, like calculating numbers or checking rules.
- Bottom Floor (Data Access): This floor connects to where information is stored, like a giant digital filing cabinet (a database).
These layers often ran on a big central computer called an "application server." This server handled all the different jobs of the program.
Why the Old Way Had Problems
- Hard to Grow: If many people used the program at once, the big server could get slow. It was hard to make it handle more users without a lot of effort.
- Uses Lots of Power: These big servers needed a lot of computer power and memory.
- Stuck Together: The different parts of the program were often tightly connected. If you changed one small part, it could accidentally break another part.
How Microservices Work
Microservices are a newer way to design computer programs. Instead of one big program, you have many tiny, independent programs. Each microservice does only one or two very specific jobs.
Small, Focused Jobs
Think of our robot example again. Instead of one giant robot, you have:
- A "walking" microservice.
- A "talking" microservice.
- A "cleaning" microservice.
- A "cooking" microservice.
Each of these small services still has its own tiny "top floor" (user interface part), "middle floor" (logic part), and "bottom floor" (data access part).
How They Talk to Each Other
These small services need to communicate to work together. They often talk using a special language called RESTful service calls. It's like sending quick, simple messages back and forth. For example, the "cooking" microservice might ask the "ingredient list" microservice for what it needs.
Running Many Copies
Microservices usually run inside special software called an "application container." If many people suddenly need the "cooking" service, the container can quickly make many copies (or "instances") of that cooking service. This means the program can handle a lot more work without slowing down.
Benefits of Microservices
- Easy to Scale: If one part of your program gets very busy, you can just add more copies of that specific microservice. The rest of the program isn't affected.
- Flexible: You can update or fix one microservice without affecting the others. This makes it faster to add new features or fix problems.
- Less Resource Hungry: Each small service uses fewer resources than one giant program.
- Independent: Because they are separate, if one microservice breaks, the rest of the program can often keep working.
Microservices help build programs that are more flexible, easier to manage, and can grow much better as more people use them.
See also
In Spanish: Arquitectura de microservicios para niños