Querying multiple caches parallely

Hi experts,
I have multiple caches defined in client-cache config. And I wanted to query the differnt caches concurrently. If I use thread to do the job, it is going to be network call for each cache (I use TCP extend). Instead I want that to be handled inside the grid. Any suggestions on this?
I appreciate your valuable inputs.
Regards,
karthik

Hi karthik
Each cache access will be a network call, although they will all share the same TCP connection from the client to the server.
If you really just want everything to happen via a single call to the server you could use an invocation service. Configure an invocation-scheme on you server and a remote-invocation-scheme on the client and then write all the logic to access the caches in an Invocable.
For Example:
The server config:
<cache-config>
  <caching-scheme-mapping>
    <cache-mapping>
      <cache-name>dist-*</cache-name>
      <scheme-name>example-distributed</scheme-name>
    </cache-mapping>
  </caching-scheme-mapping>
  <caching-schemes>
    <invocation-scheme>
      <scheme-name>EXAMPLE-INVOCATION</scheme-name>
      <service-name>EXAMPLE-INVOCATION-SERVICE</service-name>
      <serializer>
        <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
      </serializer>
      <thread-count>5</thread-count>
      <autostart>true</autostart>
    </invocation-scheme>
    <proxy-scheme>
      <scheme-name>Example-Proxy</scheme-name>
      <service-name>EXAMPLE-PROXY-SERVICE</service-name>
      <thread-count>5</thread-count>
      <acceptor-config>
        <tcp-acceptor>
          <local-address>
            <address>localhost</address>
            <port>50115</port>
          </local-address>
        </tcp-acceptor>
        <serializer>
          <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
        </serializer>
      </acceptor-config>
      <proxy-config>
        <cache-service-proxy>
          <enabled>false</enabled>
        </cache-service-proxy>
        <invocation-service-proxy>
          <enabled>true</enabled>
        </invocation-service-proxy>
      </proxy-config>
      <autostart>true</autostart>
    </proxy-scheme>
  </caching-schemes>
</cache-config>The client config
<cache-config>
  <caching-scheme-mapping/>
  <caching-schemes>
    <remote-invocation-scheme>
      <scheme-name>EXAMPLE-INVOCATION-SERVICE-SCHEME</scheme-name>
      <service-name>EXAMPLE-INVOCATION-SERVICE</service-name>
      <initiator-config>
        <tcp-initiator>
          <remote-addresses>
            <socket-address>
              <address>localhost</address>
              <port>50115</port>
            </socket-address>
          </remote-addresses>
          <connect-timeout>2s</connect-timeout>
        </tcp-initiator>
        <outgoing-message-handler>
          <request-timeout>5s</request-timeout>
        </outgoing-message-handler>
        <serializer>
          <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
        </serializer>
      </initiator-config>
    </remote-invocation-scheme>
  </caching-schemes>
