Pre-load the Cache during Application-Start Up

Our requirement is to pre-load the cache during the application start-up most probably during Authentication/Authorization Service is invoked.
We plan to load the data for other services from database into Coherence cache so that when user access that particular service he ends up hitting the Cache instead of database.
Any pointers/suggestions on how to pre-load the cache during application start-up would be greatly appreciated. We are using Spring, Hibernate, Weblogic Web Services
Regards,
Bansi

Hi Bansi,
I were using following approach.
First, we never use CacheFactory.getCache() in application code instead all instances of named cache were injected.
On server side, I have an CacheInitializerBean which were starting cache preloading process (in separate thread). After preloading a special marker entry were put to the cache, indicating what data in the cache are consistent.
When injecting named cache instance, we use a factory. This factory use CacheFactory.getCache() internally, but it check presence of marker object in cache an blocks until marker object will appear.
Well in practice things are little more complicated but this is basic idea.
Preload cache asynchronously and use marker to indicate completion of loading process.
Hope this will help.
Regards,
Alexey

Similar Messages

  • Pre-loading the Cache from Database during application start-up

    We are using Spring, Hibernate, Oracle Coherence 3.5.2 Weblogic Webservices
    Our requirement is to pre-load the cache during the application start-up most probably during Authentication/Authorization Service is invoked.
    We plan to load the data for other services from database into Coherence cache so that whenever user access that particular service he ends up hitting the Cache instead of database.
    We would greatly appreciate sample code snippets on how to write CacheInitializerBean with marker to demonstrate the state of cache.

    Hi Rob,
    Thanks for pointing to the article: Pre-Loading the Cache
    In fact i already looked at that article before posting. It just mentions how to load the data from database into Cache.
    What i am looking for is how to make this happen during application start-up. This is my first hurdle.
    The second one is as mentioned in the article http://coherence.oracle.com/display/COH35UG/Pre-Loading+the+Cache
    i wrote following code which never gets populated into cache. Not sure whats going wrong even though i see Hibernate loadAll() method loading all the objects in the console
    public   void populateCache() throws SQLException
        Map<Long, Object>  buffer = new HashMap<Long, Object>();
        int count = 0;
         List<Contract> contractList = this.getHibernateTemplate().loadAll(Contract.class);
         log.debug("contractList size="+contractList.size());
         for(Contract contract : contractList)
             Long key   = new Long(contract.getId());
             Object  value = contract;
             buffer.put(key, value);
             // this loads 1000 items at a time into the cache
             if ((count++ % 1000) == 0)
                  contractCache.putAll(buffer);
                 buffer.clear();
         if (!buffer.isEmpty())
              contractCache.putAll(buffer);
        }We would greatly appreciate your time in helping us resolving two hurdle blocks.

  • Pre-loading the cache

    I'm attempting to pre-load the cache with data and have implemented controllable caches as per this document (http://wiki.tangosol.com/display/COH35UG/Sample+CacheStores). My cache stores are configured as write-behind with a 2s delay:
    <cache-config>
         <caching-scheme-mapping>
         <cache-mapping>
              <cache-name>PARTY_CACHE</cache-name>
              <scheme-name>party_cache</scheme-name>
         </cache-mapping>
         </caching-scheme-mapping>
         <caching-schemes>
              <distributed-scheme>
                <scheme-name>party_cache</scheme-name>
                <service-name>partyCacheService</service-name>
                <thread-count>5</thread-count>
                <backing-map-scheme>
                    <read-write-backing-map-scheme>
                         <write-delay>2s</write-delay>
                        <internal-cache-scheme>
                            <local-scheme/>
                        </internal-cache-scheme>
                        <cachestore-scheme>
                            <class-scheme>
                                <class-name>spring-bean:partyCacheStore</class-name>
                            </class-scheme>
                        </cachestore-scheme>
                    </read-write-backing-map-scheme>
                </backing-map-scheme>
                <autostart>true</autostart>
            </distributed-scheme>
         </caching-schemes>
    </cache-config>
    public static void enable(String storeName) {
            CacheFactory.getCache(CacheNameEnum.CONTROL_CACHE.name()).put(storeName, Boolean.TRUE);
    public static void disable(String storeName) {
            CacheFactory.getCache(CacheNameEnum.CONTROL_CACHE.name()).put(storeName, Boolean.FALSE);
    public static boolean isEnabled(String storeName) {
            return ((Boolean) CacheFactory.getCache(CacheNameEnum.CONTROL_CACHE.name()).get(storeName)).booleanValue();
    public void store(Object key, Object value) {
            if (isEnabled(getStoreName())) {
                throw new UnsupportedOperationException("Store method not currently supported");
        }The problem I have is that what seems to be happening is:
    1) bulk loading process calls disable() on the cache store
    2) cache is loaded with data
    3) bulk loading process calls enable() on the cache store ready for normal operation
    4) the service thread starts to attempt to store the data as the check to see if the store is enabled returns true because we set it to true in step 3
    so is there a way of temporarily disabling the write-delay or changing it programatically so step 4 doesn't happen?

    Adding
    Thread.sleep(10000);after loading the data seems to solve the problem but this seems dirty, any better solutions?

  • How syncronize with the data base after pre-loading the data

    Hi,
    I have pre-loaded the data from the database table into the cache.
    If the key is not found in the cache i want to it to connect to database and get the value from the table. How to achieve this?

    Hi JK,
    I have pasted my cache loader code, config file and the main class in the other post but i m not sure what is the issue with it. Its not working. Please can you tell me what might be the issue with that piece of code. I m not getting any exception either but the load() or loadAll() method is not at all getting triggered on invoking cache.get() or cache.getAll() method. What might be the cause for this issue?
    Can you give me the coherence-cache-config.xml contents?
    I m not sure whether its the issue with the config file because i have read some where that refreshaheadfactor is required to trigger the loadAll() method.
    Edited by: 943300 on Jul 4, 2012 9:57 AM

  • Pre-loading the next swf

    Guys,
    i gonna tell the situation from the very beginning:
    I'm doing a book, wich each chapter is separated by swf (chapter_1.swf, chapter_2.swf, etc).
    In the final of each swf, he calls the next by the command: _root.loadMovie("next.swf")
    (PS: i'm not using the MovieClip load method)
    The problem is; when the swf are uploaded on my server, and i click to load the next swf, my screen goes blank while he download it.
    All i want to do, is pre-load the next swf, while the user is reading the actual chapter, to avoid this blank screen time. Is it possible?
    I read something about getBytesLoaded/Total, but don't know how to execute it.
    Please explain it clear cuz i'm new with this. And thank you very much for the support!

    If you want to have information regarding the loading progress of a file then you need to use the MovieClipLoader class.
    If you search Google you should be able to find a tutorial using search terms like "AS2 MovieClipLoader tutorial"

  • How to pre-load Coherence Caches used within an OEP Application

    Hi OEP/Coherence guys,
    I'm currently developing an OEP application that was consuming database inputs in CQL queries.
    I've replaced database direct access by Coherence caches access. My Coherence Local caches use a cache loader to fetch rows (by key) when there is a cache miss. This is working well, and the caches get filled in during the execution of my OEP application.
    The problem is that if CQL queries are made on some attributes (not the key) of not-yet-cached data, the load method of my cache loader is not invoked and there is no result to my CQL query.
    I'm wondering how to pre-load my data in Coherence Caches, from the database, when the OEP application starts to avoid such kind of problems...
    Thx for any advice.
    Renato

    Hi.
    Could you please describe the way to "set-up a cache-loader to load data into your cache when the OEP application starts" ?
    I have a cache-loader configured with my cache. My cache-loader implements the "com.tangosol.net.cache.CacheLoader" interface.
    This interface only defines 2 methods:
    load(java.lang.Object oKey) ==> Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
    loadAll(java.util.Collection colKeys) ==> Return the values associated with each the specified keys in the passed collection.
    None of these methods allows me to pre-load my data (and BTW it looks like "loadAll" is never called by OEP)
    Thx
    RP

  • Pre-loading Planning forms after re-start

    Is there a way (or two) to mitigate the load time of a Planning form? We have 60+ forms and the application owners realize that once user1 opens a particular form, user2 benefits by the (WebLogic) application server's caching. The owners feel that user2's perceived performance of the forms load is acceptable, but user1's in not.
    One of my recent on-site consultants recounted the story of a firm having an admin log into each form very early every morning to effect the caching for performance. Two obvious solutions would be the above (manual process) and using HP LoadRunner (which we do not have available to us in our production environment). Any WebLogic application server settings not used by default for EPM 11 deployed Planning apps applicable here?
    Any suggestions, experiences or war stories on this would be very much appreciated.
    -Vince

    My Oracle Developer Version is Oracle Fusion Middleware 11g for windows and database Oracle 11g (11.1.0.6) for windows, i have tried it on Oracle 11gR2 for windows as well, but problem is same. I tell you little more in detail
    After installation of Developer 11g , i run a test form , it was running fine in the browser with port 8090, then i re-start the computer , after that , form is compiled successfully, first it shows that http listener is not running, then i start services Weblogic WLS Forms, after that it does not show that http is not running, but it does not run form in browser.
    I am tired , please help me , which services are required to run developer 11g , i have worked fine in Developer 10g with oc4j , but here i am not able to run the form.
    Thnaks in advance.
    Regards
    Barkaat

  • Error Loading the file from application server

    Hi Team,
    I'm trying to load the .CSV file from application server and I'm getting the error message.
    In the data package
      Update to PSA --Green
      Transfer Rule -- Green
      Update Rule -  error ABORT was set in the customer routine 9998
                            Error 1 in the update
    Please help me to provide the solution.
    But when I try to load the other files there are no issues. thanks.
    Regards,
    Senthil

    Raj
      check the below links, which can helps to solve your issues
    Flat file data load
    flat file Data loading issue
    Mahesh

  • Dynamically load the content without re-starting the server

    Let me explain the scenario.........
    I have a JSP in which I call a method written in a different class( java file).
    Now, when I change the content of the method in the class and compile it, how can I get the updated stuff in the JSP without re-starting the server.
    Even though I have to re-deploy the changed class, I need to re-start the server to get the updates effective.
    The env set up is on Tomcat
    fun_one

    FUN_ONE, I am using Tomcat 5.0 (though not 5.5), and have a Test application that I do not use WARs to deply. The Context is set with reloadable="true".
    I have this simple bean:
    package jsp.beans;
    public class ItemBean implements java.io.Serializable
         public String getjunk() { return "Hello"; }
    } And this JSP
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <html>
      <head>
      </head>
      <body>
        <!-- Display the session ID for this user -->
        <p><c:out value="${pageContext.session.id}"/></p>
        <!-- Get the junk string from the ItemBean -->
        <p><jsp:useBean id="it" class="jsp.beans.ItemBean"/>
        <c:out value="${it.junk}"/></p>
      </body>
    </html> I run the JSP, then change the text returned by the bean, recompile it, then reload the JSP (force reload). The session id remains the same, and the text changes. Does this work on your system? (note, you do have to restart your server once after you set the Context to be reloadable="true")

  • How can I pre-load the Flash on my page?

    I added Flash navigation to my HTML site. Whenever I click on
    a link, the Flash has to reload on every new page, so it takes a
    second longer to appear. Otherwise it works ok... this is just kind
    of annoying. Is there any way around this?

    load the HTML into an iframe.

  • Unable to load the usa today application after logging in to their website

    I have been reading the e edition of USA Today for months on my iPad.  After logging in, the application will not load now??

    Hi
    Couple of things :
    1. Make sure that the "ACTION" sttribute in the FORM is pointing to the right URL.
    2. Make sure that the SUBMIT button is inside the FORM tags, then make sure that the SUBMIT button is in the same FORM as the Text Fields .
    If it is still causing you problems , please post your code.
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun microsystems inc.
    http://www.sun.com/developers/support

  • "file already exists in the destination" during application build

    I am trying to build an executable and have gotten the following error:
    The file already exists in the destination.
    C:\Program Files\National Instruments\LabVIEW 8.2\vi.lib\Sentech LV 82\Shared Library - Trigger SDK\StTrgApi.dll
    WHen I start the build I go to "Build Executable" then click "Build"
    The VI for the project I have open is the Startup VI and I do not list any Dynamic VIs or Support FIles.
    I am using Labview 8.2
    I installed a user library for a USB camera from Sentech wich I am using and it works fine in Labview 8.2
    When I try to do the build I get the error shown above. The file it is referencing is there along with the .lvlib file.
    I tried removing the file shown in the error message to see what would happen and I continue to get the same error even though the file is not there. I even restarted LV and still got the same error.
    I am new to the application builder (v7 ?) and have not been able to find any good tutorials. Does anyone have any ideas on this error or a good place to learn more about app builder.
    Thanks
    Keith

    I am new to the application builder (v7 ?) and have not been able to find any good tutorials. Does anyone have any ideas on this error or a good place to learn more about app builder.
    Thanks
    Keith
    Hi Keith,
    you can check this Link out for a tutorial on app builder.
    Regards,
    Denver 

  • Show progress bar before loading the applet or application

    hi ,
    My application size is large and take some time to load . Now i want that to show progress bar . how can i do this .Please Help me
    sorry for my english.
    Thanks

    Do everything in a seperate thread. Create a progress bar in the main thread, then create a new thread for initializing your app. Once the init is done, hide the progress bar and make your app visible.

  • Loading The Ribbon on Outlook Start

    Hi , I kinda new in this so I guess my problem is very basic
    I'm creating a simple Add-in for Outlook 2013 via Visual Studio 2013
    I added an Ribbon XML item, and customized it.
    before I start to actually link the buttons to the commands I want to see how it looks in outlook
    so from the Visual Studio I press >Start and I can see the add-in is loaded from the add-in list, though I don't see my tab on the Ribbon :/
    my goal is to have this ribbon on the Microsoft.Outlook.Explorer ribbon.
    what am I missing? what do I need to add in the ThisAddIn_StartUp sub in order to show it?
    thanks
    Tamir Levy

    Hello Tamir,
    VSTO provides two main ways for creating a custom UI for the add-in:
    1. The Ribbon designer which allows to create the UI manually. See
    Walkthrough: Creating a Custom Tab by Using the Ribbon Designer .
    2. Ribbon XML. See
    Walkthrough: Creating a Custom Tab by Using Ribbon XML for more information. Make sure that you did all the steps described in the article, especially added the CreateRibbonExtensibilityObject method to the ThisAddin.cs file:
    protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
    return new MyRibbon();

  • Nu such object error when load the user from application

    Hi..everybody
    I'm new comer at Sun ONEDirectory Server
    I've a problem when try to get the user from my application
    I use ..getAttribute("cn=username");
    always appear No Such Object, whereas I've created that user
    Thanks

    Hi,
    The best way would be to first run an ldapsearch command on the directory server to check whether the user is present and then try to check it with your application.
    You can use something like:
    #ldapsearch -D "cn=Directory Manager" -w <password> -b "cn=username,o=users, dc=example,dc=com" "objectclass=*"
    Cheers,

Maybe you are looking for

  • Trying to connect to serve message for over 10 minutes trying to install creative cloud

    The Adobe installer window says "trying to connect to server"...... I cannot get Creative Cloud to install

  • RE: (forte-users) FW: (forte-users)

    Hi there Thanks very much for the solution - just wanted to let you know . We implemented the design that technote 11378 suggested . It worked . Thanks very much Cheers Jen -----Original Message----- From: Adamek, Zenon [mailto:ZAdamekpurolator.com]

  • Best Practices in Building/Stage-In

    What are the best practices in building/stage-in process? I tried to use a CVS repository to have employees stage in their projects then a pair of actual builders will check them out and compile, completing the elevation to production. I'm experienci

  • Activating Project Professional 2010 after a crash

    hi there:- I am looking to reactivate/reinstall Project Professional 2010 after a crash. I have a product activation code having downloaded the software online (no disks). What do I need to do? Much obliged Tom

  • Associating a lighweight AP to a specific WLC

    Hello All, I'm new to WLCs but I have a question related to association.  At the present, we have two WLCs (5508).  There are a total of 84 LAPs (1242AG).  One controller is configured as the master controller in which all our APs associate to.  It's