订阅 RSS 源

Having a grasp of common architectural patterns is essential to designing software architecture at scale. Using them saves not only time but also ensures a reliable implementation of your design. There’s no need to reinvent the wheel when there’s an architectural pattern available that applies to an architecture you’re developing.

The following is a brief overview of the Throttling architectural pattern.

Understanding the Throttling pattern

The Throttling pattern, also known as Rate Limiting, is one in which a throttle is placed in front of a target service or process to control the rate at which data flow into the target. Throttling is a technique that ensures that the flow of data being sent into a target can be digested at an acceptable rate. Should the target become overwhelmed, the throttle will slow down or even stop calls to the target.

Throttling architecture pattern

In addition to being used as a defensive measure, the Throttling pattern can be used by consumers of cloud providers as a way to control consumption costs. Consumers can use tools to set a rate limit on calls made to a specific third-party service. This limit is usually defined as calls per second. Thus, clients avoid incurring unanticipated costs.

Pros

  • The Throttling pattern prevents catastrophic failure, particularly in terms of a denial-of-service (DDoS) attack. A DDoS is one in which a malevolent actor assaults an endpoint with a high number of calls that obstruct other calls from getting access to that endpoint. A throttle will detect the increase in traffic caused by the attack and react. That reaction might be to block traffic coming in from the malevolent IP address or to slow down the rate of traffic in general.
  • The Throttling pattern can be used to control infrastructure expenses, either financial or technical, by enforcing rates of usage of a particular process or service. Setting a throttle ensures that the target does not become operationally overwhelmed. Or, the throttling pattern can be used to avoid incurring unexpected charges from commercial managed services.

Cons

  • If a system does not have adequate redundancy mechanisms in place overall performance can degrade when key targets are slowed down due to the threshold imposed by the given throttle.
  • Implementation of the throttling pattern will vary according to what’s being throttled. Thus, specific engineering expertise is required. The technique used to throttle messages being emitted to a message broker is much different than the technique used to throttle HTTP calls to a particular brand of web server.
  • The throttling pattern is difficult to do as a one-off solution implemented in isolation. Often the Throttling architectural pattern is used in conjunction with the Circuit Breaker pattern in order to maintain service availability. For example, when a target reaches a threshold that requires throttling, a circuit breaker is used to reroute traffic to another target that has identical functionality, thus reducing the load on the first target. Typically implementing this type of throttling behavior requires infrastructure management technologies such as Kubernetes Horizontal Pod Autoscaler or a service mesh solution such as Istio or Linkerd.

Putting it all together

The essential benefit of the Throttling pattern is that it allows a system to control both internal and external traffic that might compromise a system's ability to operate in a safe and predictable manner. Unanticipated bursts in call activity do happen; sometimes by accident; something by nefarious intention. The Throttling pattern mitigates the impact of such bursts.

Client-side throttling will control the rate at which calls are made to commercial services that calculate fees according to usage activity. Thus, the Throttling pattern is used as a cost-control mechanism.

Using the Throttling pattern internally on the server-side protects a system from the DDoS acts from bad actors. Also, internal throttling protects the system from unanticipated burst activity from other internal processes and services. The tradeoff is that when throttling is in effect, the system might slow down and thus overall system performance can be affected. Hence, the Throttling Pattern is often used in conjunction with the Circuit Breaker pattern.


关于作者

Bob Reselman is a nationally known software developer, system architect, industry analyst, and technical writer/journalist. Over a career that spans 30 years, Bob has worked for companies such as Gateway, Cap Gemini, The Los Angeles Weekly, Edmunds.com and the Academy of Recording Arts and Sciences, to name a few. He has held roles with significant responsibility, including but not limited to, Platform Architect (Consumer) at Gateway, Principal Consultant with Cap Gemini and CTO at the international trade finance company, ItFex.

Read full bio
UI_Icon-Red_Hat-Close-A-Black-RGB

按频道浏览

automation icon

自动化

有关技术、团队和环境 IT 自动化的最新信息

AI icon

人工智能

平台更新使客户可以在任何地方运行人工智能工作负载

open hybrid cloud icon

开放混合云

了解我们如何利用混合云构建更灵活的未来

security icon

安全防护

有关我们如何跨环境和技术减少风险的最新信息

edge icon

边缘计算

简化边缘运维的平台更新

Infrastructure icon

基础架构

全球领先企业 Linux 平台的最新动态

application development icon

应用领域

我们针对最严峻的应用挑战的解决方案

Virtualization icon

虚拟化

适用于您的本地或跨云工作负载的企业虚拟化的未来