Wednesday, March 10, 2021
Cloud Design Patterns
Circuit Breaker pattern
https://docs.microsoft.com/en-us/azure/architecture/patterns/circuit-breaker
https://docs.microsoft.com/en-us/azure/architecture/patterns/circuit-breaker
Compensating Transaction
https://docs.microsoft.com/en-us/azure/architecture/patterns/compensating-transaction
Saga distributed transactions
https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/saga/saga
https://vasters.com/archive/Sagas.html
Saga Image
https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/saga/images/choreography-pattern.png
Retry pattern
https://docs.microsoft.com/en-us/azure/architecture/patterns/retry
Microservices using SpringBoot | Full Example
https://www.youtube.com/watch?v=BnknNTN8icw
https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/saga/images/choreography-pattern.png
Retry pattern
https://docs.microsoft.com/en-us/azure/architecture/patterns/retry
Microservices using SpringBoot | Full Example
https://www.youtube.com/watch?v=BnknNTN8icw
API Gateway
(Forward)Proxy vs Reverse Proxy
https://www.youtube.com/watch?v=AuINJdBPf8I
(Forward)Proxy vs Reverse Proxy
Requests Going Out Via Proxy -> Forward Proxy
Requests Coming In Via Proxy -> Reverse Proxy
Reverse Proxy - Use cases : Security, Load Balancer , Caching
Forward Proxy - Corporate Control, Logging, Monitoring, Cached Responses
Zuul
API Gateway
Edge Microservice -> Sits at the edge of Microservice Architecture, Very close to user input.
Edge Microservice is also known as API Gateway.
"Zuul" is an implementation of API Gateway.
API Gateway - is a Facade/Abstraction Layer at the very edge of Microservices Architecture ,
which handles incoming Requests
Eureka
Eureka - "Found it" in Ancient Greek
Archimedes said it!!!
Eureka is a Registry and LookUp Service which allows Microservice to know each other
Hystrix
Fault Tolerant Library from Netflix which Implements "Circuit - Breaker" Pattern
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-hystrix --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-hystrix</artifactId> <version>1.4.7.RELEASE</version> </dependency>
How to configure SpringCloud Zuul – Routing and Filtering using SpringBoot | Java Techie
https://www.youtube.com/watch?v=6aG0xFpeNFw
Nested Transaction - Microsoft SQL Server (MSSQL)
SP - @@TxnCount
Use Try Catch Block SQL
Rollback - Sets @@TRANCOUNT to 0
Commit - decrements @@TRANCOUNT Counter by 1
Use Try Catch Block SQL
Rollback - Sets @@TRANCOUNT to 0
Commit - decrements @@TRANCOUNT Counter by 1
When Counter becomes Zero, Commit or Rollback actually does take its effect
Actually, No Nested Txn in MSSQL
Only 1 Txn in MSSQL
Actually, No Nested Txn in MSSQL
Only 1 Txn in MSSQL
https://sqlinthewild.co.za/index.php/2015/11/03/a-mess-of-nested-transactions/
OUTPUT Clause (Transact-SQL)
https://docs.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql?view=sql-server-ver15
Hystrix, Zuul, Eureka
"Hystrix" is a circuit-breaker Pattern created by
Netflix.
Its basically a fault-tolerance management library from spring
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-hystrix --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-hystrix</artifactId> <version>1.4.7.RELEASE</version> </dependency>
Spring Cloud Starter Hystrix
Spring Cloud Starter Hystrix (deprecated, please use spring-cloud-starter-netflix-hystrix)
"Zuul" -> API Gateway
"Eureka" -> Service Discovery
"Eureka" -> Service Discovery
Tuesday, March 9, 2021
Microservices -2
Dual Writes: The Unknown Cause of Data Inconsistencies
https://www.youtube.com/watch?v=V08YbM_yvXU
https://www.youtube.com/watch?v=V08YbM_yvXU
SAGA | Microservices Architecture Patterns | Tech Primers
https://www.youtube.com/watch?v=WnZ7IcaN_JA&t=324s
https://www.youtube.com/watch?v=WnZ7IcaN_JA&t=324s
What is a Distributed Transaction in Microservices?
https://www.youtube.com/watch?v=H6F4BorD49g
Transactions 2:30
Compensating Edits 6:40
Atomic Clocks 11:50
Event Sourcing 13:30
Mini-Monolith 15:20
Monolith Applications - Distributed Transactions - 2 Phase Commit
Asynchronous Communication, Local Transaction , One Step = One Datastore
Endless Retry Mechanism
Algorithm - Eventual Consistency
SAGA Pattern
Asynchronous Communication, Local Transaction , One Step = One Datastore
Endless Retry Mechanism
Algorithm - Eventual Consistency
SAGA Pattern
Circuit Breaker Pattern
Friday, March 5, 2021
Microservices -1 | Eventual Consistency | Transient Exception | Compensating Transaction|Timeout Retry
Hard Consistency - ACID does not apply to microservices
It may have been applicable via 2 Phase Commit in case of Distributed Transaction but the database was still the same
Now its time for Eventual Consistency
ACID on Local Transactions
Multiple steps in Transaction Boundary - Because its just 1
one fails, all Fails
Multiple steps in Transaction Boundary - Because its just 1
one fails, all Fails
Distributed Transactions
More than 1 Database
More than 1 Database
Using Multiple Local Transaction
One is committed, Another Fails
Compensatory Transaction(Workaround Steps) - Not Always a Good Practice
https://www.youtube.com/watch?v=jGJT1FRYGcY
Stale Data - Multiple Write -> Dual Write
One is committed, Another Fails
Compensatory Transaction(Workaround Steps) - Not Always a Good Practice
https://www.youtube.com/watch?v=jGJT1FRYGcY
Stale Data - Multiple Write -> Dual Write
Begin Txn
Lock
Mutate
Release Lock (Commit) or Rollback ---- Goto State
Lock
Mutate
Release Lock (Commit) or Rollback ---- Goto State
https://www.youtube.com/watch?v=pSz0Fpvu2Gk
Older Distributed Transaction or Monolithic Architecture
ACID Principles to Multiple External System
2 Phase Commit - Distributed Transactions - Not a Good Fit for Microservices
Older Distributed Transaction or Monolithic Architecture
ACID Principles to Multiple External System
2 Phase Commit - Distributed Transactions - Not a Good Fit for Microservices
Distributed Transaction - how ??
Saga
2 Phase Commit --- -Prepare and Commit --> 2 Phases
Prepare1 -> Prepared1 -> Commit1
Prepare2 -> Prepared2 -> Commit2
Commit1 + Commit2 = Commit ----Txn Cordinator ---> Application
Saga
2 Phase Commit --- -Prepare and Commit --> 2 Phases
Prepare1 -> Prepared1 -> Commit1
Prepare2 -> Prepared2 -> Commit2
Commit1 + Commit2 = Commit ----Txn Cordinator ---> Application
2 Phase Commit - Discouraged in Microservices -- HTTP Slowness, LOCKED Resource , Slow
Co-ordinator Fails ? What Then ?
Co-ordinator Fails ? What Then ?
3 Phase allows any Participant to be a Co-ordinator
2Phase / 3-Phase - biggest drawback is - they have a wrapper aroun TXN -
So its long living and synchronous
So its long living and synchronous
2 Phase is Okay for - Simple Monolithic Application
But Microservices is already slow,uses HTTP and now u put 2phase commit , Its worse
But Microservices is already slow,uses HTTP and now u put 2phase commit , Its worse
Asynchronous -- SAGA
Txn1 -> Message
Txn2 -> Message (If Failure, Then Rollback Message)
Txn1 -> Message
Txn2 -> Message (If Failure, Then Rollback Message)
Rollback Service will rollback Txns
https://thorben-janssen.com/data-and-communication-patterns-for-microservices-waitlist/
https://www.youtube.com/watch?v=SUQxXg229Xg
https://thorben-janssen.com/data-and-communication-patterns-for-microservices-waitlist/
https://www.youtube.com/watch?v=SUQxXg229Xg
https://youtu.be/H6F4BorD49g - Hussein Nasser
What is a Distributed Transaction in Microservices?
What 3 Methods
1)Atomic Clocks - Rollback The steps
2)Event Based - Kafka/Rabbit MQ -> Publish/Subscribe -> Reverse
3)MiniMonolith - MacroService [Combine homogenous txns in 1 Service]
Distributed Transactions - Txns between Multiple Processes - Each with their own commit/rollback
2)Event Based - Kafka/Rabbit MQ -> Publish/Subscribe -> Reverse
3)MiniMonolith - MacroService [Combine homogenous txns in 1 Service]
Distributed Transactions - Txns between Multiple Processes - Each with their own commit/rollback
Multiple Local Transactions - Dual Write - Inconsistencies
MiniMonolith - MacroService
Monorepo
Microservices
Monorepo
Microservices
Youtube : Gears and Tools
Audio Gear - Telusko
Lavalier - Mic
https://www.amazon.in/gp/product/B076B8G5D8 Boya Mic
Audio Gear :
----------------------------------------------------------------------------
Maono AU-A04 Condenser Microphone : https://amzn.to/3gSTzMl
Secondary Audio :
----------------------------------------------------------------------------
Maono AU-100 Condenser Clip On Lavalier Microphone : https://amzn.to/3p0YTQE
Subscribe to:
Posts (Atom)
Azure - Pipeline - Add Approver for Stage
https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass
-
https://www.baeldung.com/spring-properties-file-outside-jar https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-featu...
-
https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass
-
The decision was made to block such external HTTP repositories by default https://stackoverflow.com/questions/66980047/maven-build-failure-d...