Is it better to store a physical Image into datastore or a link to it?

寵の児 提交于 2019-12-12 01:47:38

问题


I need to store images and I have 2 options:

  • store the image into GAE datastore.
  • store the image somewhere (maybe also on Dropbox or another website) and store its link into GAE datastore.

What's the best practice when we need to store an image into DB, in the hypotesis that each image is bijectivelly linked to a specific element of the datastore?


回答1:


I think it depends heavily on the use case.

I have a small company website running on appengine and the content images are all stored in the datastore and for that application it works well (they are all relatively small images).

If you have a high traffic site you may find storing them in GCS, or some other mechanism that supports a more cost effective CDN will be more appropriate.

If the images are large (more than 1MB) then the datastore isn't a practical solution.

There will be no hard and fast rule. Understand your use cases, your cost structure, how complex the solution will be to manage, and then choose the most appropriate solution.




回答2:


Neither of the above. Google's cloud platform includes a service specifically for storing files, Google Cloud Storage, which is well integrated into GAE. You should use that.



来源:https://stackoverflow.com/questions/23712142/is-it-better-to-store-a-physical-image-into-datastore-or-a-link-to-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!