[appengine-java] Re: Memory based application, static field, data lost

2010-10-26 Thread Ian Marshall
The GAE datastore is a form of persistent data storage, in that data
stored there will survive the discarding of instances of your
application (GAE will discard instances in cases of low usage).

Data stored in the memory cache can survive the discarding of
instances of your application, but there is no guarantee; data in the
memory cache may be discarded by GAE at any time.

My (Apache Wicket) web sessions are stored by GAE in both the memory
cache (for speed of access) and the datastore (for guarantee of
access) automatically. If you do not have much data, you could store
your data in a web session - but of course this data will have session
scope only - not application instance or all-application-instances
scope.

Since I want to store persistent data, I use the datastore. One could
be clever by using queued tasks to do this somehow, but I cannot be
bothered with the resultant complexity.


On Oct 26, 11:22 am, yoyo  wrote:
> Hello everyone.
>
> I've a issue when using my apps.
> All my logics application data are in memory.
>
> For exemple, I've a servlet like this :
>
> public class MyServlet {
>
> /** Logic application object, create when the class is loaded by the
> sandbox. */
> private static Logics myLogic = new Logics();
>
> /** Handle post request */
> protected void doPost( [...]) {
> myLogic.doStuff([...]);
>
> }
> }
>
> The doPost method don't take 30 seconds to be execute.
>
> My issue is this : Few minutes after my servlet is loaded and works,
> I've got a new instance of Logics.
> I thing AppEngine reload my class.
>
> I haven't read about this kind of comportment. Maybe I haven't read the
> docs enough.
>
> Must I use appengine api, like memcache ?
>
> Thanks for reading this newbie appengine developer message.
>
> Have a nice day.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Memory based application, static field, data lost

2010-10-26 Thread yoyo
Thanks for your answear.


So, GOE discard instances in cases of low usage. I didn't know.


My app is an image board, like 4chan.org.


The blowstore api in only available for billing account.
I can't use the blowstore because my app isn't commercial. I write it
only for fun and i don't want to pay for it.


I'll use the memcache service. It's not important if some of pictures
are lost. There is no guarantee, but I hope keep most of pictures into
it.
Else... well I'll see.


I've some refactoring to do. Thanks again for your answear.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Memory based application, static field, data lost

2010-10-26 Thread nischalshetty
GAE runs multiple instances which means your code would be run on
multiple JVMs as well which means the static field will be multiple as
well. A lot of "as wells" here but I hope you get the point.

Use statics for constants that do not change. For everything else
persist either in memcache or datastore.

-N

On Oct 26, 4:17 pm, yoyo  wrote:
> Thanks for your answear.
>
> So, GOE discard instances in cases of low usage. I didn't know.
>
> My app is an image board, like 4chan.org.
>
> The blowstore api in only available for billing account.
> I can't use the blowstore because my app isn't commercial. I write it
> only for fun and i don't want to pay for it.
>
> I'll use the memcache service. It's not important if some of pictures
> are lost. There is no guarantee, but I hope keep most of pictures into
> it.
> Else... well I'll see.
>
> I've some refactoring to do. Thanks again for your answear.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Memory based application, static field, data lost

2010-10-27 Thread Ian Marshall
Indeed.

Don't rely on the mem cache to keep your pictures for a long time,
since they will eventually be removed from the cache. The datastore is
GAE's sole persistent data store (except queued tasks in a non-
databasey way), and GAE give us a free amount of storage.


On Oct 26, 5:03 pm, nischalshetty  wrote:
> GAE runs multiple instances which means your code would be run on
> multiple JVMs as well which means the static field will be multiple as
> well. A lot of "as wells" here but I hope you get the point.
>
> Use statics for constants that do not change. For everything else
> persist either in memcache or datastore.
>
> -N
>
> On Oct 26, 4:17 pm, yoyo  wrote:
>
> > Thanks for your answear.
>
> > So, GOE discard instances in cases of low usage. I didn't know.
>
> > My app is an image board, like 4chan.org.
>
> > The blowstore api in only available for billing account.
> > I can't use the blowstore because my app isn't commercial. I write it
> > only for fun and i don't want to pay for it.
>
> > I'll use the memcache service. It's not important if some of pictures
> > are lost. There is no guarantee, but I hope keep most of pictures into
> > it.
> > Else... well I'll see.
>
> > I've some refactoring to do. Thanks again for your answear.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Memory based application, static field, data lost

