16
Enterprise Design Pattern: ACID principal Concurrency Patterns

Enterprise Design Pattern:ACID principal,Concurrency Patterns

Embed Size (px)

Citation preview

Enterprise Design Pattern:ACID principal

Concurrency Patterns

Enterprise Design Patterns

• Transaction Patterns

•Concurrency Patterns

•Distributed Architecture Patterns

• Temporal Patterns

•Distributed Computing Patterns

•Database Patterns

Transaction Patterns

ACID principal• Atomicity• Consistency• Isolation• Durability

Atomicity

«all or nothing»

Consistency

Only valid data is saved

Isolation

Transactions do not affect each other

Durability

Written data will not be lost

Concurrency Patterns

•Active Object

•Half-Sync/Half-Async

• Leader/Followers

• Thread-Specific Storage

Active Object

It decouples method execution from method invocation to enhance concurrency and simplify synchronized access to objects that reside in their own thread of control

Components:• Proxy

• Client

• Method Request object

• Activation list

• Scheduler

• Servant

Half-Sync/Half-Async

This pattern decouples asynchronous and synchronous service processing in concurrent systems without reducing efficiency.

Decompose services in the system into two layers (synchronous and asynchronous) and add a queuing layer between them to mediate the communication between services in the asynchronous and synchronous layers.

Components:• Synchronous service layer

• Asynchronous service layer

• Queuing layer

• External event sources

• Asynchronous interrupts strategy

• Proactive I/O strategy

• Notification strategy

Leader/Followers

This pattern provides an efficient concurrency model where multiple threads take turns sharing a set of event sources in order to detect, demultiplex, dispatch, and process service requests that occur on the event sources

A pool of threads shares a set of event sources efficiently by taking turns,

demultiplexing events that arrive on these event sources and synchronously dispatching the events to application services that process them.

Components: • Handle set

• Event handlers

• Thread pool

• Leader role

• Follower role

• Processing role

Thread-Specific Storage

This pattern allows multiple threads to use one 'logically global' access point to retrieve an object that is local to a thread—called a 'threadspecific object'—without incurring locking overhead for each access to the object.

Components:• Thread-specific object

• Key factory

• Thread-specific object set

• Thread-specific object proxy

• Application threads