Store pictures as files or in the database for a web app?

后端 未结 10 1811
孤城傲影
孤城傲影 2020-11-22 06:32

My question is fairly generic and I know there might not be an 100% answer to it. I\'m building an ASP .NET web solution that will include a lot of pictures and hopefully a

10条回答
  •  渐次进展
    2020-11-22 07:21

    Storing images in the database adds a DB overhead to serve single images and makes it hard to offload to alternate storage (S3, Akami) if you grow to that level. Storing them in the database makes it much easier to move your app to a different server since it's only the DB that needs to move now.

    Storing images on the disk makes it easy to offload to alternate storage, makes images static elements so you don't have to mess about with HTTP headers in your web app to make the images cacheable. The downside is if you ever move your app to a different server you need to remember to move the images too; something that's easily forgotten.

提交回复
热议问题