在 Amazon Web Services 上扩展 SQL Server
我目前有一个 Web 应用程序,我想使用 Amazon Web Services 进行扩展。
我的 Web 应用程序规格:
C# ASP.NET SQL Server
我为我的用户提供了文件存储,并为我的所有数据提供了 SQL Server 数据库。我想使用 S3 在 Amazon Web Services 上进行扩展。我不确定如何在 Amazon Web Services 上使用 SQL Server 进行扩展? Amazon Relational Database Service 看起来与 SQL Server 不同。我可以在 Windows 实例上运行它吗?我将如何扩展。
I currently have a web application that I would like to scale out using Amazon Web Services.
My web application specs:
C# ASP.NET SQL Server
I have a file storage for my users and have a SQL Server database for all my data. I want to scale on Amazon Web Services, using S3. I am not sure how to scale with SQL Server on Amazon Web Services? The Amazon Relational Database Service doesn't look like its for SQL Server. Would I just run it on a windows instance? How would I scale.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的应用程序中有两个不同的元素。其中一个是应用程序服务器,它负责保存 ASP .Net 应用程序,另一个是数据库服务器。
Web 应用程序服务器本质上是无状态的,因此扩展应用程序服务器将非常容易。只需将应用程序部署在多个实例上,然后在它们前面放置一个负载均衡器即可。
对于数据库服务器来说,事情要复杂得多。关系数据库由于其事务和关系性质,很难横向扩展,这通常需要在应用程序级别编写自定义代码以支持横向扩展方案。这实际上是一个重要的方面,因为可扩展性不能简单地通过添加更多硬件(更多机器)来透明地实现,而且您还必须投资于编码。使用 Sql Server 进行扩展的两种最流行的方法可能是镜像和分区。当 Sql Server 部署在云中时,云本身不会以任何方式帮助进行扩展,它仍然基于内置选项。
除了所涉及的复杂性之外,在非自由数据库解决方案上,在一定程度上,水平扩展可能比垂直扩展要昂贵得多。例如,考虑以下场景:
1 x 10000$ 计算机 + 1 x 8000$ Sql Server 专业许可证 = 18000$
10 x 1000$ 计算机 + 10 x 8000$ Sql Server 专业许可证 = 90000$
因为它只需要一个 Sql Server 许可证,一台昂贵的机器最终会比使用 10 台带有 10 个许可证的廉价机器便宜得多。
现在我已经到了在云中进行扩展的阶段,事情变得有点复杂了。云提供商提供给你的本质上是虚拟机。虚拟机非常适合对 CPU 和 RAM 内存进行分区,如有必要,您可以通过添加更多 CPU 功率和更多内存来为计算机添加更多功能。这很好,但数据库高度依赖 I/O(硬盘)速度,而这正是虚拟机表现不佳的领域。
与Amazon云产品和Sql Server相关,我可以推荐这个< /a> 非常好的文章(实际上我是通过@marc_s 提供的链接找到的)。为了在扩展场景中获得良好的 I/O 速度,作者使用 EBS 卷。这种方法的问题在于,EBS 卷不是部署数据库的服务器内部的硬盘,而是可通过网络访问的存储卷,这会大大降低其效率。
如果您不依赖亚马逊,那么您可以尝试在其基础设施中提供物理机(专用服务器)的云提供商。据我所知 gogrid 正在这样做,但可能还有其他人。这个想法是将数据库部署在专用服务器上(良好的 I/O 性能),将应用程序服务器部署在虚拟机上(可水平扩展)。
微软还有一个云产品,称为Windows Azure,它可能是目前最有趣的产品之一,但在我看来,他们的关系数据库产品让它失望了。他们为此提供了专门的服务,称为Sql Azure。它的主要优点之一是它比普通数据库更容易管理,但缺点是它的扩展性非常有限。唯一的扩展选项是数据库大小,最多只能达到 50Gb。他们没有提到任何有关数据库提供的性能的信息,您也不能进行任何与之相关的配置。其性能很可能低于廉价的专用服务器(事实上,StackOverflow 上有一些帖子,人们抱怨 Sql Azure 的速度与物理机相比)。您可以使用分片进行扩展,但如上所述,这确实会影响和限制数据库结构及其在代码中使用的方式。
结论:
There are two different elements in your application. There is the application server, which is the one holding the ASP .Net application and there is the database server.
Web application servers are stateless in nature so scaling out the application server is going to be very easy. Simply deploy the application on multiple instances and then put a load balancer in front of them.
For the database server things are quite more complicated. Relational databases, because of their transactional and relational nature, are very hard to scale out and that will usually involve writing custom code at application level just to support the scale out scheme. This is actually an important aspect, because scalability won't simply be achieved transparently by adding more hardware (more machines) but you will also have to invest in coding. Probably two of the most popular ways of scaling out with Sql Server is by mirroring and by partitioning. Scaling out when Sql Server is deployed inside a cloud is not helped in any way by the cloud itself, it will still be base on the built in options.
Besides the complexity it involves, up to a certain level, on non-free DB solutions, horizontal scaling might turn out to be much more expensive than the vertical one. Consider the following scenarios for example:
1 x 10000$ machine + 1 x 8000$ Sql Server professional license = 18000$
10 x 1000$ machines + 10 x 8000$ Sql Server professional licenses = 90000$
Because it requires only one Sql Server license, an expensive machine will be much cheaper in the end than using 10 cheap machines with 10 licenses.
And now that I've come to the point of scaling up in cloud things complicate a bit. What cloud providers give you are essentially virtual machines. Virtual machines are quite good on partitioning CPU and RAM memory and if necessary you can add more power to your machine by adding more CPU power and more memory. That is fine, but databases are highly dependent on the I/O (hard disk) speed and that is one area where virtual machines are not great.
Related to the Amazon cloud offer and Sql Server I can recommend this very good article (I actually got to it by following the link supplied by @marc_s). In order to achieve good I/O speed on scaling up scenarios, the author is using EBS volumes. The problem with this approach is that the EBS volumes are not hard disks inside the server where you have deployed the DB, but rather storage volumes accessible over the network and that reduces their efficiency by quite a lot.
If you are not tied to Amazon, then you might try cloud providers that also offer physical machines (dedicated servers) in their infrastructure. As far as I know gogrid are doing that, but there might be others as well. The idea would be to deploy the database on a dedicated server (good I/O performance) and the application servers on virtual machines (which will be horizontally scalable).
Microsoft also has a cloud offer, which is called Windows Azure and it might be one of the most interesting at the moment, but in my opinion it is being let down by their relational database offering. They have a dedicated service for that, called Sql Azure. One of its main advantages is that it is easier to administer than a normal database, but on the downside it is quite limited to scaling. The only scaling option is in the database size and that only goes up to 50Gb. They don't mention anything about the performance that DB is delivering, nor can you do any configurations related to that. Chances are that the performance are lower than those of a cheap dedicated server (in fact there are posts on StackOverflow with people complaining on the Sql Azure speed compared to physical machines). You can scale out using sharding, but as mentioned above, this does impact and limit the DB structure and the way it used in code.
In conclusion:
如果您想轻松扩展,您可能需要查看 Windows Azure (www.microsoft.com/windowsazure)。 Azure 允许您“按需付费”——为您实际使用的带宽和存储付费,同时使其基本上成为一个可横向扩展的配置设置。
在亚马逊上,你得到的只是一堆虚拟机——如果你想横向扩展的话,需要做很多工作才能将其变成一个网络场和一个 SQL Server 集群。另外,在集群情况下,SQL Server 许可证会变得非常昂贵。但如果您想从小规模开始,您始终可以拥有一个用于 Web 服务器的 Amazon VM(托管 ASP.NET 应用程序)和一个运行 SQL Server 的 VM。
You might want to check out Windows Azure (www.microsoft.com/windowsazure) if you want to scale easily. Azure lets you "pay as you go" - paying for the bandwidth and storage you actually use while making it basically a config setting to scale out.
With Amazon all you get is a bunch of virtual machines - there's a lot of work to do to turn that into a web farm and a SQL Server cluster if thats how you want to scale out. Plus SQL Server licenses get very expensive in a clustered situation. But if you want to start small, you can always have a single Amazon VM for web server, hosting your ASP.NET app, and a single VM running SQL Server.