开发者

Avatar image: store in database or on CDN?

Avatar image: store in databa开发者_如何学Gose or on CDN?

Ps( avatar is the users profile photo)


If you store in database, the image file are uncacheable, because user browser will cache the image file by the link so that it don`t have to download the file again.

Normally, user avatar files are store in file dictionary, so it have a permalink for the image file.

You can use CDN to accelerate the loading speed and save the bandwidth of user avatar.


Why store it yourself when you can just use http://en.gravatar.com/ or similar like Stack Overflow uses?


Both ways have their advantages.

Storing images in the file system is of great advantage for applications that have:

  • Small and simple logic
  • Images that are static and doesn’t change very often
  • No concern for security
  • Extremely large images such as maps

Storing images in SQL Server is of great advantage for applications that have:

  • Highly sensitive image data such as medical x-rays or court evidence where security is extremely important
  • High availability requirements
  • Maintainability requirements
  • Very large size (such as a HR system with more than 200,000 employees with very fast movement of such as rehire and resignation)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