主权项 |
1. A method comprising:
identifying a plurality of participants for a two-phased commit distributed transaction by a processing device of a computing device running a coordinator, wherein the coordinator coordinates the two-phase commit distributed transaction; wherein during a first phase the coordinator asks the plurality of participants whether they are able to commit to the distributed transaction and in a second phase, the coordinator determines whether the distributed transaction should be completed or rolled back; determining, by the processing device of the computing device running the coordinator, a first participant order for the plurality of participants to apply during a prepare phase of the two-phase commit distributed transaction in view of one or more ordering rules that order invoking participants in view of participant invocation dependencies and participant reliability, wherein determining the first participant order in view of the participant invocation dependencies and the participant reliability further comprises:
determining reliability ratings for the plurality of participants;weighting priority values for the at least one of the participant invocation dependencies; andordering the plurality of participants in view of the weighted priority values, wherein ordering comprises prioritizing the participants having low reliability ratings before the participants having high reliability ratings in the first participant order, wherein a reliability rating corresponds to a probability of failing or timing out during the distributed transaction; sending a message for the distributed transaction to a first participant in the determined first participant order; waiting until a response is received from the first participant before sending the message to a second participant in the determined first participant order; and determining additional participants based on the received response from the first participant of the distributed transaction to which to send the message, and when there are additional participants to which to send a prepare message, a next participant in the first participant order. |