4 Replies Latest reply on May 30, 2014 10:40 AM by rpelisse
      • 1. Re: Database or datagrid?
        wdfink

        Depends on your requirements.

        In Memory DB like H2 which is included in JBoss/WildFly is a local instance, you might restricted to the machines memory.

        You can use SQL as query language

         

        DataGrid can be clustered, provide replication across several instances, distribution to extend the memory as the entries are spread over several instances and use the memory of several machines.

        Simple speaking a Infinispan cache is a HashMap with enhanced features

        Also you have a query language here

        • 2. Re: Database or datagrid?
          sostermino

          In general, what kind of situations are better resolved by using an in-memory DB clustered and by using an in-memory DG?

          • 3. Re: Database or datagrid?
            wdfink

            As I said, it depends on your requirements.

            If you need SQL you need to have a database and you can use a InMemory one.

            If you need to share huge amount of data which exeeds your memory you can use DataGrid where it is possible to spread this data accross several instances and configure replication/eviction/expiration according to your needs.

            • 4. Re: Database or datagrid?
              rpelisse

              Its' very difficult to reply "in general" because a Data Grid can be used in very, very different ways. It would like try to ask the usage scenario of an operating system or a data base. You can use Linux on small chipset, embedded on a plane, or as a back server for Java/JEE applictations. One can use an SQL database to process very complex queries, with many JOIN, or just to store simple data, but to leverage the transaction features.

               

              That being said, here some hints on when use a data grid over a SQL storage:

              • Do I used a complex (ie relational) data schema ?
                • No, may be a good case for data grid
              • Do I need to "search" or can I access directly a record by using a key ?
                • No, may be good case
              • Do I read more data than I write them ?
                • Yes, may be a good case
              • Do I need to store a huge amount of data, that will increase over time ?
                • Also a good case
              • ....