Tuesday, March 9, 2021

Microservices -2

Dual Writes: The Unknown Cause of Data Inconsistencies
https://www.youtube.com/watch?v=V08YbM_yvXU 


SAGA | Microservices Architecture Patterns | Tech Primers
https://www.youtube.com/watch?v=WnZ7IcaN_JA&t=324s

Do you know Distributed transactions?
https://www.youtube.com/watch?v=S4FnmSeRpAY

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

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

Distributed Transactions
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


Begin Txn
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


Distributed Transaction - how ??
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 ?


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


2 Phase is Okay for - Simple Monolithic Application
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)



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

Multiple Local Transactions - Dual Write - Inconsistencies


MiniMonolith - MacroService
Monorepo
Microservices

Youtube : Gears and Tools

 


Recommended Books: ------------------------------------------------------- Mastering Spring Boot 2.0 (Kindle): https://amzn.to/34nazFg Building Microservices(Kindle): https://amzn.to/3p2O3JE Spring Boot in Action: https://amzn.to/3akSpYO Spring Microservices in Action: https://amzn.to/3nmCPPX My PC : ------------------------------------------------------ AMD Ryzen 7 2700X Processor: https://amzn.to/38aZFDF Cooler Master MasterLiquid ML240R Cooler : https://amzn.to/3gUvnsK G.Skill Ripjaws V DDR4 8GB X 2pcs 3200Mhz RAM : https://amzn.to/3gT6s8Y ZOTAC GeForce GTX 1660Ti Graphics Card : https://amzn.to/3ntHyPJ Motherboard MSI (B450 Tomahawk MAX): https://amzn.to/37sOszr Power Supply Corsair CX550 550 Watt 80 Plus Bronze: https://amzn.to/3gVyAIT Samsung 860 EVO 500GB SATA M.2: https://amzn.to/38dyGr8 GIGABYTE C200 Glass ATX Case: https://amzn.to/38bA7GD HP K300 Gaming Keyboard: https://amzn.to/37sCUfA Logitech G102 Light Sync Mouse: https://amzn.to/2K3kAAQ

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

Sunday, February 21, 2021

HTTP API - EAP7.3 - Deployment using HTTP Curl

https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/configuration_guide/deploying_applications#deploying_apps_using_http_api



7.5.1. Deploy an Application to a Standalone Server Using the HTTP API

By default, the HTTP API is accessible at http://HOST:PORT/management, for example, http://localhost:9990/management.
Deploy an Application
$ curl --digest -L -D - http://HOST:PORT/management --header "Content-Type: application/json" -u USER:PASSWORD -d '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "add", "address" : {"deployment" : "test-application.war"}, "content" : [{"url" : "file:/path/to/test-application.war"}]},{"operation" : "deploy", "address" : {"deployment" : "test-application.war"}}],"json.pretty":1}'
Undeploy an Application
$ curl --digest -L -D - http://HOST:PORT/management --header "Content-Type: application/json" -u USER:PASSWORD -d '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "undeploy", "address" : {"deployment" : "test-application.war"}},{"operation" : "remove", "address" : {"deployment" : "test-application.war"}}],"json.pretty":1}'

Saturday, February 20, 2021

Difference between NAT, Host-Only, Bridge - Networking Adapters - NIC


NIC /Network Adapter - Network Interface Card

A device can have many IP Addresses or Network Interface Cards or Network Adapters

A computer can be part of many networks

https://superuser.com/questions/227505/what-is-the-difference-between-nat-bridged-host-only-networking

  • Host-Only: The VM will be assigned one IP, but it's only accessible by the box VM is running on. No other computers can access it.

  • NAT: Just like your home network with a wireless router, the VM will be assigned in a separate subnet, like 192.168.6.1 is your host computer, and VM is 192.168.6.3, then your VM can access outside network like your host, but no outside access to your VM directly, it's protected.

  • Bridged: Your VM will be in the same network as your host, if your host IP is 172.16.120.45 then your VM will be like 172.16.120.50. It can be accessed by all computers in your host network.

How to install Ubuntu and Docker on VirtualBox

https://medium.com/nycdev/how-to-ssh-from-a-host-to-a-guest-vm-on-your-local-machine-6cb4c91acc2e

https://www.freecodecamp.org/news/how-to-install-ubuntu-with-oracle-virtualbox/

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass