简体   繁体   English

对于负载均衡的ASP.NET应用程序,文件存储的最佳解决方案是什么?

[英]What's the best solution for file storage for a load-balanced ASP.NET app?

We have an ASP.NET file delivery app (internal users upload, external users download) and I'm wondering what the best approach is for distributing files so we don't have a single point of failure by only storing the app's files on one server. 我们有一个ASP.NET文件传递应用程序(内部用户上传,外部用户下载),我想知道分发文件的最佳方法是什么,所以我们只有将应用程序的文件存储在一个文件上才会出现单点故障服务器。 We distribute the app's load across multiple front end web servers, meaning for file storage we can't simply store a file locally on the web server. 我们将应用程序的负载分布在多个前端Web服务器上,这意味着对于文件存储,我们不能简单地在Web服务器上本地存储文件。

Our current setup has us pointing at a share on a primary database/file server. 我们当前的设置让我们指向主数据库/文件服务器上的共享。 Throughout the day we robocopy the contents of the share on the primary server over to the failover. 在一天中,我们将主服务器上共享的内容复制到故障转移。 This scneario ensures we have a secondary machine with fairly current data on it but we want to get to the point where we can failover from the primary to the failover and back again without data loss or errors in the front end app. 这个scneario确保我们有一台辅助机器上有相当新的数据,但是我们希望能够从主服务器故障转移到故障转移,然后再返回,而不会丢失前端应用程序中的数据或错误。 Right now it's a fairly manual process. 现在,这是一个相当手动的过程。

Possible solutions include: 可能的方案包括:

  • Robocopy. 的Robocopy。 Simple, but it doesn't easily allow you to fail over and back again without multiple jobs running all the time (copying data back and forth) 很简单,但它不容易让您在没有多个作业一直运行的情况下进行故障转移和返回(来回复制数据)
  • Store the file in a BLOB in SQL Server 2005. I think this could be a performance issue, especially with large files. 将文件存储在SQL Server 2005中的BLOB中。我认为这可能是性能问题,尤其是对于大文件。
  • Use the FILESTREAM type in SQL Server 2008 . 在SQL Server 2008中使用FILESTREAM类型 We mirror our database so this would seem to be promising. 我们镜像我们的数据库,所以这看起来很有希望。 Anyone have any experience with this? 有人对此有经验吗?
  • Microsoft's Distributed File System . 微软的分布式文件系统 Seems like overkill from what I've read since we only have 2 servers to manage. 由于我们只有2台服务器需要管理,因此从我读过的东西看起来有些过分。

So how do you normally solve this problem and what is the best solution? 那么你通常如何解决这个问题,什么是最好的解决方案?

Consider a cloud solution like AWS S3 . 考虑像AWS S3这样的云解决方案。 It's pay for what you use, scalable and has high availability. 它是您使用,可扩展和高可用性的代价。

You need a SAN with RAID. 你需要一个带RAID的SAN。 They build these machines for uptime. 他们为正常运行时间构建这些机器。

This is really an IT question... 这真的是一个IT问题......

When there are a variety of different application types sharing information via the medium of a central database, storing file content directly into the database would generally be a good idea. 当存在通过中央数据库的介质共享信息的各种不同应用程序类型时,将文件内容直接存储到数据库中通常是个好主意。 But it seems you only have one type in your system design - a web application. 但似乎您的系统设计中只有一种类型 - 一种Web应用程序。 If it is just the web servers that ever need to access the files, and no other application interfacing with the database, storage in the file system rather than the database is still a better approach in general. 如果它只是需要访问文件的Web服务器,并且没有其他应用程序与数据库连接,那么文件系统而不是数据库中的存储通常仍然是更好的方法。 Of course it really depends on the intricate requirements of your system. 当然,这实际上取决于系统的复杂要求。

