Stuff Goes Bad:Erlang In Anger

Asking For Permission


A somewhat simpler approach to back-pressure is to identify the resources we want to block on, those that cannot be made faster and are critical to your business and users. Lock these resources behind a module or procedure where a caller must ask for the right to make a request and use them.
There’s plenty of variables that can be used: memory, CPU, overall load, a bounded number of calls, concurrency, response times, a combination of them, and so on.


The SafetyValve 11 application is a system-wide framework that can be used when you know back-pressure is what you’ll need.
For more specific use cases having to do with service or system failures, there are plenty of circuit breaker applications available. Examples include breaky 12, fuse 13, or Klarna’s circuit_breaker 14.
Otherwise, ad-hoc solutions can be written using processes, ETS, or any other tool available.

 安全阈值(SafetyValve) application就是一个可以让你得到你想了解的back-pressure指标的系统级的框架。
 下面还很多关于这方面的应用,你可以找到更具体的用例与服务或系统故障,比如:breaky12, fuse13, Klarna’s14 circuit_breaker

The important part is that the edge of the system (or subsystem) may block and ask for the right to process data, but the critical bottleneck in code is the one to determine whether that right can be granted or not.
The advantage of proceeding that way is that you may just avoid all the tricky stuff about timers and making every single layer of abstraction synchronous.
You’ll instead put guards at the bottleneck and at a given edge or control point, and everything in between can be expressed in the most readable way possible.

 系统边缘(the edge of the system)或子系统中重要的部分可能会阻塞并请求处理数据,但是代码中关键瓶颈在于什么情况下可以授权?
 这样(指阻塞着处理数据)处理的优势在于:你可以禁止所有棘手的时间定时器并让每一个抽象层(single layer of abstraction)都同步.


[注11]:1 .