</cache-config>Example Invocable
public class CacheQuery extends AbstractInvocable implements PortableObject {
    public void run()
        Object result = ... // Perform your cache queries
        // set the results to pass back to the client
        setResult(result);       
    public void readExternal(PofReader pofReader) throws IOException {
        // Implement any POF deserialization
    public void writeExternal(PofWriter pofWriter) throws IOException {
        // Implement any POF serialization
}Example client code
InvocationService service = (InvocationService) CacheFactory.getService("EXAMPLE-INVOCATION-SERVICE");
CacheQuery invocable = new CacheQuery();
Object result = service.query(invocable, null);JK

Similar Messages

  • Querying TopLink Cache

    My system demands caching the result sets obtained from a ReadAllQuery. I might make several queries on this static set of cached data. But the data to be cached is small. I use TopLink's use session.getProject().FullIdentityMap() to cache the output of ReadAllQuery that i execute at the start of the system.
    But am not able to query the cache from an external API later ( which could be several minutes later). How can i manipulate the TopLink cache APIs to get this done. Kindly Reply.

    Hi Manoj,
    If I understand you correctly, you persist some objects and then later query them. You don't get the results you expect when you use checkCacheOnly(). You need to use checkCacheThenDatabase() and when you do this you're seeing SQL I expect.
    If your cache type for the class is FullIdentityMap then TopLink will never release objects of that class once read and your checkCacheOnly() query should work.
    I'm guessing that you're using a different TopLink session. You mention you have a number of services. What environment are you running in and what is your architecture (e.g., servlet or EJB)? Statics don't solve sharing problems especially in an application server or web application environment in which multiple classloaders are employed.
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Query multiple rows

    Hi, need some help on XML and XSD.
    say I have a table in the database with 3 columns: a, b, c
    on my XDP form, I have a table, like a spreadsheet, with 3 columns too: x, y, z
    and it has 10 rows.
    I want to pre-fill the form with 10 rows of data,
    so, in my Process's action profile,
    I use JDBC's query multiple rows to get the first 10 records of my database table.
    how do I put these 10 rows of data into the table on my form?
    TIA for helping me.
    Happy New Year!

    Step1: Use SQL Query Multiple results as XML activity
    Step2: Define the output of SQL activity to look similar to
    <table>
        <row>row1 value</row>
        <row>row2 value</row>
        <row>row3 value</row>
        <row>row4 value</row>
        <row>row5 value</row>
        <row>row6 value</row>
        <row>row7 value</row>
        <row>row8 value</row>
        <row>row9 value</row>
        <row>row10 value</row>
    </table>
    Step3: arrange your forms fields (Table and rows) in the same way as mentioned above.
    Nith

  • Problem with Expiry Period for Multiple Caches in One Configuration File

    I need to have a Cache System with multiple expiry periods, i.e. few records should exist for, lets say, 1 hour, some for 3 hours and others for 6 hours. To achieve it, I am trying to define multiple caches in the config file. Based on the data, I choose the Cache (with appropriate expiry period). Thats where, I am facing this problem. I am able to create the caches in the config file. They have different eviction policies i.e. for Cache1, it is 1 hour and for Cache2, it is 3 Hours. However, the data that is stored in Cache1 is not expired after 1 hour. It expires after the expiry period of other cache i.e.e Cache2.
    Plz correct me if I am not following the correct way of achieving the required. I am attaching the config file here.<br><br> <b> Attachment: </b><br>near-cache-config1.xml <br> (*To use this attachment you will need to rename 142.bin to near-cache-config1.xml after the download is complete.)

    Hi Rajneesh,
    In your cache mapping section, you have two wildcard mappings ("*"). These provide an ambiguous mapping for all cache names.
    Rather than doing this, you should have a cache mapping for each cache scheme that you are using -- in your case the 1-hour and 3-hour schemes.
    I would suggest removing one (or both) of the "*" mappings and adding entries along the lines of:
    <pre>
    <cache-mapping>
    <cache-name>near-1hr-*</cache-name>
    <scheme-name>default-near</scheme-name>
    </cache-mapping>
    <cache-mapping>
    <cache-name>near-3hr-*</cache-name>
    <scheme-name>default-away</scheme-name>
    </cache-mapping>
    </pre>
    With this scheme, any cache that starts with "near-1hr-" (e.g. "near-1hr-Cache1") will have 1-hour expiry. And any cache that starts with "near-3hr-" will have 3-hour expiry. Or, to map your cache schemes on a per-cache basis, in your case you may replace "near-1hr-*" and "near-3hr-*" with Cache1 and Cache2 (respectively).
    Jon Purdy
    Tangosol, Inc.

  • Query result caching on oracle 9 and 10 vs indexing

    I am trying to improve performance on oracle 9i and 10g.
    We use some queries that take up to 30 minutes to execute.
    I heard that there are some products to cache query results.
    Would this have any advantage over using indexes or materialized views?
    Does anyone know any products that I can use to cache the results of this queries on disk?
    Personally I think that by using the query result caching I would reduce the cpu time needed to process the query.
    Is this true?

    Your message post pushes all the wrong buttons starting with the fact that 9i and 10g are marketing labels not version numbers.
    You don't tune queries by spending money and throwing resources at them. You tune them by identifying the problem queries, running explain plans, visualizing their output using DBMS_XPLAN, and addressing the root cause.
    If you want help post full version numbers, the SQL statements, and the DBMS_XPLAN outputs.

  • Pinning the sql query in cache

    Hi All,
    I want to pin the sql query is cache because the physical reads are very high. Can anyone tell me steps to pin the sql query in the cache. Current version 10.2.1.0 OS : Windows.
    Reads CPU Elapsed
    Physical Reads Executions per Exec %Total Time (s) Time (s) SQL Id
    19,836 38 522.0 2.1 25.40 50.00 1r0wh3v6bayyk
    With regards
    kccrga

    Oscar,
    I've read Carys paper and a good paper it is.
    The point I was trying to get across is that there should be no rules of thumb. (par this one of course ;) )
    It all depends. Should one concentrate on reducing cpu usage on a disk-bound system? Is doing, say, 100 single-block reads from disk faster than doing 100 current mode gets?

  • Using the client result cache without the query result cache

    I have constructed a client in C# using ODP.NET to connect to an Oracle database and want to perform client result caching for some of my queries.
    This is done using a result_cache hint in the query.
    select /*+ result_cache */ * from table
    As far as I can tell query result caching on the server is done using the same hint, so I was wondering if there was any way to differentiate between the two? I want the query results to be cached on the client, but not on the server.
    The only way I have found to do this is to disable all caching on the server, but I don't want to do this as I want to use the server cache for PL/SQL function results.
    Thanks.

