BestCoderEver
BestCoderEver

Reputation: 567

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

Upvotes: 2

Views: 861

Answers (2)

Valentin Kulichenko
Valentin Kulichenko

Reputation: 8390

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

Upvotes: 1

Glukos
Glukos

Reputation: 21

  1. Index Page contains ordered list of hash values along with links to key-value pairs stored in durable memory. Link = page ID + offset inside page
  2. All links to objects with collided hashes will be present in index page. To perform a lookup, Ignite will dereference links and compare the keys.
  3. This is dependent on object size. You can roughly estimate ratio of data pages to index pages in "typical" application as 90 to 10. However, share of index pages will grow if you add extra indexes: https://apacheignite.readme.io/v2.1/docs/indexes#section-registering-indexed-types

You may also find useful the most recent version of docs: https://apacheignite.readme.io/v2.1/docs/memory-architecture

Upvotes: 2

Related Questions