Mid-Large Asp.net MVC project: Storing images on filesystem or via SQL Server FILESTREAM [duplicate]

We have a ASP.NET MVC project with AngularJS and Entity Framework database-first, a news portal already in production for about a year. The project is mainly focused on providing content for users (articles, news and etc) and of course there is a lot of images. Currently we are storing the images in the File System and in SQL Server we store only the path.

The site today has something like 2000+ images (every day a lot of new images are uploaded so this number can grow very fast). The size of the images are on the average of 1 MB (but can also be larger).

Our client has requested (really don’t know the reasons..) for us to start saving the images inside the database, using SQL Server’s FILESTREAM. As a company, we had never developed any project using this technology. We already know that storing BLOB’s (as VARCHAR(MAX)) is a really bad approach but what about FILESTREAM? Is it really worth it?

The main objectives are:

  • FILESTREAM will offer better performance over time?
  • What about the way to manage (save, retrieve) images? Is it a lot of different than using System.IO.File ?
  • What about EntityFramework 5? Is it compatible? (Couldn’t really find actual answers for this on the internet)

The user can upload up to 10mb. Also, we have plans to let them also upload files (.pdf, .doc, .xls, even .mp3 max 10mb)

5

Since you’re talking about images in a context of a news portal, I imagine that those images are small JPEGs, not RAW files which can easily be 30 MB in size. In that case, FILESTREAM won’t be recommended, because its primary purpose is to host large files within the database.

For smaller objects (less than 1MB), storing varbinary(max) BLOBs in the database can provide better streaming performance.

Source: Best Practices on FILESTREAM implementations

FILESTREAM has one major benefit: you can store very large blobs of data without being limited by the amount of memory on your server. By storing this data within the database instead of plain file system, you make it possible to unify data management. For instance, system administrators can define the backup strategy once for the database, and don’t have to create a duplicate backup strategy for plain files.

But the benefit stops here. In other words, you get performance nearly identical to what you can get with plain files and the benefit of a single strategy, but there is nothing more there.

If you don’t need this unified management of data, don’t use FILESTREAM. Unfortunately, FILESTREAM is overrated in Microsoft community, leading many people to use it in projects which don’t need it.

FILESTREAM will offer better performance over time?

One of the benefits I can see is that you won’t need to query the path of the file any longer. Aside this, you won’t see a benefit of using FILESTREAM compared to direct access to a file, because you simply add a layer of complexity.

Beware of the exact location of your actual files and the possible location of FILESTREAMed files: if currently, the files are stored locally, and in FILESTREAM, they will be moved to the machines hosing SQL Server, you’ll have to consider the bandwidth usage between your app servers and your database servers.

What about the way to manage (save, retrieve) images? Is it a lot of different than using System.IO.File ?

No. Accessing files is really easy and similar to the way you access an ordinary file. You can easily find the examples on MSDN.

What about EntityFramework 5? Is it compatible? (Couldn’t really find actual answers for this on the internet)

It wasn’t supported yet in 2011. I don’t know if things changed since then, but in all cases, you’ll probably circumvent Entity Framework if you need to access data stored in a FILESTREAM (which won’t be difficult either).

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật