This discussion is archived
1 2 3 4 Previous Next 48 Replies Latest reply: Aug 8, 2007 9:53 PM by 60437 RSS

V3 Caching - any more info?

Shunt Pro
Currently Being Moderated
Hi all

I am just getting to grips with v3 and I can’t quite see the benefit of the partial region/page caching function. If it’s only really designed for regions containing static content, then I don’t have much use for it. Also what is the extra performance benefit when much of the static content (images, css, js) is cached on the client anyway.

I would be interested in any Bloggs, White Papers, How-to’s etc that cover this in more detail.

Thanks

Simon
  • 1. Re: V3 Caching - any more info?
    jkallman Employee ACE
    Currently Being Moderated
    Simon,

    It's not really designed for static content. That would almost be pointless to cache that (although there would still be some small benefit). The whole purpose is to cache those regions which are dynamic but 1) do not need to be real time, and 2) are computationally intensive.

    For most business requirements, you'd want the live data always. But there are some regions/pages which do not need to be real time (e.g., last month's chart of sales figures). If it takes an 8-way Cartesian product to produce this chart, it may make sense to simply cache this instead of forcing the computation of this again upon every end-user.

    Joel
  • 2. Re: V3 Caching - any more info?
    567012 Newbie
    Currently Being Moderated
    Joel:

    Great explanation, appreciate it.

    1. How can we provide a feature in our applications to "purge" the cache and retrieve the live data? [I know we can purge the cache in the Builder's Admin interface]

    2. How can we display a timestamp on cached regions/pages to indicate the time it was cached? Something like "Information is as of mm/dd/yyyy hh:mi:ss pm"

    Thanks
  • 3. Re: V3 Caching - any more info?
    60437 Employee ACE
    Currently Being Moderated
    Vikas (much better than VA),

    Check out:

    APEX_UTIL

    * CACHE_GET_DATE_OF_PAGE_CACHE Function
    * CACHE_PURGE_BY_APPLICATION Procedure
    * CACHE_PURGE_BY_PAGE Procedure
    * CACHE_PURGE_STALE Procedure
    * PURGE_REGIONS_BY_APP Procedure
    * PURGE_REGIONS_BY_ID Procedure
    * PURGE_REGIONS_BY_NAME Procedure
    * PURGE_REGIONS_BY_PAGE Procedure

    Scott
  • 4. Re: V3 Caching - any more info?
    567012 Newbie
    Currently Being Moderated
    Thanks, Scott.

    I see that my second question can also be answered by the new dictionary view APEX_APPLICATION_CACHING.

    <p>I recently had to OT: My email address my email address

    <p>I can't believe that the OTN Forum software doesn't let us change our email address! There is a lively discussion thread on the Feedback forum. So I had to register for a new OTN id. OTN handles have to be unique so I had to shorten my earlier handle. I still don't get watch emails on this new id even though the email address works fine. :-(
  • 5. Re: V3 Caching - any more info?
    429923 Journeyer
    Currently Being Moderated
    Caching is one of those 3.0 topics that we do plan to write a whitepaper on. We should have something out on our OTN site in the next few weeks.

    -- Sharon
  • 6. Re: V3 Caching - any more info?
    mhichwa Newbie
    Currently Being Moderated
    If you want live data simply pass a request.

    f?p=100:1:&SESSION.:anything

    Putting any value in the request will cause a page to be rendered dynamically.

    Mike
  • 7. Re: V3 Caching - any more info?
    mhichwa Newbie
    Currently Being Moderated
    More reasons to use caching:

    1. Within Oracle we have an empoyee lookup application called aria people, and this application does between 15,000 to 20,000 page views per hour. The avg response time for the blank search home page was 0.08 seconds, adding page caching reduced this to 0.02 seconds. So on this heavily used system we were able to increase page performance 400% for about 30% of page views. We used a cache when condition, use cache when P1_SEARCH is null.

    2. Regions that may be populated using a web service, or a URL, or some sort of network query, for example a stock quote, or news from some xml feed. Using region or page caching can cause these regions to be displayed in less then 0.01 seconds, and can take over 1.0 second to run dynamically. This can result in applications that show interesting information but pay a smaller price for fetching this information.

    3. Many reporting applications, data marts, and data warehouses may report on information that is refreshed once per day. For example downloads from OTN are posted to a database once per day. Charts, and reports, and on this static data can be cached and rendered much faster.

    4. Another use case for region caching is application express itself, each page view in the application builder caches the tabs. The tabs "Home", "Application Builder", "SQL Workshop", "Utilities", are implemented using a page 0 list. Caching this region saves many dynamic query executions. To display each list region Oracle APEX typically queries the regions table, region template table, list table, the list entries table, and the list templates table, so 5 queries. After the queries APEX must dynamically merge the list entries and list templates and region template to create the list region. Performing these queries and template merging is very very fast, however reading the data from cache is even faster, so for applications that want to do all out optimization then region caching can make sense.

    Hope this helps explain the rationale behind the page and region caching.
  • 8. Re: V3 Caching - any more info?
    533859 Newbie
    Currently Being Moderated
    Thank you for the great examples Mike - very helpful. I look forward to taking advantage of this and the other winning features of 3.0.

    Cheers,
    Bill
  • 9. Re: V3 Caching - any more info?
    369783 Newbie
    Currently Being Moderated
    Vikas,

    Thanks for pointing out that thread! (I guess Scott's numbers/position on this forum are safe now for awhile.)
    :^)
    It just made my whole day. I kept spitting coffee out everywhere I was laughing so hard. I guess I was lucky registering with my Yahoo account.

    Like others on that thread, a workaround (even if not a fix), is quite simple to implement, and 5 years is a bit of a long stretch to implement a workaround for something so many people want/need.

    Bill Ferguson (and thanks for all of your examples you've provided)
  • 10. Re: V3 Caching - any more info?
    VANJ Journeyer
    Currently Being Moderated
    We used a cache when condition, use cache when P1_SEARCH is null

    Mike:

    Thanks for those detailed use cases, they help a lot.

    I am having trouble understanding the "Cache When" condition.

    Here is how I understand it, let me know if I am wrong

    1. The show engine starts to render a page
    2. If it finds the page (or a region on the page) in the cache (and the cache timeout has not yet expired), it just fetches the HTML content from the cache
    3. If not, it proceeds to dynamically render the content as usual.
    4. At this point it evaluates the "Cache When" condition type. If the condition evaluates to true, the content generated in (3) is written to the cache.

    In other words, I thought the "cache when" condition determines when to write to the cache. Your quoted statement above indicates that the condition determines when APEX would read from the cache.

    Can you please clarify?

    Thanks
  • 11. Re: V3 Caching - any more info?
    60437 Employee ACE
    Currently Being Moderated
    Vikas,

    The condtion (among other factors) is used to determine if the page/region should be retrieved from cache. The same condition is used to determine if the page/region just rendered dynamically should be written to cache.

    Scott
  • 12. Re: V3 Caching - any more info?
    Shunt Pro
    Currently Being Moderated
    Many thanks for the info; it makes a bit more sense now. I still have a few questions / points.

    1. It's not really designed for static content. The help files suggest differently!
    2. If I set page 0 (or regions on page 0) to cache, will this automatically cache those shared regions on other pages?
    3. If I set a page to cache, will the regions cache automatically or are their settings independent.
    4. If I set a region to cache that contains a paginated report, how does that work? And will it conflict with PPR?
    5. If you set the application to cache lots of data, by user; and you have a lot of users; is there an impact elsewhere?

    Thanks

    Simon
  • 13. Re: V3 Caching - any more info?
    135285 Oracle ACE
    Currently Being Moderated
    Hi Simon,
    1. It's not really designed for static content. The help files suggest differently!
    It probably will not have the same performance improvement as for a cached report, chart or a dynamic PL/SQL region. But I think there are still a little performance gain. Why? It doesn't have to look for substitution, doesn't have to merge it with the template, ... If you can cache a hole page which just contains static content like navigation, lists, ... you should also see an improvement, because APEX doesn't have to loop though all it's meta-data to build the page.

    But I have to admit that I haven't done a performance test to prove that.
    2. If I set page 0 (or regions on page 0) to cache, will this automatically cache those shared regions on other pages?
    Yes they will be cached there too.
    3. If I set a page to cache, will the regions cache automatically or are their settings independent.
    If you set a page to cached, the whole page is in the cache. It will not look at the individual regions anymore if it finds the page in the cache.
    4. If I set a region to cache that contains a paginated report, how does that work? And will it conflict with PPR?
    Caching for a region is ignored if the REQUEST is set. If you do pagination, you will see that this request is always issued with a request that contains the report region (eg.: pg_R_4177313812138401049)
    5. If you set the application to cache lots of data, by user; and you have a lot of users; is there an impact elsewhere?
    It depends if you are doing the caching "By User" or "application wide". There are reports available which show you the bytes used by the cached pages/regions => Application Reports/Activity/Cache*

    Hope that clarifies some issues
    Patrick
    ----------------------------------------------------------------------------------------------
    Check out my APEX-blog: http://inside-apex.blogspot.com
    Check out the ApexLib Framework: http://apexlib.sourceforge.net
  • 14. Re: V3 Caching - any more info?
    Shunt Pro
    Currently Being Moderated
    Patrick

    Many thanks, that is much clearer.

    By the way is your ApexLib Framework tested with v3.0 yet?

    Simon
1 2 3 4 Previous Next