SQL Azure 与 WCF 性能对比
我看过很多有关 Azure 性能的基准测试,但我想知道是否有人知道/已经进行过比较,以了解以下哪种方案对于胖客户端应用程序表现更好。
连接到 WCF 服务以访问在云中运行的数据并连接到本地 SQL 数据库。举例来说,假设它是一个具有底层实体框架模型的 WCF 数据服务,该模型连接到 Azure 上的 SQL 数据库。
从客户端直接连接到 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.
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.
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我绝对会建议您使用 WCF+SQL Azure
SOA 背后的基本思想之一是构建简洁的界面,而不是繁琐的界面。当托管在云中时尤其如此,因为您的客户端不靠近数据。
如果您要填充复杂的业务对象,您可能必须运行许多查询。通过使用 WCF 服务与 SQL Azure 对话,您可以在 Azure 环境中运行所有这些查询,并将 Internet 往返次数降至最低。
当然,这样做的成本更高,但随着服务层可以扩展,它的扩展性更好。
这样做有很多好处。
我正在管理一些相当大的多租户系统,后端使用 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.
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.
如果我们从逻辑上看的话,我自己还没有做过基准测试。
您会问
SQL Azure(S) + Entity Framework (EF) + WCF
或S + 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
orS + 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).
这有几个方面:
在性能上,您的第一个选项有一个额外的跃点,因此它会更慢。但是,如果您有一个非常复杂的查询,则与总时间相比,两者之间的差异将非常小。
在成本方面,您的第一个选择将需要额外的实例来运行 WCF 服务,因此成本更高。
在安全性方面,您的第二个选项打开从互联网到数据库的端口,因此安全性较低。
There are several aspects to this:
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.