[google-appengine] Re: Noobie: Sharing a collection of in-memory objects between instances.

2013-06-08 Thread Vinny P

On Thursday, June 6, 2013 4:27:59 AM UTC-5 wrote:

 My app is using a in-memory list that is accessed very often by font-end 
 clients, my solution before was to use a static list. After gaining more 
 info on GAE I know now that this wont be good because each instance would 
 have it's own list (right?).


It depends on how you architect your application. Written correctly, all 
instances can share a data list.

On Thursday, June 6, 2013 4:27:59 AM UTC-5 wrote:

 So, are backends the best fit for that?


There's nothing wrong with frontend instances for this job. Backends are 
more for long-running processes.

Before anyone can give you a definitive answer, you need to give some more 
information about this problem. For instance, how many elements are in this 
list? What is the size of each element? How are you moving this list from 
the server to the client? How often does this list change?

You said this list was static, so I assume this list won't be changing 
very often. In that case, you can use the memcache/datastore as Thiago 
suggested: Put each list element as an entity in the datastore, and set a 
cron to periodically pull a copy of the list and store it into memcache. 
Then your front end instances can pull the data from memcache/datastore. 
This way all your instances will share the same list.

If this list is changing very rarely, what you can do is store it as a file 
in a Google Cloud Storage bucket, and configure the bucket as a website ( 
https://developers.google.com/storage/docs/website-configuration ). 
Whenever you need to change the list, your application on AppEngine can 
update the file: https://developers.google.com/storage/docs/xml-api-overview . 
You're also saving money this way since there's much less instance hours 
incurred.


-
-Vinny P
Technology  Media Advisor
Chicago, IL

My Go side project: http://invalidmail.com/

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[google-appengine] Re: Noobie: Sharing a collection of in-memory objects between instances.

2013-06-07 Thread Alex Burgel
On Thursday, June 6, 2013 5:27:59 AM UTC-4, Mohammad Al Quraian wrote:

 I'm just starting with GAE, so bare my ignorance. My app is using a 
 in-memory list that is accessed very often by font-end clients, my solution 
 before was to use a static list. After gaining more info on GAE I know now 
 that this wont be good because each instance would have it's own list 
 (right?).
 So, are backends the best fit for that? Is there another solution?
 The issue is the the backend has to be up throughout the app lifetime, 
 just for holding a simple list that is not even that big. Would that be 
 costly $wise?


if the list is not that big, then maybe its ok to keep in memory on each 
instance. the F1 instance type has 128mb of ram. you can choose bigger 
instance sizes too.

if it doesn't fit, then you could store it as rows in the datastore and 
query against it.

you could also use memcache, but each key+value must be less than 1mb. so 
you would probably have to break it up into smaller pieces like you might 
if you put it in the datastore.

backends would also work, its kinda the same thing as keeping it in memory 
on a frontend instance, except that you can scale them independently of 
your web traffic. so the choice would depend on your traffic patterns and 
whether you want to add that complexity to your app.

--alex

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.