    e3a934c9-c4c2-4c80-b032-d61d415efd4f wrote:
    I have constructed a client in C# using ODP.NET to connect to an Oracle database and want to perform client result caching for some of my queries.
    This is done using a result_cache hint in the query.
    select /*+ result_cache */ * from table 
    As far as I can tell query result caching on the server is done using the same hint, so I was wondering if there was any way to differentiate between the two? I want the query results to be cached on the client, but not on the server.
    The only way I have found to do this is to disable all caching on the server, but I don't want to do this as I want to use the server cache for PL/SQL function results.
    Thanks.
    You haven't provided ANY information about how you configured the result cache. Different parameters are used for configuring the client versus the server result cache so you need to post what, if anything, you configured.
    Post the code you executed when you set the 'client_result_cache_lag' and 'client_result_cache_size' parameters so we can see what values you used. Also post the results of querying those parameters after you set them that show that they really are set.
    You also need to post your app code that shows that you are using the OCI statements are used when you want to use client side result cacheing.
    See the OCI dev guide
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28395/oci10new.htm#sthref1491
    Statement Caching in OCI
    Statement caching refers to the feature that provides and manages a cache of statements for each session. In the server, it means that cursors are ready to be used without the need to parse the statement again. Statement caching can be used with connection pooling and with session pooling, and will improve performance and scalability. It can be used without session pooling as well. The OCI calls that implement statement caching are:
      OCIStmtPrepare2()
      OCIStmtRelease()

  • Same BI query multiple times, different variable values ...

    Hi all, Im having a problem executing a BI query multiple times, passing different parameters. What I did is drag & drop the query multiple times (from the "Find Data" section) and pass different variable values from the signal-in of the nested iview that contains all of them, everyone has its own chart view. The problem is, only the first occurrence of the query is showing (only the first chart). I dont know if there is a restriction, or if I am missing something.
    Thanks in advance.
    Daniel

    Hi all, forget about this, it was a problem in the query definition not in visual composer. Im closing this thread.
    Regards.
    Daniel

  • Avoiding WITH clause when querying Multiple Facts

    OBIEE 10.1.3.4
    We have a report which requires that we query multiple facts, which share the same Item dimension.
    When we run the report, the BI Server generates a query using the WITH clause -
    WITH SAWITH0 ( SELECT.............)
    SAWITH1( SELECT .............)
    SELECT .........
    FROM SAWITH0 FULL OUTER JOIN SAWITH1
    The above query errors out with ORA-918 Column Ambiguously Defined. I cannot find any issue in the query that has been generated.
    The query does fail from SQL Plus with the same ORA error. But each of the select statements executed properly and the complete statement executes when I replace the FULL OUTER JOIN with INNER JOIN.
    I can only assume that this is a bug in Oracle Database.
    Now at times I have seen OBIEE generate separate queries when querying multiple facts and then combine the data together in memory.
    Is there a way that I can force OBIEE to avoid using WITH clause and run separate SELECT statements ? How does the BI Server choose between using a WITH clause or running separate queries ?
    Any help would be appreciated.

    I do not have a multi-dimensional data source.
    My connection pool seems fine to me, I am not sure I need to do anything with the connection pool.
    Hi Turribeach,
    I understand that BI Server uses WITH clause for multiple facts. But I have also seen it issue separate queries against the database.
    So what I am looking to understand under what situation does it issue separate queries i.e. No WITH clause ?
    Thanks

  • Questions about Oracle 9I AS, reports.... to query multiple database

    Hi friends,
    I am working for the HR dept of a big company and our
    group will implement some enviornment to present HR reports for the leadership through web interface.
    I have checked the Oracle 9iAS page and it seems it is
    a pretty nice tool. The reports service is very impressive. We mainly use Java/JSP to do the project,so
    this Oracle9i can fit our development team. One of
    the problem is that we have multiple databases running
    on different machines,including Oracle 7, Oracle 8i and
    SQL Server 2000. So, one of the requirements is to query
    multiple databases of different verdors.
    So my question is:
    can Oracle9i AS (especially the reports service) do this
    multiple database query? I know with pl/sql, we can create
    database link to do this query, but can we do it in
    reports tools?

    Yes you can do Even in the reports.

  • What is the difference of specifying affinity to span multiple caches?

    What is the difference of methods between specifying affinity to span multiple caches and specifying it on a single cache?
    Can I do it in the same way?

    Thank you for reply.
    From the Docs of Coherence we can see that the data affinity is commonly referred to the related entries is contained within a single cache. The following is some fragmentss excerpted from Coherence Docs:
    "Data affinity describes the concept of ensuring that a group of related cache entries is contained within a single cache partition. This ensures that all relevant data is managed on a single primary cache node (without compromising fault-tolerance)."
    "Affinity may span multiple caches (as long as they are managed by the same cache service, which will generally be the case)."

  • Query not cached in BIServerCache