2010-10-27 Thread Simon
Yoyo, you are aware that you only have to enable your account as
billable and that it doesn't actually cost anything as long as you
stay within the free quota?  See the Quota page for more info (http://
code.google.com/appengine/docs/quotas.html#Blobstore)

On Oct 27, 9:12 am, Ian Marshall  wrote:
> Indeed.
>
> Don't rely on the mem cache to keep your pictures for a long time,
> since they will eventually be removed from the cache. The datastore is
> GAE's sole persistent data store (except queued tasks in a non-
> databasey way), and GAE give us a free amount of storage.
>
> On Oct 26, 5:03 pm, nischalshetty  wrote:
>
> > GAE runs multiple instances which means your code would be run on
> > multiple JVMs as well which means the static field will be multiple as
> > well. A lot of "as wells" here but I hope you get the point.
>
> > Use statics for constants that do not change. For everything else
> > persist either in memcache or datastore.
>
> > -N
>
> > On Oct 26, 4:17 pm, yoyo  wrote:
>
> > > Thanks for your answear.
>
> > > So, GOE discard instances in cases of low usage. I didn't know.
>
> > > My app is an image board, like 4chan.org.
>
> > > The blowstore api in only available for billing account.
> > > I can't use the blowstore because my app isn't commercial. I write it
> > > only for fun and i don't want to pay for it.
>
> > > I'll use the memcache service. It's not important if some of pictures
> > > are lost. There is no guarantee, but I hope keep most of pictures into
> > > it.
> > > Else... well I'll see.
>
> > > I've some refactoring to do. Thanks again for your answear.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] Re: Memory based application, static field, data lost

2010-10-27 Thread yoyo
Thanks for your advices.

I'll use the datastore and the blobstore.

When I first write my app, I supposed my static field will probably be drop
by GAE, because of the non-use of API like memcache or datastore.
I try it, for fun and curiosity. It was interesting to understand WHY it was
a bad idea to do this.

Thanks again for your answear, and have a nice day.

2010/10/27 Simon 

> Yoyo, you are aware that you only have to enable your account as
> billable and that it doesn't actually cost anything as long as you
> stay within the free quota?  See the Quota page for more info (http://
> code.google.com/appengine/docs/quotas.html#Blobstore)
>
> On Oct 27, 9:12 am, Ian Marshall  wrote:
> > Indeed.
> >
> > Don't rely on the mem cache to keep your pictures for a long time,
> > since they will eventually be removed from the cache. The datastore is
> > GAE's sole persistent data store (except queued tasks in a non-
> > databasey way), and GAE give us a free amount of storage.
> >
> > On Oct 26, 5:03 pm, nischalshetty  wrote:
> >
> > > GAE runs multiple instances which means your code would be run on
> > > multiple JVMs as well which means the static field will be multiple as
> > > well. A lot of "as wells" here but I hope you get the point.
> >
> > > Use statics for constants that do not change. For everything else
> > > persist either in memcache or datastore.
> >
> > > -N
> >
> > > On Oct 26, 4:17 pm, yoyo  wrote:
> >
> > > > Thanks for your answear.
> >
> > > > So, GOE discard instances in cases of low usage. I didn't know.
> >
> > > > My app is an image board, like 4chan.org.
> >
> > > > The blowstore api in only available for billing account.
> > > > I can't use the blowstore because my app isn't commercial. I write it
> > > > only for fun and i don't want to pay for it.
> >
> > > > I'll use the memcache service. It's not important if some of pictures
> > > > are lost. There is no guarantee, but I hope keep most of pictures
> into
> > > > it.
> > > > Else... well I'll see.
> >
> > > > I've some refactoring to do. Thanks again for your answear.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.