google-app-engine


Storing images and structured data together (Google Cloud Platform)


I am building a cloud service with Google Cloud Platform but I don't have much experience using it (yet)
My service will, among other things, store structured entities with properties such as a Name, Description etc. However, I also want each entity to be associated in some way with a collection of images which could have dozens or even hundreds of images.
Looking at the storage options GCP offers the structured nature of my data would suggest I should use Datastore and the images being 'unstructured' should use regular Storage (probably stored in folders to keep images from a particular entity together).
My question is a) is this a reasonable approach for my use case?
if so b) How do I link the two things together?
or if not b) What is the best way to store these?
Your approach sounds OK to me, I'd do it the same way.
As for linking the datastore structured entity to the images an alternate, more scalable approach to that suggested by Andrei Volgin would be to have multiple mapping entitites - one per associated image, containing as properties:
the datastore structured entity's key (or key ID)
the storage name/location of the image
The advantages of such approach (especially when the number of images associated with one structured entity is high) are:
no 1 write/sec limitation on adding/deleting images for the same structured entity
no contention on the structured entity itself when trying to obtain image locations from multiple simultaneous requests
no performance degradation with the increase of the number of images associated to a structured entity (due to the increased entity size needed to be serialized); the size of the structured entity remains small
The disadvantage would be that you need an additional query to obtain the info about the images associated to a structured entity.
These mapping entities can contain additional structured image-related information, if eventually needed.
Your Datastore entities may have a property that contains a list of image file names. Assuming that you put each image in a "folder" that represents the entity ID/Name, you can display an image by simply calling (for example):
"https://storage.googleapis.com/MY_BUCKET/" + entity.getId() + "/" + IMAGE_NAME;
In several of my projects I need to store more data about each image, e.g. its order, orientation, and size. In this case I create an entity to represent each image in Datastore. In some cases I use embedded entities - for example, a product entity contains a list of embedded entities representing images related to this product. This approach allows me to display a list of products with images without an extra query to get images for each product.
I would use two different kind of entities. ex. Album and Images and organize them by using the ancestor path like a file structure. Then I could easily add a Comment entity kind as child of Images.
Example of 2 entities [TaskList:default, Task:sampleTask]
$taskKey = $datastore->key('TaskList', 'default')
->pathElement('Task', 'sampleTask');
Read more about Ancestor paths

Related Links

What does _ah mean in Google App Engine?
Spring Roo with GAE error on most basic tests
Running a web crawler for selected sites on google app engine?
Many-to-many relationship modeling in google app engine
Appengine: ClassCastException in query with string of leng
How to integrate user quotas?
Restlet that works on localhost throws NullPointerException when deployed on GAE
No module named Crypto.Cipher on local mac AppEngine
Should I use a GZIP compression middleware or not?
AppEngine vs. sendmail space problem
nosetests 'cannot import name mkdir'
What is the benefit / usage of a AppEngine remote procedure call
How use AppEngine's Datastore Admin: Copy to Another App Feature
Balancing server/client load for autocompletion search
AppEngine: Reading values/settings from app.yaml
Google App Engine - inline/iframe log-in

Categories

HOME
windows
kentico
localization
google-spreadsheet
sitecore
socket.io
nsbundle
rom
visual-studio-emulator
interpolation
jquery-ui
tvos
google-chrome-app
gkturnbasedmatch
dynatrace
bitnami
parameter-passing
package-managers
coin3d
sencha-touch
boost-icl
kendo-mobile
string-concatenation
aggregation
jquery-callback
direct3d11
mount
interbase
rpgle
realm-mobile-platform
userdefaults
mustache
kodi
android-sugarorm
dynamic-jasper
swagger-php
parse-tree
z-notation
password-protection
recurrent-neural-network
diacritics
setup.py
postgresql-8.4
placeholder
angular-http
getchar
geotiff
payara-micro
appdomain
subnet
avx
arules
bbpress
trigger.io
py2neo
testrail
visual-studio-2008-sp1
cronexpression
reporting-services-2012
jodd
refinerycms
cassia
kango-framework
tracker-enabled-dbcontext
kiosk
kendo-upload
jparsec
user-management
directdraw
sapi
grgit
terracotta
morton-number
intel-c++
ons-api
.bash-profile
canalyzer
nsurlsessiondatatask
iiop
administration
iso-prolog
universal-image-loader
strawberry-perl
gii
lnk
websphere-esb
getopt
mysql-error-1044
joomla-template
mysql-error-2013
asplinkbutton
resource-management
robotlegs
curb
os.system
fitbounds
wiimote
procedures
strsep
squishit
non-clustered-index
addchild
google-wave
asynchronous-wcf-call
xpsdocument
firefox-3
wcf-proxy

Resources

Encrypt Message