1 Reply Latest reply on May 10, 2018 6:42 AM by Gustavo Fernandes

    Streams vs querying

    Jan Bartel Newbie

      Jetty integrates with infinispan for the storage of http sessions. We need to be able to find http sessions that have become orphaned in infinispan, ie sessions that are older than a given expiry time, but no longer referenced by any jetty server. We support both library mode and remote mode for infinispan, and should be able to interwork with whatever infinispan architecture our users have in place. From the documentation, it looks like our options are to index the session data and use the query interface to retrieve these sessions, or to use the streams interface. So the question is, which is more efficient: queries or streams? We only want to do this search on an infrequent basis; we don't want to cause any long lock-outs during the computation, and we want to ensure that we don't wind up populating the entire contents of the distributed cache into any one node. Any advice welcome.

        • 1. Re: Streams vs querying
          Gustavo Fernandes Apprentice

          Generally speaking, indexed queries are faster than streams for search use cases, but it could add some overhead during normal data writes due to indexing. If you will be doing only infrequent queries, this could not be justifiable, specially if the dataset is small.


          I'd recommend to start using streams (or non-indexed queries which uses stream internally) and if perf is not satisfactory I'd move to indexing.


          Regarding "populating the entire contents of the distributed cache into any one node", could you clarify? Is you search result expect to be very large? Query does support pagination and iteration, and Streams have similar mechanisms.