5 साल तक PostgreSQL को scale करते हुए सीखी गई बातें
(onesignal.com)पुश नोटिफिकेशन सेवा OneSignal ने 40 DB servers पर 75TB डेटा चलाते हुए जो बातें सीखीं
-
डेटा ओवरव्यू: subscribers, notifications tables सबसे बड़े हैं
-
Bloat: वह स्थिति जिसमें अधिक storage लगता है, performance धीमी हो जाती है, और अधिक computing power की जरूरत पड़ती है
→ Table bloat: VACUUM
→ Index bloat: Heap Only Tuple(HOT) optimization
→ autovacuum चालू करें
→ pg_partman extension से table partitioning को automate करें
→ pg_repack और pgcompacttable
- Database Upgrades
→ pg_upgrdae के लिए database offline करना पड़ता है, इसलिए यह विकल्प नहीं था
→ नया version वाला PostgreSQL server अलग से setup करें और pglogical extension के साथ logical replication इस्तेमाल करें
- XID Wraparound
→ PostgreSQL का MVCC(Multi Version Concurrency Control) फीचर 32-bit transaction ID का उपयोग करता है, इसलिए transactions ज्यादा हों तो यह जल्दी wrap हो सकता है
→ बचे हुए XID की monitoring महत्वपूर्ण है
→ autovacuum_freeze_max_age
- Replica Promotion
→ Replica को जल्दी promote करने के लिए उसे haproxy के पीछे रखा जाता है
- Partitioning
→ हाल के PostgreSQL versions में table partitioning फीचर built-in है
→ जब partitioning की जरूरत हो, तो संभव हो तो इसे ज्यादा partitions में बांटने की सिफारिश की जाती है
→ OneSignal 16 से 256, और फिर 4096 partitions तक जाने की योजना बना रहा है
- Sharding
→ built-in support नहीं है
→ शुरुआत में v4 UUID को range के आधार पर अलग किए गए Tenant ID से shard किया गया था
→ अब partition और shard-aware data proxy बनाया जा रहा है
1 टिप्पणियां
PostgreSQL की कमियां https://hi.news.hada.io/topic?id=1829
PostgreSQL V12 की कम-ज्ञात सुविधाएं https://hi.news.hada.io/topic?id=988
PostgreSQL DB की जगह बचाना https://hi.news.hada.io/topic?id=3674