更多的情况 不是使用EntryType.IN 吗?默认EntryType.OUT 每次都需要显示指定EntryType.IN。这样设计是出于怎样的考虑?
原提问者GitHub用户liwen2555376
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
EntryType用于区分流量类型,即入口流量与出口流量,默认流量类型为出口流量的目的是为了保障这部分资源不会因为SystemRule系统自适应限流所影响,系统自适应限流只对入口流量做流控。比如Dubbo的调用链路,Consumer与Provider两个节点的系统指标冲高时,Consumer无需对出口流量做流控,因为系统的消耗并不是因为出口流量导致的,而Provider需要对入口流量做流控,防止更多流量流入进一步冲高系统指标。 见方法签名注释中对trafficType的解释。 /** * Record statistics and perform rule checking for the given resource. * * @param name the unique name for the protected resource * @param trafficType the traffic type (inbound, outbound or internal). This is used * to mark whether it can be blocked when the system is unstable, * only inbound traffic could be blocked by {@link SystemRule} * @param batchCount the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens) * @return the {@link Entry} of this invocation (used for mark the invocation complete and get context data). * @throws BlockException if the block criteria is met */ Entry entry(String name, EntryType trafficType, int batchCount) throws BlockException;
原回答者GitHub用户luffy0223
阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。