    Hi,
    I am trying to seed to the cache using an agent. I see from the log file nqquery.log that a query is fired at the database when ever the agent is run. Also, the presentation cache is populated. So, if I try to use the analysis again without clearing the presentation cache it opens up fast and I dont see any entry in the nqquery.log. But if I clear the presentation cache from administration by using
    "clear all cursors" and try to access the analysis again, I see that a query is again fired at the database instead of using the BI server cache.
    Any help is greatly appreciated.
    Thanks,
    KK

    Hi,
    Can you check the points in the below URL to ensure that your queries are actually getting cached in BI Server:
    http://obieeblog.wordpress.com/2009/01/19/obiee-cache-is-enabled-but-why-is-the-query-not-cached/
    Thanks

  • Query read / cache modes are set in BW

    Hi Experts,
    What is query read / cache modes are set in BW in order to improve the query performance?
    Thanks
    Rohan

    Hi
    The read mode determines how the OLAP processor gets data during navigation. You can set the mode in Customizing for an InfoProvider and in the Query Monitor for a query.
    http://help.sap.com/saphelp_nw04/helpdata/en/57/b10022e849774f9961aa179e8763b6/content.htm
    Assign points if it helps...
    Regards,
    ARK

  • Querying just cache

    Hi,
    I want to querying coherence cache for each 5 seconds with a cql query. The cache connects to cql processor and processor has not taken any events from any channel. There is no channel that connects to cql processors.
    In the adapter components I am setting and updating the coherence cache and I want to query and filter the data in the cache with a CQL query.
    If I write this code, CEP gives an error, I describe this at below cql query.
                 <![CDATA[
                 select
                      t1.telNo as telNo
                 from
                      customerCache t1
                  ]]>
    <BEA-2045016> <The application context "SOLNoActiveSubs" could not be started. Could not initialize component "<unknown>":
    Invalid statement: "select
                      t1.telNo as telNo
                 from
                      >>customerCache t1<<"
    Description: generic syntax error
    Cause: This DDL command has syntax error
    Action: The syntax expects  '[', as, match_recognize, xmltable, end-of-file, ')', ',', where, group, having, order, left, right, partition, on, primary token>
    ####<Mar 1, 2011 12:07:01 AM EET> <Info> <OSGiLogReaderAdapter> <> <myServer> <Log Event Dispatcher> <> <> <> <1298930821652> <BEA-000000> <Bundle[308] SOLNoActiveSubs, Message (BundleEvent STOPPED), Exception (null), Time (1298930821652)>
    ####<Mar 1, 2011 12:07:01 AM EET> <Notice> <Deployment> <> <myServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <1298930821653> <BEA-2045001> <The application bundle "SOLNoActiveSubs" was undeployed successfully> Is there a way to query coherence cache within CQL processor even there is not any channel which connects to cql processors. Instead, should I use event bean to achieve this?
    Thanks.

    Hi, please follow the CEP programming model to write the application. We use adapter to retrieve external data and convert them to CEP event(POJO or Tuple), and processor is driven by streaming data which means the rules are evaluated only when events come to processor.
    Therefore you need revise your adapter and configure your EPN as something like: Adapter -> Channel -> Processor -> Channel -> UserBean(or Outbound Adapter).
    If you need coherence cache to implement cluster processing, you can use HA adapter alternatively. More discussion needs you state your use case.

  • Querying Multiple databases on Azure SQL

    Does anybody know if there is a way to query multiple Azure sql databases in a query?
    I have tested the query on a standard sql server I have setup here and that works fine.
    I believe Azure does not support cross database queries and you have to do an elastic database query.  Any ideas how this works?
    This topic first appeared in the Spiceworks Community

    Hello. We currently have a database cluster that has a WSUS database on it.  We wanted to setup another WSUS server in our environment, is this possible?  I have read some posts saying that there was a 1 to 1 for WSUS DB to SQL Instance
    but those were from 2008 and 2011 and I am wondering if it is possible today.  If not, what would be the recommendation?  Another SQL Instance or just use the Windows Internal Database. 
    There is still a limitation of 1 WSUS to 1 SQL Instance, because the database name is hardcoded to SUSDB. To use multiple WSUS servers on that same cluster will require the installation of an additional instance.
    If that additional server is destined to be a downstream server, though, I would recommend just using the native Windows Internal Database on the local system.
    Lawrence Garvin, M.S., MCSA, MCITP:EA, MCDBA
    SolarWinds Head Geek
    Microsoft MVP - Software Packaging, Deployment & Servicing (2005-2014)
    My MVP Profile: http://mvp.microsoft.com/en-us/mvp/Lawrence%20R%20Garvin-32101
    http://www.solarwinds.com/gotmicrosoft
    The views expressed on this post are mine and do not necessarily reflect the views of SolarWinds.

Maybe you are looking for