What is Data Replication?
Data Replication เป็นวิธีการ Copy Data เพื่อให้แน่ใจว่าข้อมูลทั้งหมดคงเหมือนกันใน Real-time ระหว่าง Data Resources ทั้งหมด คิดถึง Database Replication เป็น Net ที่จับ Information ของคุณและเก็บไม่ให้ตกหลุมรอยและหายไป Data ไม่ได้ Stay Stagnant มัน Ever-changing มันเป็น Ongoing Process ที่ Ensure Data จาก Primary Database Mirrored ใน Replica แม้จะอยู่ฝั่งโลกตรงข้าม
วันนี้ "Instantaneous" ไม่พอแล้ว Cutting Latency ลง Sub-millisecond Intervals เป็น Universal Objective เราทุกคนเคยเห็นสถานการณ์นี้ — กด Refresh Button บน Website รออย่างเหมือนนצח (Seconds) เพื่อดู Information Updated Latency Decreases Productivity สำหรับ User Achieving Near-real-time เป็น Goal Zero Time Lag เป็น New Ideal สำหรับ Use Case ใดๆ
How does Data Replication Work?
Data Replication คือการ Copy Data จาก Host หนึ่งไปอีก Host เช่นระหว่าง Two On-prem หรือ One On-prem to Cloud และต่อไป จุดประสงค์คือ Achieve Real-time Consistency with Data for All Users Wherever They're Accessing Data From Data-Driven Business Models (DDBMs) เช่น Gaming Industry รู้สึกหนักบน Analytics ที่ได้จาก Real-time Data สำหรับ Clearer Understanding ของ Just How Necessary Real-time Accessibility Is for a DDBM ดู Video ด้านล่าง:
What are the Benefits of Data Replication?
Improved Reliability / Disaster Recovery
ในกรณี Emergency หาก Primary Instance ถูก Compromise Vital to Have Mission-critical Applications Safeguarded with a Replica that Can Be Swapped in its Place Disaster Recovery Replication Methods Work Similarly to a Backup Generator Imagine Blowing a Critical Fuse หรือ Power Grid Goes Dark — You Won't Have to Worry Because You Have a Backup Generator to Swoop in as a Substitute and Keep Your Lights Running
Because Replica Instances Are Exact Copies of Primary Instances You Can Guarantee Performance Will Not Falter Regardless of What Happens to Your Primary Even if the Link Between a Primary and a Replica Breaks Performance Is Still Assured as the Primary Will Enact a Partial Resynchronization Gathering the Commands that Were Not Delivered to the Replica During the Disconnection If Not Possible a Full Resynchronization Will Be Initiated Using a Snapshot
Increased App Performance
By Spreading Data Across Multiple Instances You're Helping to Optimize Read Performance Performance Is Also Optimized by Having Your Data Accessible in Multiple Locations Thus Minimizing Any Latency Issues Also When Replicas Are Directed to Process Most of Your Reads That Opens Up Space for Your Primary to Tackle Most of the Heavy Lifting of Writes
More Efficient IT Teams
Reduction in IT Labor to Manually Replicate Data
Understanding Full Data Replication vs. Partial Replication
Full Database Replication เกิดขึ้นเมื่อ Entire Primary Database Replicated ภายใน Every Replica Instance Available This Is a Holistic Approach that Mirrors Pre-existing, New, and Updated Data to All Destinations Though This Approach Is Very Comprehensive It Also Calls for a Considerable Amount of Processing Power and Encumbers the Network Load Because of the Large Size of the Data Being Copied
Unlike Full Replication Partial Replication Only Mirrors Some Parts of the Data Typically Recently Updated Data Partial Replication Isolates Particular Bits of Data Following the Importance of the Data at a Specific Location For Example a Large Financial Firm with Headquarters in London Could Have Many Satellite Offices Operating Around the World with an Office in Boston Another in Kuala Lumpur and So On
Partial Replication Allows the Analysts in London to Have Only UK-pertinent Data at Their Site and Have Only That Data Be Consistently Replicated for Their Needs The Other Satellite Offices in the United States and Malaysia Respectively Can Do the Same and Not Bog Down Any One System Which Improves Performance and Minimizes Network Traffic
Examples of Data Replication
Transactional Replication
Form of Database Replication นี้เห็น Data จาก Primary Database Replicating Data in Real-time to a Replica Instance by Mirroring These Changes in the Order that They Were Made in the Primary Database This Optimizes Consistency The Replication Takes What Is Called a "Snapshot" of the Data in the Primary and Uses that Snapshot as a Blueprint of What Needs to Be Replicated Elsewhere With Transactional Replication You Can Track and Distribute Changes as Needed With Transactional Replication You Can Track and Distribute Changes as Needed
Given the Incremental Nature of This Process Transactional Replication Isn't the Optimal Choice When Looking for a Backup Database Option Transactional Replication Is a Useful Choice in Situations Where You Need Real-time Consistency Across All Data Locations Where Each Minuscule Change Needs to Be Accounted For Not Just the Overall Impact of the Changes and If Data Is Changing Regularly from One Specific Location
Snapshot Replication
As Its Name Suggests Snapshot Replication Takes a "Snapshot" of the Data from the Primary as It Appears at a Specific Moment and Moves It Along to the Replica Like a Photograph Snapshot Replication Captures What Data Looks Like at a Point in Time as It Looks When It Moves from the Primary to the Replica but Doesn't Account for How It Is Later Updated Thus Don't Use Snapshot Replication to Make a Backup
In the Event of a Storage Failure Snapshot Replication Will Have No Path to Updated Information To Keep Your Information Consistent You Can Start with a Snapshot but Then Ensure that All Changes Made to the Primary Are Then Passed on to Every Replica
On the Other Hand This Method Is Rather Helpful for Recoveries in the Event of Accidental Deletion Think of It Like Your Version History on Google Docs Wish You Could Work on Your Presentation the Way It Looked Four Hours Ago? If Google Docs Takes a Snapshot of Your Work at Hourly Intervals You Could Click Back on That Version or "Snapshot" from Four Hours Ago and See What Your Information Looked Like Then
Merge Replication
This Method Typically Begins with a Snapshot of the Data and Distributes that Data to its Replicas and Maintains Synchronization of Data Between the Entire System What Makes Merge Replication Different Is that It Allows Each Node to Make Changes to the Data Independently but Merges All Those Updates into a Unified Whole
Merge Replication Also Accounts for Each Change Made at Each Node To Go Back to Our Previous Google Docs Example If You've Ever Shared a Document with Coworkers Who Then Leave Comments and Edits on Your Document You'll See Who Made What Changes and at What Time Merge Replication Functions in a Very Similar Way
Key-Based Replication
Also Known as Key-based Incremental Data Replication This Method Leverages a Replication Key to Identify, Locate and Alter Only the Specific Data that Has Been Changed Since the Last Update By Isolating That Information It Facilitates the Backup Process Working with Only as Much Load as It Has to Though Key-based Replication Makes for a Speedy Method of Refreshing New Data It Comes with the Disadvantage of Failing to Replicate Deleted Data
Active-Active Geo-Distribution
Active-Active Geo-Distribution Also Known as Peer-to-peer Replication Works Somewhat Like Transactional Replication as It Relies on Constant Transactional Data via Nodes With Active-active All the Nodes in the Same Network Are Constantly Sending Data to One Another by Synching the Database with All the Corresponding Nodes All the Nodes Are Also Writable Meaning Anyone Can Change the Data Anywhere Around the World and It Will Reflect in All the Other Nodes This Guarantees Real-time Consistency No Matter Where in the Globe the Change May Occur
Conflict-free Replicated Data Types (CRDTs) Define How This Data Is Replicated In the Event of a Network Failure with One of the Replicas or Nodes the Other Replicas Will Have All the Necessary Data Ready to Replicate Once that Node Comes Back Online This Is a Solid Solution for Enterprises that Need Several Data Centers Located Across the Globe Take a Look at the Video Below for Examples of Active-Active Geo-Distribution Use Cases
Synchronous / Asynchronous Replication
With Synchronous Replication the Data Is Written in Both the Primary and the Replica at the Same Time Hence the Name Asynchronous Replication on the Other Hand Only Copies Data to the Replica Once the Writes Have Already Occurred in the Primary Asynchronous Replication Doesn't Tend to Happen in Real-time Though It's Possible Because of the Scheduled Write Operations that Tend to Happen in Batches with Asynchronous Sometimes Data Gets Lost in Most Cases When a Fail-over Event Transpires Still Asynchronous Is an Apt Solution When Having to Replicate Data Over Long Distances as the Real-time Component Isn't a Mission-critical Factor
What are Common Data Replication Implementation Challenges?
Maintaining Data Across Multiple Instances Requires a Consistent Set of Resources The Cost of Having a Primary with Multiple Replica Instances Can Be Quite High in Many Instances To Maintain These Operations and Assure that No System Failures Occur Requires a Dedicated Team of Experts And Depending on the Architecture the Network Bandwidth Could Get Overloaded When New Processes Are Put in Place Which Could Affect Latencies, Reads, and Writes
Redis Makes Data Replication Expedient, Cost-effective, and Simple to Implement Are You Ready for the Redis Enterprise Treatment?