2026-09-09 14:57
Status:
Tags: IBM IBM Full Stack Software Developer Professional Certificate IBM Application Development using Microservices and Serverless Micro-Services Servers Back End DevOps
ADMS - Module 1- Introduction to Microservices
==Microservices Overview
-
Twelve-Factor App Methodology:
- Modern software development has shifted over from downloadable software that you need to have on your computer to something that is centrally hosted and accessed through the web
- this is known as SaaS (software as a Service), or as websites/web applications
- Twelve-Factor app methodology is well suited for these web apps, and while it can be set up without the use of microservices, it is generally used with them because of how well the two pair together
- Twelve Factor Groups, generally, you can group them according to these phases of the software delivery lifecycle
code --> deployment --> operations - Code factors:
- Factor 1: Codebase- the actual code base for your application, usually tracked with something like git or another version control system, and there is a one-to-one relationship between the codebase and the app
- Generally there can be multiple instances or deployments of the app, but only ever really one codebase, even if there are different versions within of that codebase, like
dev or testing - Factor 5 (wtf?): Build, Release, Run this is basically the portion where in which your code is made into the application. You first build your code into an image, may this be something like a
.exeor more likely for web applications, an image fordocker or kubernetes - Then, release is the configuration of the environment surrounding your application so that way it is ready for execution whenever someone needs it
- Finally, run is the actual running of the application, basically the runtime if you really think about it
- Factor 10: Dev/prod parity- this basically tries to make sure that the differences between production and development environments are as small as possible, which helps to file into that CI/CD pipeline basically
- It is good for making sure that there are little differences between the place the code is made, and the place it is used, leading to little errors
- Basically logical stuff like use the same backend for all services, use the same database version for all services, and things like that to made production smoother
- Factor 2: Dependencies basically, your application is only as reliable as it’s least reliable dependency, and the thing is that most times you do not have direct control over your dependencies either
- This therefore means that you need to b explicit with the dependencies that your application uses
- Deploy Factors
- Factor 3: Config this one basically says that you should keep everything that could vary between deployments (like credentials, service locations, and all that), inside of the config
- This keeps those possibly changing things from being hard coded into your codebase, and allows for your application to be more easily deploy-able
- The best place to store these kinds of things in are in the
.envfiles or in environment variables, which can be easily seen and changed without changing the codebase - Factor 4: Backend Services, in essence, these should not distinguish between local and third party-services, your back-end should be cohesive and in one piece, regardless of the outside tools it is using
- Access to all services should be available via a URL and credentials, so that way they can easily be swapped if need be
- This way if you have something like a failing database, you can just spin up another database and connect it without actually having to change any of the source code
- Factor 6: Processes these are sort of the things that make the function act and communicate, they should be RESTLESS and without state basically
- They do not share memory and filesystems, so all of those things should be stored in something like a database back-end service, and therefore, your data should be centrally stored so it is easier to access for these processes
- Factor 7: Port Binding basically, whenever you have yourself an application, you need to expose the services of it by binding it to a port instead of just having it openly take in from anywhere
- You should export HTTP or HTTPS through these ports, and they should listen for the incoming requests on these ports, 80 and 443 respectively
- This is generally done through a web server library (think of node or express or django), and then this library should be stated as a dependency
- Equally, because of the nature of this, this can become a back-end for other apps and services
- Operate Factors
- Factor 8: Concurrency this one seems to be mostly about the idea of scalability and containerization. With the fact that you can have multiple different portions of your application in a container environment in order to handle more load
- These processes should be stateless, and not dependent on one another
- At least not so in the sense that you cannot spin up more copies of each of the services whenever you need to
- Factor 9: Disposability this one is just that your applications should be quick to start up, and that they should be able to gracefully terminate as well
- This is good because it means you can make changes to your code faster, and wont have any problems left over after it shuts down
- Factor 11: Logs, generally, every application would need logs, but the application itself should NOT be responsible for the storing of the logs that it might create
- Instead, this should be treated as an event stream, in which you output logs and they are handled and changed/managed by your execution environment, routing them to their destination
- Factor 12: Admin Processes basically the admin portion of your application. Its a collection of one-off app management processes
- it runs against a release, using the same codebase and config as part of the actual application code, but it gives users with special credentials make key changes and managements to an application
-
What are Microservices:
- Microservices is an architecture where a given larger application is made up of a lot of different smaller, and independently functional services that come together to make an entire whole
- A good way to think of it is by separating out the search portion of an application with the watch portion of it, and then separating the recommendation portion out of all of that
- Instead of having all of these be a single monolithic application, they are all smaller and independent of one another, but can still communicate with each other and work together to create a functional app
- Each microservice might have it’s own tech stack, and would generally only really communicate with the other components using API endpoints
- Generally these are rest APIs, event stream, or other forms of messaging that allow for this kind of communication
- The way that a microservice is decided is based on logical or business logic
- The reason why this is generally useful is because you can have a bunch of different people working on different services at the same time, allowing each microservice to scale up as needed without needed to rework the entire code base
- This leads to easy independence from other portions of the application, as well as faster development with more focused and expert targeting
- Generally scaling is done with horizontal scaling, with something like more containers being created for that given service, because in essence, each of the microservices can act like it’s own application/container item that works with the others
- The use of this allows you to save on infrastructure in the long run, because you can actually host more direct expansions for your items instead of scaling your entire applications
-
Comparison of monolith vs. SOA vs. Microservices:
- Monolithic applications are ones where the code base basically all exists in a single process
- the way that this would work is think of something like a large game, the loading of the game, the rendering, the npc behavior, all of it is running in a single process
game.exewith a bunch of interconnected dependencies in the form of libraries - This is similar for a monolithic application, where you have every single process that is being done by the application in a single process, getting handled in a layer by layer format where everything is highly dependent on each other
- This makes it pretty simple to understand and work with, since everything is generally in one place, so deployment is easy
- the issue though becomes wanting to expand or scale the application, you have to do so for the entire application, which is inefficient and difficult, making it more and more complex
- A service oriented architecture these are basically designed and built in a service provider and then a consumer approach
- they are very specific and highly specialized, and essentially provide services that should be seamless and reusable
- They generally have multiple of these services and each one would have an interface, contract, and implementation
- This means that because it is all contextually drawn out, it makes it pretty reliable, and easily supports development alongside other people, but leads to a complex design of inter-working systems
- It is also generally expensive and good for enterprise teams with the cash
- A good example of this is basically a banking system, where you have existing applications that can be exposed to loosely coupled services that each correspond to a business function that allows for said applications to reuse them in order applications, this is pretty similar to SOA
- The only real difference is that things are not exactly as modular, and more detailed and business oriented
- Microservices are loosely coupled, specialized, and reusable components that work entirely independent of all of the others
- Even the data inside of them is not shared, like it might be in the SOA architecture, instead communication is done entirely through APIs and endpoints, allowing for easy scaling of your applications
- This also makes them all independent, allowing them to have their own text stacks
- This makes it very easy to work on, develop, update, and scale all of your applications
- Each service is flexible and scalable, meaning it is easy to update and use new technology within them as well
- The main drawback though is that you have a lot of attack services within of all of your applications, making security a lot more difficult
- Equally, due to the increased number of services, whenever something would go wrong in your application, you would have a harder time debugging because you do not know if it is from your own code or someone elses
-
Microservices Patterns:
-
Microservices have some of the more common challenges that someone might see:
- Single-page application (SPA)
- Backend for Frontend (BFF)
- Strangler
- Service Discovery
-
Single Page Application this is basically the concept that as computers got generally faster, we could just have a user load everything onto a single landing page
-
And then, instead of redirecting them for other forms of content to the other pages, just update the single landing page dynamically using the back-end and REST-based services
-
This in general makes the front-end experience much easier, both for the developer and the user, but in turn then places greater performance responsibility onto the back-end, which some might argue is a good thing
-
-
Backend for Frontend provides better support compared to this kind of a generic backend
-
it does so by inserting a layer between a user experience and the actual resources that they can access, which is good for whenever you do not want a streamlined experience, and instead want one that is customized for different channels of access
-
This for example is good if you want a difference between how an application acts on a desktop webpage vs a mobile webpage (think of how the midascloud particle simulation takes longer on mobile, this would fix that)
-
You develop different backends for different experiences based on where the use would be at, they can access the same services, but in different ways or in more limited amounts basically
-
-
Strangler this one basically refers to the idea/process where in which a larger monolithic application is replaced with a bunch of smaller microservices
-
It gets it’s name from a vine that slowly strangles a tree
-
Basically it takes the different functional portions of a larger monolithic application and then splits them up into different functional domains
-
Each of those domains is then basically split up into a new microservice to fill out that domain whenever needed
-
This allows for the monolithic application to slowly be converted into a micro-serviced one, where in which you then have the ability to not use the monolithic application anymore
-
Service Discovery this is basically a process that helps applications and services discover each other, which is very important in the case of micro-serviced applications where there are lots of differently scaling services inter-working together
-
It provides flexibility, and load balancers can use this as a means to perform health checks and rebalance traffic, they need to be able to know what is going on in order to do so, and thus service discovery helps out
-
==Summary
- Modern software development often delivers centrally hosted, web-based, software-as-a-service (SaaS) applications
- Twelve factor app methodology enables developers to create more efficient SaaS applications
- The twelve factors map to the code, deploy, and operate stages of the software delivery lifecycle
- Microservices make each application component its own service, and each service communicates via an API
- Microservices allow application components to use different technology stacks
- Microservices enable individual components to scale in response to demand
- Microservices lessen risks associated with change because components can iterate independently
- Failures in one service do not necessarily impact other services
- There are some anti-patterns to avoid when building microservices
==Glossary
| Term | Definition |
|---|---|
| Build | An executable unit |
| BFF | Backend for Frontend |
| Configuration | Everything that can differ between deployments, might differ among environments |
| Environment variables | Are easy to change across deployments without changing the code |
| Horizontal scaling | Scaling by adding more instances of resources, also described as “scaling out” |
| Microservices | A single application is composed of many loosely coupled and independently deployable smaller services |
| Monolithic application | Has all or most of its functionality within a single process |
| Release stage | Combines the build with the deployment’s current configuration so that the code is ready to run |
| Run stage | Implements the application |
| SaaS | Software as a Service |
| SPA | Single page application |
| SOA | Service Oriented Architecture |
| Strangler pattern | Helps manage the refactoring of a monolithic application in stages |
| Service discovery pattern | Helps applications and services discover each other |
| TLS | Transport layer security |

