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

时间:2022-04-23 17:42:56

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. 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.

我们有一个ASP.NET文件传递应用程序(内部用户上传,外部用户下载),我想知道分发文件的最佳方法是什么,所以我们只有将应用程序的文件存储在一个文件中就没有单点故障服务器。我们在多个前端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. Right now it's a fairly manual process.

我们当前的设置让我们指向主数据库/文件服务器上的共享。在整个一天中,我们将主服务器上共享的内容复制到故障转移。这个scneario确保我们有一台辅助计算机上有相当新的数据但我们希望能够从主服务器故障转移到故障转移,然后再返回,而不会丢失数据或前端应用程序中的错误。现在,这是一个相当手动的过程。

Possible solutions include:

可能的方案包括:

  • 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)
  • 的Robocopy。很简单,但它不容易让您在没有多个作业一直运行的情况下进行故障转移和返回(来回复制数据)
  • 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. We mirror our database so this would seem to be promising. Anyone have any experience with this?
  • 在SQL Server 2008中使用FILESTREAM类型。我们镜像我们的数据库,所以这看起来很有希望。有人对此有经验吗?
  • 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?

那么你通常如何解决这个问题,什么是最好的解决方案?

6 个解决方案

#1


2  

Consider a cloud solution like AWS S3. It's pay for what you use, scalable and has high availability.

考虑像AWS S3这样的云解决方案。它是您使用,可扩展和高可用性的代价。

#2


1  

You need a SAN with RAID. They build these machines for uptime.

您需要一个带RAID的SAN。他们为正常运行时间构建这些机器。

This is really an IT question...

这真的是一个IT问题......

#3


1  

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. 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. Of course it really depends on the intricate requirements of your system.

当存在通过*数据库的介质共享信息的各种不同应用程序类型时,将文件内容直接存储到数据库中通常是个好主意。但似乎您的系统设计中只有一种类型 - Web应用程序。如果它只是需要访问文件的Web服务器,而没有其他应用程序与数据库连接,那么文件系统而不是数据库中的存储通常仍然是更好的方法。当然,这实际上取决于系统的复杂要求。

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. 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.

如果你不认为DFS作为一种可行的方法,您不妨考虑一下你的文件服务器层,因此您的文件存储在外部共享存储(而不是昂贵的SAN,我相信这是矫枉过正,因为DFS的情况下故障转移群集在Active和Passive文件服务器之间连接,已经无法实现。如果活动文件服务器关闭,则被动可以接管并继续读/写共享存储。对于此方案,Windows 2008群集磁盘驱动程序已针对Windows 2003进行了改进(根据文章),这表明支持SCSI-3(PR)命令的存储解决方案的要求。

#4


0  

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 is a giant box running hundreds of disks inside it. 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. SAN has faster disk controllers, more parallel processing power and more disk cache memory than regular controllers that you put inside a server. So, you get better disk throughput when you use SAN over local disks. 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是最终的存储解决方案。 SAN是一个巨大的盒子,里面有数百个磁盘。它有许多磁盘控制器,许多数据通道,许多高速缓存存储器。您具有RAID配置的最大灵活性,可在RAID中添加任意数量的磁盘,在多个RAID配置*享磁盘等。与您放入服务器的常规控制器相比,SAN具有更快的磁盘控制器,更多的并行处理能力和更多的磁盘高速缓存。因此,在本地磁盘上使用SAN时,可以获得更好的磁盘吞吐量。您可以在应用程序运行并使用卷的同时增加和减少卷。 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. 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.

因为我现在没有亲自拥有SAN的预算,所以我依靠您帖子中的选项1(ROBOCOPY)。但是我保存的文件并不是唯一的,如果它们因某种原因死亡,可以自动重新创建,因此在我的情况下,绝对容错是必要的。

#5


0  

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. We don't see heavy demand for these files, so performance is really not that big of an issue in our particular situation.

我想这取决于您将看到的下载量类型。我将文件存储在SQL Server 2005 Image列中并取得了巨大成功。我们没有看到对这些文件的大量需求,因此在我们的特定情况下,性能确实不是那么大的问题。

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. We have used that for some time and it has caused alot of headaches.

Windows Server有一个我不推荐的文件复制服务。我们已经使用了一段时间,它引起了很多麻烦。

#6


0  

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.

做一些测试,看看性能是否会成为首要问题。

#1


2  

Consider a cloud solution like AWS S3. It's pay for what you use, scalable and has high availability.

考虑像AWS S3这样的云解决方案。它是您使用,可扩展和高可用性的代价。

#2


1  

You need a SAN with RAID. They build these machines for uptime.

您需要一个带RAID的SAN。他们为正常运行时间构建这些机器。

This is really an IT question...

这真的是一个IT问题......

#3


1  

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. 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. Of course it really depends on the intricate requirements of your system.

当存在通过*数据库的介质共享信息的各种不同应用程序类型时,将文件内容直接存储到数据库中通常是个好主意。但似乎您的系统设计中只有一种类型 - Web应用程序。如果它只是需要访问文件的Web服务器,而没有其他应用程序与数据库连接,那么文件系统而不是数据库中的存储通常仍然是更好的方法。当然,这实际上取决于系统的复杂要求。

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. 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.

如果你不认为DFS作为一种可行的方法,您不妨考虑一下你的文件服务器层,因此您的文件存储在外部共享存储(而不是昂贵的SAN,我相信这是矫枉过正,因为DFS的情况下故障转移群集在Active和Passive文件服务器之间连接,已经无法实现。如果活动文件服务器关闭,则被动可以接管并继续读/写共享存储。对于此方案,Windows 2008群集磁盘驱动程序已针对Windows 2003进行了改进(根据文章),这表明支持SCSI-3(PR)命令的存储解决方案的要求。

#4


0  

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 is a giant box running hundreds of disks inside it. 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. SAN has faster disk controllers, more parallel processing power and more disk cache memory than regular controllers that you put inside a server. So, you get better disk throughput when you use SAN over local disks. 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是最终的存储解决方案。 SAN是一个巨大的盒子,里面有数百个磁盘。它有许多磁盘控制器,许多数据通道,许多高速缓存存储器。您具有RAID配置的最大灵活性,可在RAID中添加任意数量的磁盘,在多个RAID配置*享磁盘等。与您放入服务器的常规控制器相比,SAN具有更快的磁盘控制器,更多的并行处理能力和更多的磁盘高速缓存。因此,在本地磁盘上使用SAN时,可以获得更好的磁盘吞吐量。您可以在应用程序运行并使用卷的同时增加和减少卷。 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. 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.

因为我现在没有亲自拥有SAN的预算,所以我依靠您帖子中的选项1(ROBOCOPY)。但是我保存的文件并不是唯一的,如果它们因某种原因死亡,可以自动重新创建,因此在我的情况下,绝对容错是必要的。

#5


0  

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. We don't see heavy demand for these files, so performance is really not that big of an issue in our particular situation.

我想这取决于您将看到的下载量类型。我将文件存储在SQL Server 2005 Image列中并取得了巨大成功。我们没有看到对这些文件的大量需求,因此在我们的特定情况下,性能确实不是那么大的问题。

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. We have used that for some time and it has caused alot of headaches.

Windows Server有一个我不推荐的文件复制服务。我们已经使用了一段时间,它引起了很多麻烦。

#6


0  

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.

做一些测试,看看性能是否会成为首要问题。