Search code examples
ignite

B+ Tree and Index Page in Apache Ignite


I'm trying to understanding the purpose of B+ Tree and Index Pages for Apache Ignite as described here: https://apacheignite.readme.io/docs/page-memory

I have a few questions:

  1. What exactly does an Index Page contain? An ordered list of hash code values for keys that fall into the index page and "other" information that will be used to locate and index into the data page to store/get the key-value pair?
  2. Since hash codes are being used in the index pages, what would happen if collision occurs?
  3. For a "typical" application, do we expect the number of data pages to be much higher than the number of index pages ? (since data pages contain key-value pairs)
  4. What type of relation exists between a distributed cache that we create using ignite.getOrCreateCache(name) and a memory region? 1-to-1, Many-to-1, 1-to-Many, or Many-to-Many?
  5. Consider the following pseudo code:

Ignite ignite = Ignition.start("two_server_node_config"); IgniteCache<Integer,String> cache = ignite.getOrCreateCache("my_cache"); cache.put(7, "abcd");

  1. How does Ignite determine the node to put the key into?
  2. Once the node where to put the key is determined, how does Ignite locate the specific memory region the key belongs to?

Thanks


Solution

  • Answering last two questions:

    1. Many-to-1. Same memory region can be used for multiple caches.
    2. This is based on affinity. Basically, cache key is mapped to affinity key (by default they are the same), and then affinity function is called to determine partition and node. Some more details about affinity here: https://apacheignite.readme.io/docs/affinity-collocation