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.

References

Similar Posts

  • 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
  • Reactive Design Patterns - Reactive Manifesto 以响应式系统方式构建的系统更加灵活,松耦合和可扩展。这使得它们更容易被开发,而且经得起变化的考验。它们对于系统失败表现出显著的包容性,并且当失败真的发生时,它们能用优雅的方式去应对,而不是放任灾难的发生。响应式系统是高度灵敏的,能够给用户以有效的交互式的反馈。

Comments

comments powered by Disqus
Back to Top