SQL Azure 与 WCF 性能对比

发布于 2024-11-05 21:27:23 字数 307 浏览 4 评论 0原文

我看过很多有关 Azure 性能的基准测试,但我想知道是否有人知道/已经进行过比较,以了解以下哪种方案对于胖客户端应用程序表现更好。

  1. 连接到 WCF 服务以访问在云中运行的数据并连接到本地 SQL 数据库。举例来说,假设它是一个具有底层实体框架模型的 WCF 数据服务,该模型连接到 Azure 上的 SQL 数据库。

  2. 从客户端直接连接到 SQL Azure 实例。举例来说,假设它与上面的查询和实体框架模型相同,但直接连接到 SQL Azure 实例,而不是通过 WCF 数据服务。

谢谢。

I've seen a lot of benchmarks on Azure performance, but I'm wondering if anyone knows of/has done a comparison to see which of the following scenarios performs better for a thick client application.

  1. Connects to WCF services for data access that are running in the cloud and connect to a local SQL database. For examples sake, let's say it's a WCF Data Service with an underlying Entity Framework model that connects to a SQL database on Azure.

  2. Connects directly to the SQL Azure instance from the client. For examples sake, let's say it's the same queries and Entity Framework model as above, but connecting directly to the SQL Azure instance instead of through the WCF Data Service.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

终弃我 2024-11-12 21:27:23

我绝对会建议您使用 WCF+SQL Azure

SOA 背后的基本思想之一是构建简洁的界面,而不是繁琐的界面。当托管在云中时尤其如此,因为您的客户端不靠近数据。

如果您要填充复杂的业务对象,您可能必须运行许多查询。通过使用 WCF 服务与 SQL Azure 对话,您可以在 Azure 环境中运行所有这些查询,并将 Internet 往返次数降至最低。

当然,这样做的成本更高,但随着服务层可以扩展,它的扩展性更好。

这样做有很多好处。

  • 客户端与数据库分离(不改变客户端即可更新数据结构)。
  • 作为 1 的结果,如果您需要对数据库进行分片,则可以。
  • 如果您需要稍后升级到 SQL Azure Federations(当它推出时)那么您可以。
  • 如果您想使用 Azure 缓存,您有一个简单的方法。
  • 安全性(1) 您的数据库位于防火墙后面。
  • 安全性(2) 您可以对每个请求进行身份验证,而不仅仅是在连接上进行身份验证。
  • 安全性(3) 如果您正在处理文档/blob 存储,则无需向客户端提供存储帐户密钥。

我正在管理一些相当大的多租户系统,后端使用 WCF+SQL Azure 架构,它运行得非常好。

SQL Azure 本身在网络上运行得很好,我什至很高兴在 azure 中运行我的开发数据库,​​但我认为这对于生产应用程序来说不是一个好的选择。

希望这有帮助。

I would definitely recommend that you go with the WCF+SQL Azure

One of the basic ideas behind SOA is to build chunky rather than chatty interfaces. This is especially true when hosting in the cloud as your client is not close to the data.

If you have complex business objects to populate you may have to run a number of queries. By using WCF Services to talk to SQL Azure then you can run all those queries within the Azure environment and keep the Internet round trips to a minimum.

Of course it costs more to do it this way, but it scales better as the services layer can be scaled out.

There are a number of big advantages to doing this.

  • Separation between client and database (Data structure can be updated without changing client).
  • As a consequence of 1 if you need to shard the database you can.
  • If you need to upgrade later to SQL Azure Federations (When it 's out) then you can.
  • You have an easy hook if you want to use Azure Caching.
  • Security(1) Your database stays behind the firewall.
  • Security(2) You can authenticate every request rather than simply on connection.
  • Security(3) If you are dealing with documents/blob storage then you don't need to make your storage account keys available to the client.

I am managing a number of reasonably large multi-tenanted systems with your the WCF+SQL Azure architecture on the back end and it works fantastically well.

SQL Azure on its own does work well over the web to the point where I am even happy to run my Dev databases in azure but I don't think it's a good choice for a production app.

Hope this helps.

逆夏时光 2024-11-12 21:27:23

如果我们从逻辑上看的话,我自己还没有做过基准测试。

您会问 SQL Azure(S) + Entity Framework (EF) + WCFS + EF 哪个更快。

如果我们假设以查询参数和结果集的形式从云传输的数据的大小大致相同(除非 WCF 服务使用 SOAP 或其他 XML 格式,否则可能是这样,在这种情况下,WCF 肯定会传输更多数据)那么这两种方案之间的唯一区别就是 WCF 在中间进行的处理。虽然这种通信通常很小,但它不等于零,因此直接方法应该更快。

与速度无关,我认为仅仅为了托管此 WCF 服务而创建一个 Web/工作者角色并不值得。对于 10GB 的数据库,托管数据库的成本会增加一倍以上,并且会增加一定程度的复杂性,这似乎是不合理的。

如果您确实已经拥有托管 WCF 的角色,那么从设计角度来看这可能是有意义的,并且我认为这不会对性能产生太大影响(取决于所使用的传输方法和安全性)。

I haven't done the benchmarks myself if we look at this logically.

You're asking which is faster SQL Azure(S) + Entity Framework (EF) + WCF or S + EF.

If we presume that the data being transferred from the cloud in the form of query parameters and results sets is roughly the same size (which it probably is unless the WCF service is using SOAP or other XML format, it which case WCF will definitely be transferring more data) then only only difference between these two scenarios is the processing the WCF does in the middle. While that communication is usually pretty small, it's not equal to zero, so the direct approach should be quicker.

Unrelated to speed, I don't think it would be worth the effort to create a web/worker role just to host this WCF service. For a 10GB database you'd be more than doubling the cost of hosting the database and adding a level of complexity that doesn't seem to be justified.

If you do already have a role that it makes sense to host WCF on, then this could make sense from a design perspective and I don't think it would affect performance too much (depending on transport method and security used).

无所的.畏惧 2024-11-12 21:27:23

这有几个方面:

  • 性能
  • 成本
  • 安全性

在性能上,您的第一个选项有一个额外的跃点,因此它会更慢。但是,如果您有一个非常复杂的查询,则与总时间相比,两者之间的差异将非常小。

在成本方面,您的第一个选择将需要额外的实例来运行 WCF 服务,因此成本更高。

在安全性方面,您的第二个选项打开从互联网到数据库的端口,因此安全性较低。

There are several aspects to this:

  • Performance
  • Cost
  • Security

On Performance your first option has an extra hop, so it will be slower. But if you have a really complicated query, the difference between the two will be very small measure compared with the total time.

On Cost your first option will require an extra instance to run the WCF services therefore more cost.

On Security your second option opens a port to the database from the internet, therefore less secure.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文