Re: caching large data in web application
Well, if the data is read only, then you can just cache the data in a Hashtable and make it accessible through out the application. If your data is volatile, then you may consider writing a simple time based caching service - http://www.javaworld.com/javaworld/jw-07-2001/jw-0720-cache_p.html Hibernate provides two levels of caching. By default, Hibernates uses first level caching. Hibernate also provides plugin for other cache provider like JBoss. This is the second level caching. In first level caching, Hibernate will check if data in a persistence class has changed when saving a persistence class. If the related data is being modified, Hibernate will update the modified data. Of course, this is just one simple example. For more information, please visit Hibernate reference document - http://www.hibernate.org/hib_docs/reference/en/html/ HTH Lee On Mon, 29 Nov 2004 07:36:43 -0800 (PST), Ashish Kulkarni <[EMAIL PROTECTED]> wrote: > Hi > The data which i want to cache has about 1 rows > and i want to cache it in may be servlet context, what > is the best way to cache it, do i just create a java > bean and cache it or some kind of mechanism already > exist like Hibernation (i am not sure what is does) > > Ashish > > > --- "Frank W. Zammetti" <[EMAIL PROTECTED]> wrote: > > > What kind of data is it? Is it a read-only set of > > data? How often is > > it updated? Who or what can update it? > > > > There's any number of ways to do things like this, > > which is the best > > option depends on the particulars of your use case. > > > > You might be able to cache the data in Javascript > > arrays in the user's > > browser in a hidden frame. This is a fantastic > > approach for data that > > doesn't change frequently and that is read-only. > > Removes potentially a > > lot of data being passed in different spots > > throughout the app, but it > > does complicate your front-end a little more. > > > > You might be able to cache it in the session. This > > can be good if the > > data set is small, read-only and needed for server > > processing at various > > points. This can lead to problems in distributed > > environments though, > > so you need to be careful. > > > > You might be able to have a small cache database > > server running along > > side your app server, something like MySQL for > > example, that has temp > > copies of the data. The benefit to this is you have > > the full power of > > the RDBMS to work with, so you might be able to do > > triggers to update > > the DB2 database when appropriate if it's a one-way > > sort of thing. > > > > As for the idea of update triggers, sure, you can > > almost certainly put > > something together to do this. I haven't done a > > whole lot with DB2, but > > I'd bet there's some mechanism you could use to > > notify your cache server > > of the update. I'd suspect the best approach would > > be to notify it a > > change took place but DON'T send the updated data... > > Let the cache > > server do a query to DB2 and get the updated data > > set. Writing a > > well-constructed stored procedure to do this would > > probably be the best > > bet. You could also just poll DB2 for changes if > > your application can > > tolerate some lag in updates to the cached data. > > > > Really though, the first question to ask is whether > > what you want to > > cache is read-only or has to support updates. If > > it's the former, you > > have a lot of options. It it's the later, things > > get a little trickier. > > By the way, I think I've done some variation of > > all these approaches > > at one time or other, so I can try and expand on > > things if you need me to. > > > > -- > > Frank W. Zammetti > > Founder and Chief Software Architect > > Omnytex Technologies > > http://www.omnytex.com > > > > Dakota Jack wrote: > > > Whatever code updates the database will have to > > somewhere and somehow > > > notify the code that updates the cache. It is > > that simple. > > > > > > Jack > > > > > > > > > > > > > > > On Sun, 28 Nov 2004 15:25:56 -0800 (PST), Ashish > > Kulkarni > > > <[EMAIL PROTECTED]> wrote: > > > > > >>Hi > > >>what is the best way to cache data in web > > application, > > >>I have a table in AS400 DB2 database which i want > > to > > >>cache in application server to improve > > performance, > > >>Also is it possible to have a external trigger > > which > > >>will update the cache if the data base is updated > > by > > >>some external process > > >> > > >>Ashish > > >> > > >>__ > > >>Do you Yahoo!? > > >>Meet the all-new My Yahoo! - Try it today! > > >>http://my.yahoo.com > > >> > > > >>- > > >>To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > >>For additional commands, e-mail: > > [EMAIL PROTECTED] > > >> > > >> > > > > > > > > > > > > > > > > > > > > - > > To unsubscribe, e-mai
Re: caching large data in web application
Hi The data which i want to cache has about 1 rows and i want to cache it in may be servlet context, what is the best way to cache it, do i just create a java bean and cache it or some kind of mechanism already exist like Hibernation (i am not sure what is does) Ashish --- "Frank W. Zammetti" <[EMAIL PROTECTED]> wrote: > What kind of data is it? Is it a read-only set of > data? How often is > it updated? Who or what can update it? > > There's any number of ways to do things like this, > which is the best > option depends on the particulars of your use case. > > You might be able to cache the data in Javascript > arrays in the user's > browser in a hidden frame. This is a fantastic > approach for data that > doesn't change frequently and that is read-only. > Removes potentially a > lot of data being passed in different spots > throughout the app, but it > does complicate your front-end a little more. > > You might be able to cache it in the session. This > can be good if the > data set is small, read-only and needed for server > processing at various > points. This can lead to problems in distributed > environments though, > so you need to be careful. > > You might be able to have a small cache database > server running along > side your app server, something like MySQL for > example, that has temp > copies of the data. The benefit to this is you have > the full power of > the RDBMS to work with, so you might be able to do > triggers to update > the DB2 database when appropriate if it's a one-way > sort of thing. > > As for the idea of update triggers, sure, you can > almost certainly put > something together to do this. I haven't done a > whole lot with DB2, but > I'd bet there's some mechanism you could use to > notify your cache server > of the update. I'd suspect the best approach would > be to notify it a > change took place but DON'T send the updated data... > Let the cache > server do a query to DB2 and get the updated data > set. Writing a > well-constructed stored procedure to do this would > probably be the best > bet. You could also just poll DB2 for changes if > your application can > tolerate some lag in updates to the cached data. > > Really though, the first question to ask is whether > what you want to > cache is read-only or has to support updates. If > it's the former, you > have a lot of options. It it's the later, things > get a little trickier. > By the way, I think I've done some variation of > all these approaches > at one time or other, so I can try and expand on > things if you need me to. > > -- > Frank W. Zammetti > Founder and Chief Software Architect > Omnytex Technologies > http://www.omnytex.com > > Dakota Jack wrote: > > Whatever code updates the database will have to > somewhere and somehow > > notify the code that updates the cache. It is > that simple. > > > > Jack > > > > > > > > > > On Sun, 28 Nov 2004 15:25:56 -0800 (PST), Ashish > Kulkarni > > <[EMAIL PROTECTED]> wrote: > > > >>Hi > >>what is the best way to cache data in web > application, > >>I have a table in AS400 DB2 database which i want > to > >>cache in application server to improve > performance, > >>Also is it possible to have a external trigger > which > >>will update the cache if the data base is updated > by > >>some external process > >> > >>Ashish > >> > >>__ > >>Do you Yahoo!? > >>Meet the all-new My Yahoo! - Try it today! > >>http://my.yahoo.com > >> > >>- > >>To unsubscribe, e-mail: > [EMAIL PROTECTED] > >>For additional commands, e-mail: > [EMAIL PROTECTED] > >> > >> > > > > > > > > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __ Do you Yahoo!? The all-new My Yahoo! - What will yours do? http://my.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: caching large data in web application
What kind of data is it? Is it a read-only set of data? How often is it updated? Who or what can update it? There's any number of ways to do things like this, which is the best option depends on the particulars of your use case. You might be able to cache the data in Javascript arrays in the user's browser in a hidden frame. This is a fantastic approach for data that doesn't change frequently and that is read-only. Removes potentially a lot of data being passed in different spots throughout the app, but it does complicate your front-end a little more. You might be able to cache it in the session. This can be good if the data set is small, read-only and needed for server processing at various points. This can lead to problems in distributed environments though, so you need to be careful. You might be able to have a small cache database server running along side your app server, something like MySQL for example, that has temp copies of the data. The benefit to this is you have the full power of the RDBMS to work with, so you might be able to do triggers to update the DB2 database when appropriate if it's a one-way sort of thing. As for the idea of update triggers, sure, you can almost certainly put something together to do this. I haven't done a whole lot with DB2, but I'd bet there's some mechanism you could use to notify your cache server of the update. I'd suspect the best approach would be to notify it a change took place but DON'T send the updated data... Let the cache server do a query to DB2 and get the updated data set. Writing a well-constructed stored procedure to do this would probably be the best bet. You could also just poll DB2 for changes if your application can tolerate some lag in updates to the cached data. Really though, the first question to ask is whether what you want to cache is read-only or has to support updates. If it's the former, you have a lot of options. It it's the later, things get a little trickier. By the way, I think I've done some variation of all these approaches at one time or other, so I can try and expand on things if you need me to. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Dakota Jack wrote: Whatever code updates the database will have to somewhere and somehow notify the code that updates the cache. It is that simple. Jack On Sun, 28 Nov 2004 15:25:56 -0800 (PST), Ashish Kulkarni <[EMAIL PROTECTED]> wrote: Hi what is the best way to cache data in web application, I have a table in AS400 DB2 database which i want to cache in application server to improve performance, Also is it possible to have a external trigger which will update the cache if the data base is updated by some external process Ashish __ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: caching large data in web application
Whatever code updates the database will have to somewhere and somehow notify the code that updates the cache. It is that simple. Jack On Sun, 28 Nov 2004 15:25:56 -0800 (PST), Ashish Kulkarni <[EMAIL PROTECTED]> wrote: > Hi > what is the best way to cache data in web application, > I have a table in AS400 DB2 database which i want to > cache in application server to improve performance, > Also is it possible to have a external trigger which > will update the cache if the data base is updated by > some external process > > Ashish > > __ > Do you Yahoo!? > Meet the all-new My Yahoo! - Try it today! > http://my.yahoo.com > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "You can't wake a person who is pretending to be asleep." ~Native Proverb~ "Each man is good in His sight. It is not necessary for eagles to be crows." ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
caching large data in web application
Hi what is the best way to cache data in web application, I have a table in AS400 DB2 database which i want to cache in application server to improve performance, Also is it possible to have a external trigger which will update the cache if the data base is updated by some external process Ashish __ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]