且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 .NET 在 Azure 上实现高性能 REST API?

更新时间:2023-02-15 09:02:46

在您的 POC 中,我认为您可以在测试某些场景时从方程式中删除 Azure.

In your POCs, I think you can remove Azure from the equation as you test through some of the scenarios.

如果这是真正的带宽,压缩当然是一种选择,但如果此 Web 服务将向公众"开放而不是简单地由您控制的应用程序使用,则可能会出现问题.在异构环境中尤其如此.

If this is truly bandwidth, compression is certainly an option, but it can be problematic if this web service will be opened up to the "public" rather than simply used by applications under your control. This is especially true in a heterogenous environment.

一个不那么冗长的格式是一种选择,只要你有一个很好的方法来传达由于格式错误而导致的失败.XML 使这变得非常容易.缺乏 ProtoBuf 的经验,它似乎在这方面确实有一定的安全性,因此如果带宽是您的问题并且可以解决解析速度问题,它可能是一个非常好的选择.我会先在 Azure 之外进行 POC,然后再放入.

A less verbose format is an option, as long as you have a good means of RESTfully communicating failures due to bad formatting. XML makes this very easy. Lacking experience in ProtoBuf, it does appear to have some safety in this area, so it could be a very good option if bandwidth is your problem and may solve the speed of parsing issue. I would POC it outside of Azure first and then put it in.

如果您有证据表明 WCF 开销是一个问题,我只会运行原始 HttpHandler 方向.Azure 很难在配置中进行如此多的调试,以至于我不相信添加原始 HttpHandlers 的额外问题是正确的方向.

I would only run the raw HttpHandler direction if you have evidence WCF overhead is an issue. Azure is hard enough to debug with so much being in config that I am not convinced adding the additional issue of raw HttpHandlers is the proper direction to go.