chapter two

2 Review of Hash Tables and Modern Hashing

 

This chapter covers:

  • Reviewing dictionaries and why hashing is ubiquitous in modern systems
  • Refreshing some basic collision-resolution techniques: theory and real-life implementations
  • Exploring cache-efficiency in hash tables
  • Using hash tables for distributed systems and consistent hashing
  • Learning how consistent hashing works in P2P networks: use case of Chord

We begin with the topic of hashing for a couple of reasons. First, hash tables have proved irreplaceable in modern systems and hashing is one of the most, if not the most applicable algorithm/data structure out there. Second, hash tables grow linearly with the size of the dataset they store, and there is a growing interest in techniques and tricks that address issues arising from having large hash tables, such as the choice of a collision-resolution technique and a hash function, compact representation, resizing, etc. Third, hashing has been over time adapted and repurposed to serve in massive peer-to-peer and distributed systems, and the new hashing methods, such as consistent hashing, have been designed for use in such settings. And fourth, hashing is the backbone for all the data structures we cover in Part I of the book that deals with sketching and approximate membership, frequency and cardinality data structures, so doing a brief review of hashing can’t hurt as a preparation for future chapters.

2.1   The great idea of hashing

2.2   Usage scenarios in modern systems

2.2.1    Deduplication in backup/storage solutions

2.2.2   Plagiarism detection with MOSS and Rabin-Karp fingerprinting

2.3   O(1) --- what’s the big deal?

2.4   Collision Resolution: theory vs. practice

2.4.1   Cache-efficiency vs. number of probes

2.4.2   Usage scenario: How Python’s dict does it

2.5   Hash Tables for Distributed Systems: Consistent Hashing

2.5.1   Consistent hashing scenario: Chord

2.6   Summary