1 2 3 Previous Next 30 Replies Latest reply on Apr 2, 2014 1:16 AM by Chirag Rana

    Implementing 1PC in WS-AT (WS-Atomic Transaction) - Master Degree Thesis

    Chirag Rana Newbie

      Introduction:

       

      WS-AT specification currently supports two-phase commit (2PC). I went through the specification and some literature review. During this, I came to know that WS-AT specification currently does not support 1PC optimization. It would be nice if we can get 1PC to work externally without disturbing the existing WS-AT specification.

       

      Even if a distributed transaction involves only a single participant, WS-AT requires the execution of the full 2PC protocol. The lack of the 1PC in WS-AT is unfortunate, since it is an important

      and widely known optimization — both the OTS and XA standards support the 1PC.

       

      Proposed Approach:

       

      I am thinking if we can write an interface similar to Durable2PCParticipant which can be called 1PCParticipant. This new interface will extend the interface Participant. If  we can make make a custom participant implement 1PCParticipant instead of Durable2PCParticipant and just leave the prepare() empty or don't call prepare() then we can avoid the 1st phase of the 2PC.


       

      Message was edited by: Chirag Rana

        • 2. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
          Chirag Rana Newbie

          Hello Mark,

           

          Thanks for the information.

           

          I am thinking if we can write an interface similar to Durable2PCParticipant which can be called 1PCParticipant. This new interface will extend the interface Participant.

           

          I configured ws-at simple example from jboss quickstarts (http://www.jboss.org/jdf/quickstarts/jboss-as-quickstart/wsat-simple/) in eclipse and JBoss AS 7.1.

           

          Refering to this example, there is a RestaurantParticipant which implements Durable2PCParticipant. If  we can make RestaurantParticipant implement 1PCParticipant and just leave the prepare() empty or don't call prepare() then we can avoid the 1st phase of the 2PC. This is just my thought for now and I would appreciate if you can advice me on this. If we can do something like this then it would be a great contribution to the JBoss community and webservice transaction world.

           

          Thanks & Regards,

          Chirag Rana.

          • 3. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
            Mark Little Master

            I have asked Paul to follow up with you here.

            • 4. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
              Paul Robinson Master

              Chirag,

               

              Sorry for the late reply. Things have been a bit hectic and I wanted to provide you with a decent response. I should be able to respond today or tommorow.

               

              Paul.

              • 5. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
                Paul Robinson Master

                Chirag,

                 

                The problem with what you are suggesting is that you assume that the participant knows 1PC will be used. However, 1PC is an optimization selected by the coordinator when it observes that only one participant has been registered for the transaction. In many cases the participant will not know that it is alone. I think you instead need to allow the participant to notify the coordinator that it is capable of participating in a 1PC or 2PC protocol. The coordinator would then select the 1PC optimization if there is only one participant registered for the transaction and only if that participant is 1PC capable.

                 

                WS-AT allows individual participants to register for different protocols. See "3 AtomicTransactionProtocols" of the WS-AT spec. I think you would probably need to add another one of those protocols for a 2PC protocol that can also do 1PC. You will probably also need to consider what the state table would like like for your new protocol. This would need to be inline with those in section "9 State Tables".

                 

                From the implementation point of view, XTS has protocol engines for each of the protocols in the WS-AT spec. You would need to add a new one of those to handle the new protocol. There's other things too, that you would need to do to implement it, but we can get into that later.

                 

                The new protocol would also need to support recovery. But again, we can consider that later. Maybe this is something outside of the scope of your masters project?

                 

                Paul.

                • 7. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
                  Chirag Rana Newbie

                  Hello Paul,

                   

                  Thank you so much for the information Paul. I will start working on the approach you have suggested and will keep you posted. I was also thinking what could be an ideal 1PC scenario. Do you have any suggestions or have come accross any ideal 1PC scenario you can think of? I am not looking for a complex scenario. A simple scenario will suffice to defend the thesis.

                   

                  Thanks & Regards,

                  Chirag.

                  • 8. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
                    Paul Robinson Master

                    Chirag,

                     

                    I think you have two use cases, that spring to mind. There may be others if you search the web.

                     

                    1) Based on the application logic, the number of services invoked (and thus participants enlisted) could vary, dependent on input parameters. Therefore, sometimes you will only get one participant registered, making 2PC unnecessary. Imagine a travel agent, sometimes a customer will book a flight, hotel and taxi; other times, just a flight.

                     

                    2) Even if multiple participants are enlisted, I think you can drive the final participant through 1PC if all previous participants voted "read-only".

                     

                    I suggest you read the following book [1]. The Web services bit is out of date (describes old standards), however, the core concepts are still very much current. I always recommend that my Interns and any new team members read the book. I'd recommend reading chapter one (Transaction Fundamentals) and ten (Transactions and Web Services) in detail and then go through the other chapters in an order that interests you. It should give you a solid understanding of transaction concepts and will give you some good content for your thesis.

                     

                    Our transactions blog is also a good source of information [2].

                     

                    [1] http://www.amazon.co.uk/Java-Transaction-Processing-Design-Implementation/dp/013035290X

                    [2] http://jbossts.blogspot.co.uk/

                     

                    Paul.

                    • 9. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
                      Chirag Rana Newbie

                      Hello Paul,

                       

                      Thanks so much for the information. Based on the above given use cases, my understanding is that we can also consider the  ws-at simple example from jboss quickstarts (Restaurant reservation example) can also be converted into 1PC, if we consider only makebooking() as the service call. Let me know your thoughts on this use case.

                       

                      I have order the book which you suggested and will refer to the chapters you have suggested. Will keep you posted on the progress.

                       

                      Thanks & Regards,

                      Chirag.

                      • 10. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
                        Chirag Rana Newbie

                        Hello Paul,

                         

                        Just wanted to give you heads up that I am refering to the book you have suggested. It is a very good source for all the developers and architects who want to design/implement transaction related applications. Thanks very much. As I am going through the book, I am also writing thesis prospectus. I will be starting the technical implementation as soon I am done with couple of chapters from the book. I am also referring to your transaction blog. It is a good source of information and I am getting pretty clear idea of how transactions work.

                         

                        Thanks & Regards,

                        Chirag.

                        • 11. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
                          Paul Robinson Master

                          Chirag,

                           

                          That's great I'm glad you are finding them of use.

                           

                          What time frames are you looking at to complete your implementation/thesis?

                           

                          Paul.

                          • 12. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
                            Chirag Rana Newbie

                            Hello Paul,

                             

                            I am looking forward to complete by Mid November 2013. According to your experience, how much time do you think it should take to complete the implementation? I have 10 years of Portlet development experience and I am currently a full time employee in US working on Portal Technology.

                             

                            Thanks & Regards,

                            Chirag Rana

                            • 13. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
                              Paul Robinson Master

                              Chirag,

                               

                              It's very difficult to estimate work for other people. Especially those that you have never worked with before. Having said that, I think Mid November is a reasonable target for an experienced engineer. I suggest you focus on the getting the protocol working first, and then if you have time, work on the recovery side.

                               

                              In particular, I think you need to have a good understanding of how XTS currently handles multiple protocols. This should give you an appreciation of how you would add an additional one. I'll warn you, the state machines are rather complex, due to the asynchronous nature of the protocols. I'm not trying to put you off, I'm just ensuring you are not too daunted when you look at that aspect of the code. It will take some time for it to sink in.

                               

                              Paul.

                              • 14. Re: Implementing 1PC in WS-AT (WS-Atomic Transaction)
                                Chirag Rana Newbie

                                Hello Paul,

                                 

                                Thanks for your inputs. You are right. I am going to focus on making the protocol working successfully. I am thinking of recovery mechanism as a part of future research. I am going through the ws-at specs and the book. Soon will come up with a design based on the approach we discussed earlier. I will need some help as inputs from you once I complete the design on my end. I will keep in mind about the complexity of state machines. I have few more questions but will post those once I am in the process of setting up the workspace.

                                 

                                Thanks & Regards,

                                Chirag Rana.

                                1 2 3 Previous Next