You can store data in ThreadLocal as a cache, but it will be extremely
volatile, especially if we spin up/spin down instances. It's fine to use
this to cache data that you can easily regenerate. Just be aware that if you
hit memory limits, we will cull and restart that instance.

On Thu, Sep 16, 2010 at 12:50 PM, Francois Masurel <[email protected]> wrote:

> Each app instance runs in its own JVM.  So it should be safe to cache
> data in ThreadLocal.
>
> On 16 sep, 09:08, Maxim Veksler <[email protected]> wrote:
> > I would like to cache a not thread safe object, I'm hoping to improve
> > performance by caching it instead of instantiating new instance per
> request.
> >
> > Thanks,
> > Maxim.
> >
> > On Thu, Sep 16, 2010 at 8:12 AM, Guillaume Laforge <[email protected]
> >wrote:
> >
> >
> >
> > > What kind of data or information do you want to share through
> thread-locals
> > > between threads/requests?
> >
> > > On Thu, Sep 16, 2010 at 08:04, Maxim Veksler <[email protected]>
> wrote:
> >
> > >> I didn't say multi threaded.
> >
> > >> ThreadLocal gives access to the cached object of the current thread.
> > >> I'm doing an assumption here that appengine/j is implemented with
> thread
> > >> per incoming request.
> >
> > >> What I would like to know is if these threads are recycled (in which
> case
> > >> ThreadLocal is a good approach) or not.
> >
> > >> Thanks,
> > >> Maxim.
> >
> > >> On Thu, Sep 16, 2010 at 6:17 AM, Didier Durand <
> [email protected]>wrote:
> >
> > >>> Hi Maxim,
> >
> > >>> Multi-threading is not the way to go under GAEJ, see
> > >>>http://code.google.com/appe<
> http://code.google.com/appengine/docs/java/runtime.html#The_Sandbox>
> >
> > >> *I didn't say multi threaded. *
> >
> > >> ngine/docs/java/runtime.html#The_Sandbox<
> http://code.google.com/appengine/docs/java/runtime.html#The_Sandbox>
> >
> > >>> The right way to go is Tasks:
> > >>>http://code.google.com/appengine/docs/java/taskqueue/overview.html
> >
> > >>> regards
> >
> > >>> didier
> >
> > >>> On Sep 15, 2:00 pm, Maxim Veksler <[email protected]> wrote:
> > >>> > Hello,
> >
> > >>> > I'm wondering (after some internal discussion we had) is using
> > >>> ThreadLocal
> > >>> > for applications running on the AppEngine is performance beneficial
> ?
> >
> > >>> > For this to work AppEngine should recycle threads, right?
> >
> > >>> > Another question is how many threads does the appengine allows per
> JVM
> > >>> ?
> > >>> > Such ThreadLocal based approach would (probably) be inefficient if
> the
> > >>> JVM
> > >>> > allowed 20000 threads.
> >
> > >>> > Help is appreciated.
> > >>> > Maxim.
> >
> > >>> --
> > >>> 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
> > >>> [email protected].
> > >>> To unsubscribe from this group, send email to
> > >>> [email protected]<google-appengine-java%[email protected]><google-appengine-java%2B
> [email protected]>
> > >>> .
> > >>> 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
> > >> [email protected].
> > >> To unsubscribe from this group, send email to
> > >> [email protected]<google-appengine-java%[email protected]><google-appengine-java%2B
> [email protected]>
> > >> .
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/google-appengine-java?hl=en.
> >
> > > --
> > > Guillaume Laforge
> > > Groovy Project Manager
> > > Head of Groovy Development at SpringSource
> > >http://www.springsource.com/g2one
> >
> > > --
> > > 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
> > > [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<google-appengine-java%[email protected]><google-appengine-java%2B
> [email protected]>
> > > .
> > > 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
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to