• Level Up Coding
  • Posts
  • LUC #20: Safeguard Your Data — Build a Solid Backup and Recovery Strategy

LUC #20: Safeguard Your Data — Build a Solid Backup and Recovery Strategy

Plus, how DNS lookup works, principles of OOP, and end-to-end encryption

Hello, fellow engineers! Thanks for joining us for another round of Level Up Coding's newsletter.

In today’s issue:

Read time: 7 minutes

Steps to a Solid Data Backup and Recovery Strategy

Widespread data loss is one of the few events that can trigger a company-wide crisis. The consequences range from operational interruptions and delays to harming the company's reputation. Businesses often have legal obligations to protect the data they possess, and data loss can lead to significant financial losses even to the point of bankruptcy or closure for small businesses.

The onus is on the engineering team to set up processes and safety nets to ensure that data can be recovered when such an event occurs; this is done through robust backup and recovery plans.

So, how can you create a foolproof backup and recovery plan? Dive into the essential steps below.

Identify the critical data

Backup storage and recovery resources are limited and often costly, but if you know what your system's critical data is it'll be easier to keep the costs low. By identifying the most crucial data, businesses can allocate appropriate resources to protect it. This ensures that the most vital information gets the highest protection, without taking up resources on non-essential data.

Choose the Right Backup Type

There are three key backup types to choose from:

  • Full Backup: This involves copying all data, ensuring you have a complete snapshot. While comprehensive, it's time-consuming and requires significant storage.

  • Incremental Backup: After a full backup, only the changed or newly added data is stored. This approach is faster but requires a precise sequence for recovery.

  • Differential Backup: This only backs up data changed since the last full backup, without considering incremental backups. It’s a middle-ground approach.

The appropriate approach often incorporates multiple backup types. For example, regular incremental or differential backups and infrequent full backups.

Determine Backup Frequency

Set your backup cadence based on how often your data changes. For an application with frequently changing data, nightly backups might be necessary, while for those with more static data, weekly or even monthly backups could suffice.

Offsite and Onsite Backups

Keeping all your backups in one place is a recipe for disaster. Diversify storage by employing a combination of onsite (for quick recovery) and offsite (for disaster recovery) backups. Onsite backups are typically done using local storage devices like external hard drives or network-attached storage, they offer the advantage of quick access and restoration and are ideal for rapid recovery from minor issues. Offsite backups, on the other hand, involve storing data at a different physical location, whether it be on remote servers, cloud services, or even tapes stored in a secure vault. These are essential for recovery from major incidents like natural disasters or fires that could destroy onsite backups.

Prioritize Recovery Speed

In the event of data loss, recovery speed is crucial. By identifying the most crucial data in the first step, you can ensure that the most essential systems are stored first. Take advantage of high-speed storage solutions and technologies like solid-state drives to make your data retrieval faster. Employ dedicated recovery tools and solutions that offer rapid restore capabilities. Lastly, ensure network infrastructure supports fast data transfers, as bottlenecks can delay restoration from cloud or remote backups.

Regularly Test the Recovery Process

Your data backups are only as good as your recovery process. Regularly simulate disaster scenarios to ensure that recovery processes are up to date and can operate as expected when it's needed. Also, maintain updated documentation on recovery procedures for your team.

Automate Where Possible

Human error is among the leading causes of data loss. By automating backups using trusted tools and software, you minimize these risks. As a side note, this logic also applies to any major and regular tasks that write or update data; ensure these are automated with scripts and not done manually. Moreover, automation can provide logs, alerts, and status reports, ensuring transparency.

Encrypt and Protect Your Backups

Security is paramount to every component of a system, and your data backups are no exception. Encrypting backups ensures that even if they fall into the wrong hands, the data remains unreadable.

Consider Versioning

Version-controlled backups can be lifesavers. By maintaining versions of your data, you can roll back to any point in time, providing flexibility and speed in recovery scenarios.

While systems should be built to prevent data losses from ever happening, it's important to prepare for the worst. A robust data backup and recovery strategy acts as a safety net that protects businesses from the tremendous impact of data losses. A truly protected system is built to prevent major accidents while ensuring that they can bounce back efficiently and quickly when accidents do occur.

How DNS Lookup Works (recap)

  • DNS lookup converts human-readable domain names into IP addresses.

  • The process involves several components and back-and-forth communication to locate an IP address.

  • Caching is used at multiple levels to speed up the process.

  • If the initial checks of browser and OS caches don’t provide the required information, then the recursive resolver (usually ISP-managed) begins the search for the IP address on behalf of the user.

  • The recursive resolver communicates with several DNS servers to locate the nameserver that knows the IP address. 

  • Once the recursive resolver has retrieved the IP address, it then sends it back to the OS, the OS then sends it to the browser. The browser then fetches the website by making a request to the web server associated with the IP address.

Principles of Object-oriented Programming (recap)

Object-oriented programming (OOP) is a programming paradigm in which programs are designed using classes and objects. This design allows related functions and data to be grouped together in self-contained and reusable units.

OOP has 4 main principles:

  • Encapsulation: hides internal details but exposes data & methods via a public interface, preventing unintentional changes.

  • Inheritance: allows classes to inherit properties and methods from other classes, making code reusable and organized.

  • Abstraction: reduces complexity by only surfacing the information needed for a given context or use case.

  • Polymorphism: is a principle that enables objects to change their form by extending or overriding existing methods.

End-to-end Encryption (recap)

End-to-end encryption (E2EE) protects your messages and files from being accessed and manipulated by other people other than those you send them to.

Steps involved in the process:

  1. Keys generated

  2. Public key exchange

  3. Encryption (two types: symmetric, asymmetric)

  4. Data transmission

  5. Decryption

End-to-end encryption is only as powerful as the cryptographic algorithms used, and how well they are implemented. When done right, E2EE boosts the security of digital communications, protecting them from eavesdropping and tampering.

That wraps up this week’s issue of Level Up Coding’s newsletter!

Join us again next week where we’ll explore how TCP works, how to use Big O to ace technical interviews, data streams, and the process behind data mining.