डेटाबेस की बुनियाद
(tontinton.com)bashdb की बुनियाद
- सबसे सरल डेटाबेस प्रोग्राम
bashdbदो bash functions से बना है. db_setfunction डेटा को फ़ाइल में जोड़ता है, औरdb_getfunction डेटा को खोजता है.bashdbकी समस्याओं में durability, atomicity, isolation, performance आदि शामिल हैं.
bashdb को ACID के साथ बेहतर बनाना
- ACID डेटाबेस transaction की properties को दर्शाता है: atomicity, consistency, isolation, durability.
bashdbकी durability बेहतर करने के लिएdb_setमेंsynccommand जोड़ा जाता है.- isolation के लिए
flockprogram का उपयोग करके file locking जोड़ी जाती है.
Durability
fsyncऔरfdatasyncwrite buffer को disk पर flush करने वाले system calls हैं.synccommand सभी 'dirty' pages को disk पर flush करती है, और-dflagfdatasyncको call करता है.
Isolation
flockका उपयोग करकेbashdbको multi-process isolation दी जाती है.flockfile locking के लिए Linux program है, और-sflag के साथ concurrent reads की अनुमति देता है.
बुरी खबर
bashdbके साथ atomicity सुनिश्चित करने का कोई सरल तरीका नहीं मिलता.- performance सुधारने के लिए
O(n)algorithm को बेहतर बनाना ज़रूरी है.
Storage engine
- storage engine का उद्देश्य persistent storage में डेटा को पढ़ने और लिखने के लिए abstraction देना है.
- storage engine design का लक्ष्य disk I/O और disk seek को कम से कम करना है.
Mutable B-tree
- B-tree, BST का एक ऐसा रूप है जिसमें spatial locality होती है, जिससे disk I/O और seeks कम होते हैं.
- B-tree एक generalized BST है जिसमें nodes अधिक children रख सकते हैं.
Immutable LSM tree
- LSM tree एक sequentially written immutable data structure है जो write-heavy workload के लिए फायदेमंद है.
- LSM tree मेमोरी में डेटा buffer करता है, और एक तय क्षमता तक पहुँचने पर उसे sorted SSTable के रूप में flush करता है.
Bloom filter
- Bloom filter एक probabilistic data structure है जो यह कुशलता से जाँच सकता है कि कोई item set में मौजूद नहीं है.
- Bloom filter hash functions का उपयोग करके काम करता है, और इसकी space complexity
O(log n)है.
Write Ahead Log
- WAL एक विशेष फ़ाइल है जो सभी transaction operations को log करती है, और database process के शुरू होने पर state को फिर से reconstruct करती है.
Isolation
- isolation हासिल करने के लिए pessimistic locking, optimistic locking, या MVCC का उपयोग किया जा सकता है.
- ANSI/ISO standard SQL 92 विभिन्न read isolation levels को परिभाषित करता है.
Distributed systems
- distributed systems जटिलता बढ़ाते हैं, और availability तथा horizontal scaling के लिए डेटा को कई machines में बाँटा जा सकता है.
- CAP theorem के अनुसार, कोई system consistency, availability, और partition tolerance में से केवल दो की ही गारंटी दे सकता है.
Consistent hashing
- consistent hashing डेटा partitioning की एक विधि है जो nodes जोड़ने या हटाने पर migrate होने वाले items की मात्रा को कम करती है.
GN⁺ की राय:
- डेटाबेस की बुनियादी समस्याओं और ACID properties की समझ, database engineering का मूल है.
bashdbउदाहरण वास्तविक डेटाबेस systems में आने वाली समस्याओं को समझने में मदद करता है.- storage engine और distributed systems का design, डेटाबेस की performance और reliability तय करने वाले महत्वपूर्ण तत्व हैं.
1 टिप्पणियां
Hacker News राय
पहली टिप्पणी का सारांश:
दूसरी टिप्पणी का सारांश:
तीसरी टिप्पणी का सारांश:
चौथी टिप्पणी का सारांश:
पाँचवीं टिप्पणी का सारांश:
छठी टिप्पणी का सारांश:
सातवीं टिप्पणी का सारांश:
sync; mv; syncका उपयोग करके हासिल की जा सकती है।आठवीं टिप्पणी का सारांश:
नौवीं टिप्पणी का सारांश:
दसवीं टिप्पणी का सारांश: