This sounds a lot like the sharded counter scenario. I think they came up with a committing to datastore strategy that worked well.
On another hand, you can always queue a task and let the task queue persist the preferences when it gets around to it. On Mon, May 24, 2010 at 11:16, Rahul <[email protected]> wrote: > Ok. Let me explain the complete scenario. > > Suppose I have lot of preference on my page which are stored in the > database. Now i have multiple options, > 1. Load all the preference in Hashmap in a servlet and mark that > servlet as Load-on-startup to 0 and then use the hashmap cache when a > new user visits the page. User can also change the values of > preference and yes if one use change the preference it will be > globally changed for all the new users coming to that page. > 2. Create a memcache and load the cache in a servlet with load-on- > startup as 0. When any new user comes read the memcache and if the > value is present use that else go to the database (which will almost > never happen as i will update the memcache when some user change the > preferences). > > I also have a requirement if ever a user changes the preferences i > need to store the new preference in the database so where should we > persist this, I mean on some specific time or when the user changes > immediately. > > Any pointer. > > Thanks, > Rahul > > On May 24, 9:47 am, Rahul <[email protected]> wrote: > > Chau, > > > > I have already tried various solutions out of those mentioned above, > > including "b) request Google to load your app before start dispatch > > request to that instance " but it is still slow, My exact question is > > when to put the data in cache. > > > > Thanks, > > Rahul > > > > On May 24, 4:49 am, Chau Huynh <[email protected]> wrote: > > > > > > > > > > > > > Hi Rahul, > > > > > About loading request/performance, there're lots of discussions that > you can > > > find in the groups, please just try google it. > > > > > Here are some notes based on reading those. > > > Latency causes by > > > 1- time to start new JVM > > > 2- time to load your application > > > > > To reduce load time by 1) others star request to > > > a) pay to reserve JVM > > > b) request Google to load your app before start dispatch request to > that > > > instance > > > c) accept the situation > > > > > For 2) we try to > > > a- try to use/replace frameworks with light-weight ones: datastore > access > > > framework, MVC framework,... > > > b- try to limit calculation in your index page to alleviate the impact > of > > > loading request > > > c- design your object model based on your need, so that you do > calculation > > > at insert time, not at query time. For example, in my app, if I want to > > > report on year and quarter, then I have 5 summary "record" for those, > > > instead of querying and computing those > > > d- caching result. For example, If I know 1 one 5 piece of data above > would > > > be read frequently, then I will read those 5 all, and put into memcache > for > > > later use > > > ... > > > > > So it's application-specific, I don't know if each of above can help > you. > > > But only you who can know if which one of your code can be cached and > how... > > > > > HTH > > > > > On Sun, May 23, 2010 at 11:37 AM, Rahul <[email protected]> > wrote: > > > > Chau, > > > > > > Thanks for pointing to the link. I did go through the link and i > > > > think, what i thought was right. > > > > Also i was going through the following point in the section you > > > > provided : "How can I speed up loading requests? " and the second > > > > point mentioned is "Share expensive initialization between JVMs. For > > > > example, put data which is expensive to read or compute into > memcache, > > > > where it can be quickly read by other JVMs during startup." so in > this > > > > scenario where do you load this memcache so that it can be shared > > > > between the jvm instances. > > > > > > Any pointers or clues highly appreciated. > > > > > > Thanks, > > > > Rahul > > > > > > On May 22, 10:51 pm, Chau Huynh <[email protected]> wrote: > > > > > It seems like loading request... > > > > > http://code.google.com/appengine/kb/java.html#What_Is_A_Loading_Request > > > > > > > On Sun, May 23, 2010 at 4:55 AM, Rahul <[email protected]> > wrote: > > > > > > I have an application running on appengine and no doubt it works > > > > > > great. but when the application is not used for some time. it > goes > > > > > > very slow. > > > > > > Suppose i don;t use the application for around 5 hours or so, > then > > > > > > next time when i try to use it, the response is very slow. Is > there > > > > > > any thing specific which i am missing in adding application to > > > > > > appengine. > > > > > > > > Any clues are pointers are highly appreciated. > > > > > > > > Thanks, > > > > > > Rahul > > > > > > > > -- > > > > > > 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]> > > > > <google-appengine-java%[email protected]<google-appengine-java%[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]<google-appengine-java%[email protected]><google-appengine-java%2B > [email protected]> > > > > . > > > > > For more options, visit this group athttp:// > > > > 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. > > > > > -- > > > 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 athttp:// > 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 athttp:// > 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.
