Half a croissant, on a plate, with a sign in front of it saying '50c'
h a l f b a k e r y
Eureka! Keeping naked people off the streets since 1999.

idea: add, search, annotate, link, view, overview, recent, by name, random

meta: news, help, about, links, report a problem

account: browse anonymously, or get an account and write.

user:
pass:
register,


       

Please log in.
Before you can vote, you need to register. Please log in or create an account.

Microservice distributed transactions using IRC

Distributed transactions are complicated and difficult
  (-1)
(-1)
  [vote for,
against]

When you need to update some thing in a distributed system and you have multiple services to update, you need distributed transactions.

If you were using a single SQL database, you could do some thing like the following. To synchronize changes to the order system, delivery system and email system, you group your changes into a single local transaction.

BEGIN TRANSACTION

update users set last_use = date.now()

insert into orders (user_id, product, qty) values (20, "Schlongs", 10) returning id

insert into deliveries (user_id, order_number, address) values (20, 10, "120 pemwinkle drive, birmingham, uk")

COMMIT

In a microservice based system, you don't have the luxury of using a single database to run a transaction within because you're connecting from different servers where each has its own database.

I propose using Internet Relay Chat to coordinate the lock on tables

initiator: g393 LOCK users orders deliveries

initiator: g393 update users set last_use = date.now()

userservice: g393 ok

initiator: g393 insert into orders (user_id, product, qty) values (20, "Schlongs", 10) returning id orderservice: g393 ok

initiator: insert into deliveries (user_id, order_number, address) values (20, 10, "120 pemwinkle drive, birmingham, uk")

deliveriesservice: g393 ok

initiator g393 COMMIT

userservice: g393 done

orderservice: g393 done

deliveriesservice: g393 done

chronological, Mar 30 2020

[link]






       Distributed transactions already a thing:
What new advantage does IRC bring?
pertinax, Mar 30 2020
  

       it's difficult to achieve ACID with a distributed transaction system because it's implemented in application code.   

       I propose the use of IRC to coordinate the services when they run their own transactions.   

       Might have to mark things in the database as 'in transaction', so they don't become viewable during the distributed transaction.
chronological, Mar 31 2020
  

       Wait a minute: I thought it had been mathematically proven that you can't have real ACID with distributed services anyway. I now forget the details, but there's another acronym, BASE, describing the terms you have to think in instead.
pertinax, Mar 31 2020
  
      
[annotate]
  


 

back: main index

business  computer  culture  fashion  food  halfbakery  home  other  product  public  science  sport  vehicle