Actually, as GenericDataModel class works very well as a super class of your desired data model. This way everything is cached into memory and boosts performance a lot. The reloading is actually easy to be implemented with the refresh mechanism (Taste objects implement Refreshable interface). You can also try RefreshHelper.
On 13 July 2011 20:58, Sean Owen <[email protected]> wrote: > I was mixing this up with another class. It doesn't reload itself. You can > call refresh() to do so. > > On Wed, Jul 13, 2011 at 7:34 PM, Salil Apte <[email protected]> wrote: > > > Where can the interval be configured? BTW, ReloadFromJDBCDataModel > > works like a dream so far :) > > > > On Wed, Jul 13, 2011 at 10:58 AM, Sean Owen <[email protected]> wrote: > > > Yes it reloads after a configurable interval, or on demand. > > > > > > Clearing the cache for a user ID only means that user's data is > > recomputed. > > > It's not bad to call this frequently per se... I suppose you want to > let > > it > > > cache as much and for as long as is valid and acceptable to your app. > > > > > > Your bottleneck is no longer reading from the DB if you're having it > load > > > into memory. > > > > > > On Wed, Jul 13, 2011 at 6:19 PM, Salil Apte <[email protected]> > > wrote: > > > > > >> Awesome, I will give ReloadFromJDBCDataModel a try. How does this > > >> particular data model update itself on database changes? Does it just > > >> happen periodically and if so, can this rate be change easily? > > >> > > >> Lastly, will calling clear(userId) on a recommender frequently be bad > > >> for performance? I'm assuming with such small data amounts that the > > >> actual recommendation algorithm is quite speedy and that the DB is > > >> really the big bottleneck? > > >> > > >> On Wed, Jul 13, 2011 at 2:11 AM, Sean Owen <[email protected]> wrote: > > >> > That's all correct, it reads a lot. But you can avoid a lot of it by > > >> using > > >> > caching wrappers. > > >> > You also don't need to dump to a file. Use ReloadFromJDBCDataModel. > > >> > > > >> > On Wed, Jul 13, 2011 at 9:57 AM, Vitali Mogilevsky > > >> > <[email protected]>wrote: > > >> > > > >> >> Hey, > > >> >> I got the same problem, of slowness while using MYSQL data model, > > after > > >> a > > >> >> small research and looking into mysql's query log, revealed that > user > > - > > >> >> user > > >> >> recommendation just floods the database with thousands and > thousands > > of > > >> >> requests. > > >> >> and thats on small database. > > >> >> for now Im dumbping the database into file, and using filedata > model > > >> which > > >> >> works much faster > > >> >> > > >> >> > > >> > > > >> > > > > > > -- -- Marko Ćirić [email protected]