If you do not perceive DFS as a viable approach, you may wish to consider Failover clustering of your file server tier , whereby your files are stored in an external shared storage (not an expensive SAN, which I believe is overkill for your case since DFS is already out of your reach) connected between Active and Passive file servers. 如果您不认为DFS是一种可行的方法,您可能希望考虑文件服务器层的故障转移群集 ,从而将您的文件存储在外部共享存储中(而不是昂贵的SAN,我相信自DFS以来您的情况有些过分在Active和Passive文件服务器之间连接,已经无法实现。 If the active file server goes down, the passive may take over and continue read/writes to the shared storage. 如果活动文件服务器关闭,则被动可以接管并继续读/写共享存储。 Windows 2008 clustering disk driver has been improved over Windows 2003 for this scenario (as per article), which indicates the requirement of a storage solution supporting SCSI-3 (PR) commands. 对于此方案(根据文章),Windows 2008群集磁盘驱动程序已针对Windows 2003进行了改进,这表明支持SCSI-3(PR)命令的存储解决方案的要求。

I agree with Omar Al Zabir on high availability web sites: 我同意Omar Al Zabir在高可用性网站上的观点

Do: Use Storage Area Network (SAN) 执行:使用存储区域网络(SAN)

Why: Performance, scalability, reliability and extensibility. 原因:性能,可伸缩性,可靠性和可扩展性。 SAN is the ultimate storage solution. SAN是最终的存储解决方案。 SAN is a giant box running hundreds of disks inside it. SAN是一个巨大的盒子,里面有数百个磁盘。 It has many disk controllers, many data channels, many cache memories. 它有许多磁盘控制器,许多数据通道,许多高速缓存存储器。 You have ultimate flexibility on RAID configuration, adding as many disks you like in a RAID, sharing disks in multiple RAID configurations and so on. 您具有RAID配置的最大灵活性,可在RAID中添加任意数量的磁盘,在多个RAID配置中共享磁盘等。 SAN has faster disk controllers, more parallel processing power and more disk cache memory than regular controllers that you put inside a server. 与您放入服务器的常规控制器相比,SAN具有更快的磁盘控制器,更多的并行处理能力和更多的磁盘缓存。 So, you get better disk throughput when you use SAN over local disks. 因此,当您在本地磁盘上使用SAN时,可以获得更好的磁盘吞吐量。 You can increase and decrease volumes on-the-fly, while your app is running and using the volume. 您可以在应用程序运行和使用卷的同时增加和减少卷。 SAN can automatically mirror disks and upon disk failure, it automatically brings up the mirrors disks and reconfigures the RAID. SAN可以自动镜像磁盘,在磁盘发生故障时,它会自动调出镜像磁盘并重新配置RAID。

Full article is at CodeProject. 全文在CodeProject。

Because I don't personally have the budget for a SAN right now, I rely on option 1 (ROBOCOPY) from your post. 因为我个人现在没有个人预算,所以我依靠您帖子中的选项1(ROBOCOPY)。 But the files that I'm saving are not unique and can be recreated automatically if they die for some reason so absolute fault-tolerance is necessary in my case. 但是我保存的文件并不是唯一的,如果它们因某种原因死亡,可以自动重新创建,因此在我的情况下绝对容错是必要的。

I suppose it depends on the type of download volume that you would be seeing. 我想这取决于您将看到的下载量类型。 I am storing files in a SQL Server 2005 Image column with great success. 我将文件存储在SQL Server 2005 Image列中并取得了巨大成功。 We don't see heavy demand for these files, so performance is really not that big of an issue in our particular situation. 我们没有看到对这些文件的大量需求,因此在我们的特定情况下,性能确实不是那么大的问题。

One of the benefits of storing the files in the database is that it makes disaster recovery a breeze. 将文件存储在数据库中的好处之一是它使灾难恢复变得轻而易举。 It also becomes much easier to manage file permissions as we can manage that on the database. 管理文件权限也变得更加容易,因为我们可以在数据库上管理它。

Windows Server has a File Replication Service that I would not recommend. Windows Server有一个我不推荐的文件复制服务。 We have used that for some time and it has caused alot of headaches. 我们已经使用了一段时间,它引起了很多麻烦。

DFS is probably the easiest solution to setup, although depending on the reliability of your network this can become un-synchronized at times, which requires you to break the link, and re-sync, which is quite painful to be honest. DFS可能是最容易设置的解决方案,虽然根据网络的可靠性,这有时会变得不同步,这需要你打破链接,并重新同步,这是非常痛苦的。

Given the above, I would be inclined to use a SQL Server storage solution, as this reduces the complexity of your system, rather then increases it. 鉴于上述情况,我倾向于使用SQL Server存储解决方案,因为这会降低系统的复杂性,而不是增加它。

Do some tests to see if performance will be an issue first. 做一些测试,看看性能是否会成为问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将Asp.net应用程序移动到负载平衡的环境中 - Moving an Asp.net application to a load-balanced environment 负载平衡的ASP.NET Web应用程序中的跨服务器通信 - Cross-server communication in load-balanced ASP.NET web application 如何在负载平衡的Web场中处理ASP.NET应用程序变量 - How to handle ASP.NET Application variables in a load-balanced web farm 将视频嵌入ASP.NET网站的最佳解决方案是什么? - What's the best solution for embedding video into an ASP.NET website? IIS应用程序池在Azure负载平衡的VM上崩溃 - IIS app pool crashing on Azure load-balanced VMs 从控制台应用程序中的ASP.NET Razor模板生成HTML的当前最佳解决方案是什么? - What's the current best solution for generating HTML from ASP.NET Razor templates within a Console Application? 在ASP.NET MVC中显示数据的最佳解决方案是什么? - What is the best solution for displaying data in ASP.NET MVC? 在ASP.NET中为命中计数器实现存储的最佳方法是什么? - What is the best way to implement storage for a hit counter in ASP.NET? 负载平衡服务器上的ASP.NET窗体身份验证 - ASP.NET Forms Authentication on Load Balanced Servers ASP.Net - 在负载平衡环境中处理会话数据? - ASP.Net - Handling session data in a load balanced environment?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM