如何实现高性能的REST API在Azure上使用.NET? [英] How to achieve high-performance REST API on Azure with .NET?

查看:151
本文介绍了如何实现高性能的REST API在Azure上使用.NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都托管在一个.NET Web角色的 Windows Azure的,只有供应的 REST API 只用手数Web方法

We have a .NET Web Role hosted on Windows Azure that only serves a REST API with only a hand few web methods.

API使用,而通过积极的其他云托管应用(而不是浏览器)。每种方法是无状态这使直接向外扩展,并通常与BLOB或表的存储交互。

API is used rather aggressively by other cloud hosted apps (not browsers). Each method is stateless which enable direct scaling out, and typically interacts with the Blob or Table Storage.

然后违背最经典的API,量数据的上传应用于API通常更大比数据的下载的从API 。然后,大小平均邮件通常是相当大的,以及(即高于100KB)。

Then contrary to most classical API, the amount of data uploaded to the API is typically much larger than the data downloaded from the API. Then, the size the average message is typically quite big as well (i.e. above 100kB).

到目前为止,我们的在ASP.NET表单POX消息(普通旧XML)的顶部使用WCF。前端的表现都不是很好,罪魁祸首是:

So far, we are using WCF on top of ASP.NET Forms with POX messages (Plain Old Xml). The front-end performance are not very good, culprits are:


  • XML是冗长==>带宽限制。

  • ASP.NET + WCF + WcfRestContrib慢解析/序列化信息==> CPU的限制。

我想知道什么是实现在最高的前端性能,以减少虚拟机的数量需要支持工作负载的最佳策略。

I am wondering what is the best strategy to achieve the highest possible front-end performance to reduce the number of VMs needed to support the workload.

这是我在考虑可能的策略:

Possible strategies that I am considering:


  • 放弃XML支持的protobuf的。

  • 添加的上游的COM的GZip pression(古典HTTP COM pression只适用的下游的)。

  • 放弃WCF完全赞成原的HttpHandler 小号

  • Discard XML in favor of ProtoBuf.
  • Add upstream GZip compression (classical HTTP compression only applies downstream).
  • Discard WCF entirely in favor of raw HttpHandlers.

有没有人有基准的各种替代方案,以达到最Azure的每一个虚拟机的这种用法?

Does anyone has benchmarked the various alternatives to achieve the most of each Azure VM for such usage?

诗:隐指的 Lokad预测API 而是试图短语的问题一个更一般的方式。

Ps: Implicitly referring the Lokad Forecasting API but tried to phrase the question in a more general way.

推荐答案

在您的POC,我想你可以从公式,你通过一些场景的测试中去掉Azure上。

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

如果这是真正的带宽,COM pression当然是一个选择,但它可能会产生问题,如果这个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.

一个更简洁的格式是一种选择,只要你有REST风格的通信故障的一个很好的手段,由于恶劣的格式。 XML使这很容易。在protobuf的缺乏经验,但它似乎在这方面有一定的安全,因此,如果带宽是你的问题,可能解决问题解析的速度,它可能是一个非常好的选择。我首先POC它的Azure之外,然后把它放在

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.

这篇关于如何实现高性能的REST API在Azure上使用.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