631
GB
What is 'database per service' pattern in microservices and what consistency trade-off does it introduce?
IN
माइक्रोसर्विसेज में 'डेटाबेस प्रति सेवा' पैटर्न क्या है और यह किस स्थिरता व्यापार-बंद का परिचय देता है?
A
Database per service means each developer gets their own personal database for testing
प्रति सेवा डेटाबेस का मतलब है कि प्रत्येक डेवलपर को परीक्षण के लिए अपना निजी डेटाबेस मिलता है
B
Each microservice owns and exclusively accesses its own database, with no other service allowed direct access — this enables service independence (schema changes don't break other services) but introduces the trade-off that queries spanning multiple services' data can no longer use simple SQL joins, requiring API composition or data duplication via events
प्रत्येक माइक्रोसर्विस अपने स्वयं के डेटाबेस का मालिक है और विशेष रूप से उस तक पहुंचता है, किसी अन्य सेवा को सीधे पहुंच की अनुमति नहीं है - यह सेवा स्वतंत्रता को सक्षम बनाता है (स्कीमा परिवर्तन अन्य सेवाओं को नहीं तोड़ता है) लेकिन व्यापार-बंद का परिचय देता है कि एकाधिक सेवाओं के डेटा को फैलाने वाले प्रश्न अब सरल एसक्यूएल जॉइन का उपयोग नहीं कर सकते हैं, घटनाओं के माध्यम से एपीआई संरचना या डेटा डुप्लिकेशन की आवश्यकता होती है
C
Database per service is only applicable when using cloud-hosted databases; on-premise systems cannot use this pattern
प्रति सेवा डेटाबेस केवल क्लाउड-होस्टेड डेटाबेस का उपयोग करते समय लागू होता है; ऑन-प्रिमाइसेस सिस्टम इस पैटर्न का उपयोग नहीं कर सकते
D
This pattern eliminates all data consistency concerns since each service has full control of its data
यह पैटर्न सभी डेटा स्थिरता संबंधी चिंताओं को समाप्त कर देता है क्योंकि प्रत्येक सेवा का अपने डेटा पर पूर्ण नियंत्रण होता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
A monolith's 'show me all orders with customer details and product names' is a simple SQL JOIN. In microservices with database-per-service, Orders, Customers, and Products live in separate databases owned by separate services — there's no cross-database JOIN. Solutions: API composition (call all three services, merge results in application code — slower, more complex) or maintaining a denormalised read-only copy of needed data via event subscription (faster reads, eventual consistency, additional storage).
व्याख्या (हिन्दी)
एक मोनोलिथ का 'ग्राहक विवरण और उत्पाद नाम के साथ मुझे सभी ऑर्डर दिखाएं' एक सरल एसक्यूएल जॉइन है। डेटाबेस-प्रति-सेवा वाले माइक्रोसर्विसेज में, ऑर्डर, ग्राहक और उत्पाद अलग-अलग सेवाओं के स्वामित्व वाले अलग-अलग डेटाबेस में रहते हैं - कोई क्रॉस-डेटाबेस जॉइन नहीं है। समाधान: एपीआई संरचना (सभी तीन सेवाओं को कॉल करें, एप्लिकेशन कोड में परिणाम मर्ज करें - धीमी, अधिक जटिल) या ईवेंट सदस्यता के माध्यम से आवश्यक डेटा की एक असामान्य रीड-ओनली कॉपी बनाए रखना (तेज रीड, अंतिम स्थिरता, अतिरिक्त भंडारण)।