Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-13953

JDBC Cache Store Implementation of Cache.keySet() method

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 12.1.12.Final, 14.0.0.Dev03, 13.0.10.Final
    • Loaders and Stores
    • None
    • Hide

      Create a Cache with JDBC Cache Store and 10000 entries. Call:

      final CacheSet<String> keys = cache.keySet();
      for (String key : keys)

      {      System.out.println(key); }

      and watch DB Statement Log

      Show
      Create a Cache with JDBC Cache Store and 10000 entries. Call: final CacheSet<String> keys = cache.keySet(); for (String key : keys) {      System.out.println(key); } and watch DB Statement Log

    Description

      Let's say we have infinispan configured with a JDBC Cache Store and have a cache with 10000 entries.

      Now we call the keySet() method on the Cache and iterate over it:

      final CacheSet<String> keys = cache.keySet();
      for (String key : keys)

      {      System.out.println(key); }

      If I watch database queries log I can see that hundreds of statements like this are sent to the database:

      SELECT DATA_COLUMN, ID_COLUMN, TIMESTAMP_COLUMN FROM NAME_OF_TABLE WHERE TIMESTAMP_COLUMN > 1655106467397 OR TIMESTAMP_COLUMN < 0

      This means that the whole table is fetched hundreds of times in the Iterator implementation.

      This brings big performance issues and should be solved asap.

      I have tested this with ininfispan 8 also, there is only one fetch of the whole table in the Iterator implementation, which is ok.

       

       

      Attachments

        Activity

          People

            wburns@redhat.com Will Burns
            thaefner Tobias Häfner (Inactive)
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: