Tiven Wang
chevron_rightLatency chevron_rightReactive

Reactive Design Patterns - Analyzing Latency of Traditional Approach

Annie Spratt
Wang Tiven August 28, 2017
425 favorite favorites
bookmark bookmark
share share

tomcat config executor

For example: you can see the --max-threads option (Default: 200) in the deploy command page for tools of SAP Cloud Platform. Assume there is need 0.2 seconds to process a request, so the max processed requests per-second is

\[ L = \lambda \cdot W \]

\[ \lambda = \frac{L}{W} \]

\[ \lambda = \frac{200}{0.2} = 1000 \]

So our application maximum process requests per-second is 1000. This is only theoretical value, the increased parallelized threads will eat more cpu resources then process per request need more times.

According to Amdahl’s law the theoretical speedup in latency of the execution of a task at fixed workload that can be expected of a system whose resources are improved.

Amdahl’s Law specifies the maximum increase in speed that can be achieved by adding additional threads:

\[ S(n) = \frac{T(1)}{T(N)} = \frac{1}{\alpha + \frac{1 - \alpha}{N}} = \frac{N}{1 + \alpha(N - 1)} \]

  • N is the number of available threads
  • α is the fraction of the program that is serialized
  • T(N) is the time the algorithm needs when executed with N threads

The increase in speed of a program using multiple processors in parallel computing is limited by the sequential fraction of the program. For example, if 95% of the program can be parallelized, the theoretical maximum speedup using parallel computing will be 20 times, no matter how many processors are used:

Image: AmdahlsLaw

So we can’t scale up our server to speedup processing request blindly, but we need refactor our application architecture and scale out our server.


Similar Posts

  • Reactive - Spring WebFlux framework .
  • Reactive Design Patterns - Simple Component Pattern The single responsibility principle.
  • Testing Reactive Applications How to verify that the Reactive applications you build are elastic, resilient, and responsive. Testing is covered first because of the importance of proving Reactive capabilities. Just as Test-Driven Design (TDD) allows you to ensure that you are writing logic that meets your requirements from the outset, you must focus on putting into place the infrastructure required to verify elasticity, resilience, and responsiveness.
  • Stream Processing Stream processing is a computer programming paradigm, equivalent to dataflow programming, event stream processing, and reactive programming, that allows some applications to more easily exploit a limited form of parallel processing. The stream processing paradigm simplifies parallel software and hardware by restricting the parallel computation that can be performed. Given a sequence of data (a stream), a series of operations (kernel functions) is applied to each element in the stream.
  • Reactive Design Patterns Reactive Design Patterns
  • Reactive Design Patterns - Spring Boot Messaging


Back to Top