5.6 Task- versus Message-Based Architectures

I l @ ve RuBoard

A concurrency architecture is a binding between:

  1. CPUs, which provide the execution context for application code

  2. Data and control messages, which are sent and received from one or more applications and network devices

  3. Service processing tasks , which perform services upon messages as they arrive and depart.

A networked application's concurrency architecture is one of several factors [1] that most impact its performance by affecting context switching, synchronization, scheduling, and data movement costs. There are two canonical types of concurrency architectures: task-based and message-based [SS93]. The primary trade-offs in this dimension involve simplicity of programming versus performance.

[1] Other key factors that affect performance include protocol, bus, memory, and network hardware device characteristics.

Task-based concurrency architectures structure multiple CPUs according to units of service functionality in an application. In this architecture, tasks are active and messages processed by the tasks are passive, as shown in Figure 5.7 (1). Concurrency is achieved by executing service tasks in separate CPUs and passing data messages and control messages between the tasks/CPUs. Task-based concurrency architectures can be implemented using producer/consumer patterns, such as Pipes and Filters [BMR + 96] and Active Object [SSRB00], which we illustrate in [SH].

Figure 5.7. Task-Based vs. Message-Based Concurrency Architectures

Message-based concurrency architectures structure the CPUs according to the messages received from applications and network devices. In this architecture, messages are active and tasks are passive, as shown in Figure 5.7 (2). Concurrency is achieved by shepherding multiple messages on separate CPUs through a stack of service tasks simultaneously . Thread-per-request, thread-per-connection, and thread pool models can be used to implement message-based concurrency architectures. Chapter 9 illustrates the use of thread-per-connection, and thread pools are shown in [SH].

Logging service We structure the networked logging service threading designs in this book using message-based concurrency architectures, in particular thread-per-connection, which are often more efficient than task-based architectures [HP91, SS95]. Task-based architectures are often easier to program, however, since synchronization within a task or layer is often unnecessary since concurrency is serialized at the task access points, such as between layers in a prostocol stack. In contrast, message-based architectures can be harder to implement due to the need for more sophisticated concurrency control.

I l @ ve RuBoard


C++ Network Programming
C++ Network Programming, Volume I: Mastering Complexity with ACE and Patterns
ISBN: 0201604647
EAN: 2147483647
Year: 2001
Pages: 101

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net