distributed-transactions

Spring Distributed Transaction Involving RMI calls possible?

巧了我就是萌 提交于 2019-12-06 02:16:51
问题 Background I have Spring Client application that provisions a service to two servers using RMI. In the the client I save an entity to the database (easy) and make rmi calls to two servers with details of the entity. I am using Spring 3.0.2 on the servers and the client is a simple Spring-mvc site. Requirements My requirement is that if any of the rmi calls fail to the servers that the whole transaction rolls back, that is the entity is not saved on the client and if either rmi call was

How to do 2 phase commit between two micro-services(Spring-boot)?

僤鯓⒐⒋嵵緔 提交于 2019-12-05 16:32:20
I Have two mico-serives A and B where they connect to seperate database, From Mico-serives A i need to persist(save) objects of both A and B in same transtation how to achive this. I am using Spring micro-servies with netflix-oss.Please give suggestions on best way to do achive 2 phase commit. you can not implement traditional transaction system in micro-services in a distributed environment. You should you Event Sourcing + CQRS technique and because they are atomic you will gain something like implementing transactions or 2PC in a monolithic system. Other possible way is transaction-log

Deadlocks causing 'Server failed to resume the transaction' with NHibernate and distributed transactions

十年热恋 提交于 2019-12-05 14:47:55
问题 We are having an issue when using NHibernate with distributed transactions. Consider the following snippet: // // There is already an ambient distributed transaction // using(var scope = new TransactionScope()) { using(var session = _sessionFactory.OpenSession()) using(session.BeginTransaction()) { using(var cmd = new SqlCommand(_simpleUpdateQuery, (SqlConnection)session.Connection)) { cmd.ExecuteNonQuery(); } session.Save(new SomeEntity()); session.Transaction.Commit(); } scope.Complete(); }

Distributed transactions in microservices

淺唱寂寞╮ 提交于 2019-12-05 12:15:59
I have 2 microservices S1 and S2 . S1 invokes S2 to update a data and then S1 inserts another data,But let's consider S1 fails,Then we need to rollback the data updated by S2 or else we'll be in inconsistent state. I also gone through Saga patterns.will it satisfy this inconsistency Can anyone suggest any better solutions for this? Distributed transactions are problematic for most circumstances and they are bad for services Service Boundary – service boundary is a trust boundary. Atomic transactions require holding locks and holding them on behalf of foreign service is opening a security hole

Best practices of distributed transactions(java) [closed]

五迷三道 提交于 2019-12-05 10:40:35
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago . Please share your experience with distributed transactions.What kind of frameworks(java) will you advise to use? 回答1: The practices of the distributed transactions are far behind its theory. Only one of the approaches to the distributed transactions (2PC) has a large variety of libraries and

How to achieve immediate consistency in microservice architecture?

你。 提交于 2019-12-04 16:33:31
For example amazon.com; they rely on microservice architecture and probably order and payment are seperate micro services but when you checkout order on amazon.com you can finally see the order id and details.If it's not eventual consistency approach what is it? Maybe 2PC? I'm generalizing my question; what if eventual consistency is not appropriate for business transaction(end user should see the result end of transaction) but seperate microservices is meaningful(like order and payment) how to handle immediate consistency? There are several techniques which can provide cross-service

EF: db.SaveChanges() vs dbTransaction.Commit

不问归期 提交于 2019-12-04 14:23:07
问题 I am fairly new to entity framework and I have a doubt on EF's db.SaveChange. From some posts and MSDN I learned that db.SaveChange by default does all the changes in transaction. Also there is a way we can create a transaction of our own using db.Database.BeginTransaction() ,"db" being my context class object. So I have two questions: What to use & when If I am inserting data to one table whose @@identity is foreign key to my next inserting table, rather than using db.SaveChange() to get the

Are XA/JTA transactions still used?

邮差的信 提交于 2019-12-04 13:36:24
问题 I have an application that interacts multiple databases and some custom services. For some operations, I need transaction-like behavior where a set of changes either commit across all databases/services or all roll back if an error occurs. The XA standard from the X/Open group and the Java JTA seem to solve exactly this problem using a two-phase commit process. Some databases (mySQL, Postgres, Oracle) support these interfaces, but I get the feeling that they are not often used or declining in

How do I configure authentication between linked servers?

心不动则不痛 提交于 2019-12-04 10:05:45
I am trying to test a proof of concept that I can run a distributed transaction across two linked SQL Servers, linked using sp_addlinkedserver - their names are Server1 and Server2, both running under default instances. Each server holds a single database, Source and Destination respectively and the destination database holds a single table called Output, i.e. Server1.Source Server2.Destination.Output The OUTPUT table has the following structure: OUT_PKEY int identity(1,1) primary key, OUT_TEXT nvarchar(255) From Server1 I have called sp_addlinkedserver 'Server2' to link the two databases and

How does three-phase commit avoid blocking?

半城伤御伤魂 提交于 2019-12-04 09:00:21
问题 I am trying to understand how three-phase commit avoids blocking Consider the following two failure scenarios: Scenario 1: In phase 2 the coordinator sends preCommit messages to all cohorts and has gotten an ack from all except cohort A. Network problems prevent cohort A from receiving the coordinator's preCommit message. Cohort A times out waiting for the preCommit message and chooses to abort. Then both the coordinator and cohort A crash. Scenario 2: The protocol reaches phase 3. The