6 Replies Latest reply on Nov 14, 2011 2:26 AM by ynusis

    Auction System with Infinispan

    ynusis

      What I try to achieve is a Auction System where useres can bid for products. The system runs in memory only and is highly distributed. While Objects are grouped e.g. by the auction id or something similar.

       

      I am playing a bit with Infinispan (came from CouchDB) and wonder how I can achieve something like this:

      get me all the Objects where userid=1

      Because of Infinispans Map/Reduce allows only the output of one element. In CouchDB it is possible to make only a map without a reduce with more than one object for a key as result. How can I do this in Infinispan?

       

      Anorher question is about the Continous Query function. Here I can do querys like the one I introduced at the beginning? Is my example a use case for CQ? Having multiple Auctioners how listens to specific ranges if auction ids to process the bids or so.

       

      Are there any examples to use infinispan as a system where objects belong to users and must thereforebe selected by the user? maybe I just get the whole Infinispan thing wrong.

       

      I would appreciate any kind of hints.

       

      Michael

        • 1. Re: Auction System with Infinispan
          galder.zamarreno

          If you want to do querying, you can do it with our map/reduce framework, or using the query module:

          https://docs.jboss.org/author/display/ISPN/Querying+Infinispan

           

          I'll let one of my colleagues answer the map/reduce specific question.

           

          WRT continous queries, there was some experimental work done on this area: http://community.jboss.org/docs/DOC-15963 - However, we are not currently maintaining it, so if you're interested, use it at your own risk

          1 of 1 people found this helpful
          • 2. Re: Auction System with Infinispan
            vblagojevic

            Michael Wittig wrote:

             

            I am playing a bit with Infinispan (came from CouchDB) and wonder how I can achieve something like this:

            get me all the Objects where userid=1

            Because of Infinispans Map/Reduce allows only the output of one element. In CouchDB it is possible to make only a map without a reduce with more than one object for a key as result. How can I do this in Infinispan?

            Michael,

             

            Can you elaborate a bit more what you are trying to achieve?

             

            Regards,

            Vladimir

            • 3. Re: Auction System with Infinispan
              ynusis

              imagine this scenario:

               

              two entities:

              - auction

              attributes: id, name, user_id

               

              - bid

              attributes: id, auction_id, limit, user_id

               

               

              so how can I achieve this:

              - get all auctions from user with the id x

              - get all bids for auction with the id y

               

              It is important that this queries runs vey very fast. so i thought that this map/reduce thing could be best option.

               

              another use case is, that every time A new bid is entered into the system I have to check if this bid is higher than the last bid. so I though about the continous query stuff.

               

              gives this a better idea of what I want to do? the whole thing is just a litte project to get to know Infinispan.

              • 4. Re: Auction System with Infinispan
                vblagojevic

                Hey,

                 

                Does not seem like a map/reduce use case but rather a query use case. I'll ask Sanne to give it a look.

                 

                All the best,

                Vladimir

                • 5. Re: Auction System with Infinispan
                  sannegrinovero

                  So generally using Map/Reduce is the most efficient approach to apply some transformation/query to all values in the grid; but being the most efficient doesn't make it "faster" in terms of latency or overall performance.

                   

                  If what you need is very fast search, indexing it using Infinispan Query is likely the best choice; it will also make writes/updates slower as the index needs to be updated, so it's a tradeoff: you have to make a choice. Once the index is in place, solving your specific use case will be more efficient than a Map/Reduce collector as using the index it won't need to iterate on all nodes in the grid but will know in advance where the needed data is.

                  • 6. Re: Auction System with Infinispan
                    ynusis

                    ok. thank you very mutch for your help. I will try to setup a small test project and then I came back with my results. Thx!