Dapr 服务调用 Service invocation

  • How do I discover and invoke methods on different services?如何发现和调用不同服务上的方法

Dapr uses a sidecar architecture. To invoke an application using Dapr, you use the invoke API on any Dapr instance. The sidecar programming model encourages each applications to talk to its own instance of Dapr. The Dapr instances discover and communicate with one another.

简单地说:边车就是代理人,我发布一个程序,请dapr经理人,我告诉经理人我要干啥,他会替我去对外访问,得到结果后反馈给我,而我对对方是什么并不清楚;同时,对手方,也是对手Dapr经理人告诉对手,对手将信息反馈交给经理人,对手Dapr经理人与本方Dapr经理人沟通;另外一个例子就是,邮局,我只需写好,邮局中间(Dapr)传递,统一接口(信封,邮件单),邮递员内部沟通。

sidecar architecture:

将应用程序的组件部署到单独的进程或容器中,以提供隔离和封装。此模式还可以使应用程序由异构组件和技术组成。

这种模式被称为Sidecar,因为它类似于连接到摩托车的边车。在该模式中,边车附加到父应用程序并为应用程序提供支持功能。 sidecar还与父应用程序共享相同的生命周期,与父项一起创建和退役。边车图案有时被称为搭接图案并且是分解图案。

  • How do I call other services securely with encryption and apply access control on the methods?如何通过加密安全地调用其他服务,并对该方法应用访问控制

Service-to-service security【安全访问】

All calls between Dapr applications can be made secure with mutual (mTLS) authentication on hosted platforms, including automatic certificate rollover, via the Dapr Sentry service.双向认证

Dapr 应用程序之间的所有调用都可以通过主机平台上的 双向(mTLS)身份验证进行安全调用,包括通过 Dapr Sentry 服务进行自动证书转期。

Access control【访问控制】

Applications can control which other applications are allowed to call them and what they are authorized to do via access policies. This enables you to restrict sensitive applications, that say have personnel information, from being accessed by unauthorized applications, and combined with service-to-service secure communication, provides for soft multi-tenancy deployments.

应用程序可以控制哪些其他应用程序被允许调用它们,以及它们通过访问策略被授权做什么。这使您能够限制敏感应用程序(比如具有个人信息的应用程序)被未经授权的应用程序访问,并结合服务到服务的安全通信,提供了软多租户部署。

  • How do I handle retries and transient errors?如何处理重试和瞬态错误

在出现调用失败和暂时性错误时,服务调用使用退出时间段执行自动重试。

遇到以下情况时触发重试:

  1. Network errors including endpoint unavailability 【端点不可用】and refused connections【拒绝连接】.
  2. Authentication errors due to a renewing certificate on the calling/callee Dapr sidecars.【因Dapr边车服务 更新证书导致的认证失败】

每次呼叫重试都以1秒的退避间隔执行,最大退避间隔为3次。

通过 gRPC 建立到目标边车的连接超时为5秒

  • How do I use tracing to see a call graph with metrics to diagnose issues in production?如何使用调用图跟踪以诊断生产中的问题

Tracing and metrics with observability

By default, all calls between applications are traced and metrics are gathered to provide insights and diagnostics for applications, which is especially important in production scenarios. This gives you call graphs and metrics on the calls between your services.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值