Docsity

Queuing-Transaction Process For ECommerce-Lecture Slides, Slides of Transaction Processing for E Commerce

Partial preview of the text

Download Queuing-Transaction Process For ECommerce-Lecture Slides and more Slides Transaction Processing for E Commerce in PDF only on Docsity!

Outline

1. Introduction

2. Transactional Semantics

3. Queue Manager

4. Message-Oriented Middleware

Appendices

A. Marshaling

B. Microsoft Message Queue

docsity.com

9.1 Introduction

  • Direct TP - a client sends a request to a server, waits

(synchronously) for the server to run the transaction

and possibly return a reply (e.g., RPC)

  • Problems with Direct TP
    • Server or client-server communications is down when the client wants to send the request
    • Client or client-server communications is down when the server wants to send the reply
    • If the server fails, how does the client find out what happened to its outstanding requests?
    • Load balancing across many servers
    • Priority-based scheduling of busy servers docsity.com

Other Benefits

  • Queue manager as a protocol gateway
    • Need to support multiple protocols in just one system environment
    • Can be a trusted client of other systems to bridge security barriers
  • Explicit traffic control, without message loss
  • Safe place to do message translation between

application formats

docsity.com

9.2 Transaction Semantics Server View

  • The queue is a transactional resource manager
  • Server dequeues request within a transaction
  • If the transaction aborts, the dequeue is undone,

so the request is returned to the queue

Start Dequeue(Req, Q1) process request Req Enqueue(Reply, Q2) Commit

Client

Server’s request queue

Client’s reply queue

Q1 Server Program

Q

docsity.com

  • Client runs one transaction to enqueue a request and

a second transaction to dequeue the reply

Transaction Semantics - Client View

Txn1 : Start get input construct request Enqueue(Request, Q1) Commit Txn3 : Start Dequeue(Reply, Q2) decode reply process output Commit

Q

Q

Txn2 : Start Dequeue(Req, Q1) process request Req Enqueue(Reply, Q2) Commit

docsity.com

Transaction Semantics

Client View (cont’d)

  • Client transactions are very light weight
  • Still, every request now requires 3 transactions,

two on the client and one on the server

  • Moreover, if the queue manager is an independent resource manager (rather than being part of the database system), then Transaction 2 requires two phase commit
  • So queuing’s benefits come at a cost

docsity.com

Client Recovery (2)

  • So, if the client knows the request id R, it can

determine state C and maybe state B.

  • What if no queued message has the id R?

Could be in state A, B, or D.

  • Can further clarify matters if the client has a local

database that can run 2-phase commit with the

queue manager.

  • Use the local database to store the state of the request.

docsity.com

Transaction Semantics - Client View

Txn1 : Start R = LastRequest Enqueue(Request Q, R) LastEnqueuedID=R.ID Commit

Txn3 : Start R = Dequeue(Reply Q) decode reply & process output LastDequeuedID=R.ID Commit

Q

Q

Txn2 : Start Req=Dequeue(RequestQ) process request Req Enqueue(ReplyQ, reply) Commit

Txn0 : Start get input & construct request R LastRequest = R Commit

docsity.com

Persistent Sessions

  • Suppose client doesn’t have a local database that

runs 2PC with the queue manager.

  • The queue manager can help by persistently

remembering each client’s last operation, which is

returned when the client connects to a queue …

amounts to a persistent session.

docsity.com

Client Recovery with Persistent Sessions

// Let R be id of client’s last request // Assume client ran Txn0 for R before Txn Client connects to request and reply queues; If (id of last request enqueued  R) { resubmit request } elseif (id of last reply message dequeued  R) { dequeue (and wait for) reply with id R } else // R was fully processed, nothing to recover

  • Now client can figure out
    • A – if last enqueued request is not R
    • D – if last dequeued reply is R
    • B – no evidence of R and not in states A, C, or D.

docsity.com

Testable Operations

  • Testable operations
    • After the operation runs, there is a test operation that the client can execute to tell whether the operation ran
    • Typically, the non-undoable operation returns a description of the state of the device (before-state) and then changes the state of the device
    • The test operation returns a description of the state of the device.
    • E.g., State description can be a unique ticket/check/form number under the print head

docsity.com

Recovery Procedure for State C

To process a reply

  1. Start a transaction
  2. Dequeue the reply
  3. If there’s an earlier logged device state for this reply and it differs from the current device state, then ask the operator whether to abort this txn
  4. Persistently log the current device state with the reply’s ID. This operation is permanent whether or not this transaction commits.
  5. Perform the operation on the physical device
  6. Commit

Log

docsity.com

9.3 Queue Manager

  • A queue supports most file-oriented operations
    • Create and destroy queue database
    • Create and destroy queue
    • Show and modify queue’s attributes (e.g. security)
    • Open-scan and get-next-element
    • Enqueue and Dequeue
      • Next element or element identified by index
      • Inside or outside a transaction
    • Read element

docsity.com

Queue Manager (cont’d)

  • Also has some communication types of operations
    • Start and stop queue
    • Volatile queues (lost in a system failure)
    • Persistent sessions (explained earlier)
  • System management operations
    • Monitor load
    • Report on failures and recoveries

docsity.com