<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: DavidCockerill</title>
    <description>The latest articles on Forem by DavidCockerill (@davidcockerill).</description>
    <link>https://forem.com/davidcockerill</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F401430%2F8165f7df-71ae-4fdc-bb80-b505e5702bc0.jpeg</url>
      <title>Forem: DavidCockerill</title>
      <link>https://forem.com/davidcockerill</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/davidcockerill"/>
    <language>en</language>
    <item>
      <title>What is Geo Redundancy?</title>
      <dc:creator>DavidCockerill</dc:creator>
      <pubDate>Tue, 30 Mar 2021 14:54:51 +0000</pubDate>
      <link>https://forem.com/harperfast/what-is-geo-redundancy-2pgi</link>
      <guid>https://forem.com/harperfast/what-is-geo-redundancy-2pgi</guid>
      <description>&lt;p&gt;Let's talk geo-redundancy! Ever heard of it? There are many benefits to redundancy, and it is important for IT teams and general organizations to utilize/implement redundancy methodologies as a safety net. Having these systems in place can improve reliability and availability while reducing downtime. This is because there are certain variables that businesses rely on that are not guaranteed and therefore might need a backup plan. For example; Internet, hardware, power, and/or data storage. Many of these variables can affect a large area. They may not happen often, but one power failure that takes your application offline is one too many. Geo redundancy can reduce or remove these risks, and better prepare organizations to handle disaster recovery. &lt;/p&gt;

&lt;p&gt;As the name implies, geo-redundancy refers to the practice of providing redundancy (extra or duplicates) through physically separating infrastructure across multiple geographical locations, and because I work for a database company, I will be discussing it in relation to databases. &lt;/p&gt;

&lt;p&gt;Geo redundancy is a powerful (and somewhat magical) force that ensures high availability and disaster recovery. It will replicate your data and store it in other databases located in separate physical locations. It does this so that if a location fails or simply needs to be taken offline, your other location, which also stores your data, will not be affected. &lt;/p&gt;

&lt;p&gt;Geo redundancy is super easy to implement in HarperDB through its &lt;a href="https://harperdb.io/developers/documentation/clustering/" rel="noopener noreferrer"&gt;clustering engine&lt;/a&gt;, which replicates data between instances of HarperDB using a highly performant, bi-directional &lt;a href="https://harperdb.io/developers/documentation/clustering/creating-a-subscription/" rel="noopener noreferrer"&gt;pub/sub-model&lt;/a&gt;. The first step is to install HarperDB in multiple geographical locations. A single instance/installation of HarperDB constitutes a node. Once HarperDB node subscriptions are configured via the API they establish a WebSocket connection between each other to replicate data. When two or more nodes are subscribed to each other you have a cluster. Depending on how the nodes were subscribed to each other, a transaction on one node can automatically be published to another. And there you have it, the start of geo-redundancy!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7bzt0v2d9cey8uqhav26.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7bzt0v2d9cey8uqhav26.png" alt="Alt Text" width="566" height="603"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this case, HarperDB provides a “backup plan” to ensure that your organization is prepared for even the most unpredictable outcomes. The term redundancy means “too much” or “more than is needed.” This of course is not necessary or helpful in all situations of life or business, but when it comes to the world of data, IT, and engineering, you can bet your bottom dollar that you will regret not having a redundancy plan in place. If you fear that implementing redundancy is a waste of time, just think, what would happen if you lost your data? HarperDB enables you to implement geo-redundancy in a simple and cost-effective manner, and you can now sleep easy knowing your data is safely stored across the globe.&lt;/p&gt;

</description>
      <category>infrastructure</category>
      <category>webdev</category>
      <category>database</category>
      <category>programming</category>
    </item>
    <item>
      <title>Strict Schema Enforcement vs. Schemaless vs. Dynamic Schema</title>
      <dc:creator>DavidCockerill</dc:creator>
      <pubDate>Thu, 17 Dec 2020 16:01:10 +0000</pubDate>
      <link>https://forem.com/harperfast/strict-schema-enforcement-vs-schemaless-vs-dynamic-schema-333a</link>
      <guid>https://forem.com/harperfast/strict-schema-enforcement-vs-schemaless-vs-dynamic-schema-333a</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwkkpsq2h0a30q1euv18o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwkkpsq2h0a30q1euv18o.png" alt="Alt Text" width="501" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The debate over whether to use a schema or not has passionate support on both sides. One side appreciates data integrity constraints and predictability, while the other prefers more flexibility (or “agility”) and time effectiveness. The ultimate answer as to which is “better” most likely depends on the specific project, data used, and associated skill set. &lt;/p&gt;

&lt;p&gt;In this post I will cover strict schema enforcement, schemaless, and dynamic schema, including the pros and cons of each one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Strict Schema
&lt;/h3&gt;

&lt;p&gt;A schema is a blueprint of how a database is constructed. It doesn’t actually hold the data, but instead describes the shape of the data and how it might relate to other tables in the database. Schema’s contain information on all the objects in a database such as tables, attributes, data types and relationships, it can also include triggers, views, indexes and so on. Some common databases that use strict schemas are Oracle, MS SQL Server and PostgreSQL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gives a high level view of the structure and relationship of the tables in your database. Can make it easier to keep track of what information is and is not in the database. &lt;/li&gt;
&lt;li&gt;Enforces data integrity constraints, these are a set of rules that maintain consistent formatting of all entries. &lt;/li&gt;
&lt;li&gt;More predictable, which can provide a more efficient storage and indexing structure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes time to design and build when starting a new project. Modifying the schema can be tricky. Can be a lot of work to maintain.&lt;/li&gt;
&lt;li&gt;Rigid limits, not flexible.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1mle7a2lrowgefuz96rv.png" width="500" height="389"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Schemaless
&lt;/h3&gt;

&lt;p&gt;As the name implies, schemaless does not use a schema. It means the database does not have any fixed structure. A schemaless database does not enforce any data type limitations and can store structured and unstructured data. Some common schemaless databases are MongoDB, CouchDB, and Google Cloud Datastore.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Quick and easy to setup because there is no schema to model or additional layers required, so the complexity is greatly reduced. With just a few clicks a developer can have a working database.&lt;/li&gt;
&lt;li&gt;Updates can be made on the fly without having to make changes to a schema or shutting the database down.&lt;/li&gt;
&lt;li&gt;More flexibility when storing data. You don’t need to decide up front what you’re going to store, how it’s structured or related to other information in the database.&lt;/li&gt;
&lt;li&gt;Less overhead, which can lead to better performance and scalability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No columns means the application has to parse every document to find requested data.&lt;/li&gt;
&lt;li&gt;No unified metadata, you end up looking at the application to understand the data rather than having that information.&lt;/li&gt;
&lt;li&gt;No control over the data, you may be receiving garbage, but you don’t have any filters so bad data gets loaded either way. Data filters are pushed out to the application layer.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4kda22qt9ui4a2bugvr.jpg" width="504" height="378"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Dynamic Schema
&lt;/h3&gt;

&lt;p&gt;What many claim as the best of both worlds, a dynamic schema is one that changes as you add data. There is no need to define the schema beforehand. When data is inserted, updated, or removed, the database builds a schema dynamically. Popular dynamic schema databases include HarperDB and MongoDB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy to set up, requires no input from the user.&lt;/li&gt;
&lt;li&gt;Provides the structure that comes with a schema, which equals a more efficient storage and indexing model. &lt;/li&gt;
&lt;li&gt;Doesn’t force data constraints, can ingest unstructured data.&lt;/li&gt;
&lt;li&gt;Flexible to develop with as the data model can easily evolve over time.&lt;/li&gt;
&lt;li&gt;Can handle semistructured data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No data enforcement means developers must ensure data adheres to the data model.&lt;/li&gt;
&lt;li&gt;Data model can get messy if proper processes are not followed
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxmgwzjvk9mvj1bas6teh.png" width="284" height="293"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As you can see, there are valid points on each side of the argument and numerous factors to considering when choosing which is right for your specific project. At the end of the day, this decision has a lot to do with the preference of the user and long term project goals. For example, at HarperDB, we are big fans of the &lt;a href="https://harperdb.io/blog/dynamic-schema-the-harperdb-way/" rel="noopener noreferrer"&gt;dynamic schema&lt;/a&gt;, which enables us to ingest any type of data at scale. HarperDB frees you from the hassle of defining data types, providing unlimited flexibility as your applications evolve and scale over time. Which type of schema do you prefer?&lt;/p&gt;

&lt;p&gt;While it may not be top of mind, it’s important to get your schema right upfront to avoid unnecessary headaches and additional time and costs later on. Foundation is key, and it’s much more difficult to go back and change that foundation once you’ve actually built on top of it. Take the time to weigh the pros and cons of strict schema enforcement vs. schemaless vs. dynamic schema before you start building, you won’t regret it.  &lt;/p&gt;

</description>
      <category>database</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>schema</category>
    </item>
    <item>
      <title>How we Build and Deploy our Serverless HarperDB Studio Backend Application</title>
      <dc:creator>DavidCockerill</dc:creator>
      <pubDate>Tue, 22 Sep 2020 16:00:49 +0000</pubDate>
      <link>https://forem.com/harperfast/how-we-build-and-deploy-our-serverless-harperdb-studio-backend-application-52cg</link>
      <guid>https://forem.com/harperfast/how-we-build-and-deploy-our-serverless-harperdb-studio-backend-application-52cg</guid>
      <description>&lt;p&gt;The HarperDB Management Studio is a graphical user interface that enables users to install, design, cluster, and manage databases without having to write a line of code. The Studio’s backend is a serverless application that utilizes &lt;a href="https://aws.amazon.com/lambda/" rel="noopener noreferrer"&gt;AWS Lambda&lt;/a&gt; and &lt;a href="https://aws.amazon.com/api-gateway/" rel="noopener noreferrer"&gt;Amazon API Gateway&lt;/a&gt;. To build, test, debug and deploy this application we use the &lt;a href="https://aws.amazon.com/serverless/sam/" rel="noopener noreferrer"&gt;AWS Serverless Application Model (SAM)&lt;/a&gt;, not to be confused with the ace HarperDB engineer named &lt;a href="https://dev.to/samj"&gt;Sam&lt;/a&gt;! &lt;/p&gt;

&lt;p&gt;SAM is an open-source framework that is used to build serverless applications on AWS. It is an extension of &lt;a href="https://aws.amazon.com/cloudformation/" rel="noopener noreferrer"&gt;AWS CloudFormation&lt;/a&gt;. With just a few lines per resource, you can define the application you want and model it using &lt;a href="https://yaml.org/" rel="noopener noreferrer"&gt;YAML&lt;/a&gt; (a human-readable data-serialization language). During deployment, SAM transforms and expands the SAM syntax into AWS CloudFormation syntax and provisions all the AWS resources we need for the HarperDB Studio.&lt;/p&gt;

&lt;p&gt;We decided to go serverless to shift more of our operational responsibilities to AWS. It allows for quick development, seamless scalability and reduced overhead. Our shift to serverless became a lot easier with SAM. SAM offers a single deployment configuration which makes it easy to organize related components and resources, and operate on a single stack. Our application has 30+ Lambdas, all integrated with API Gateway, along with multiple Lambda layers, Step Functions and SNS topics. We can build and deploy our complete application in around ten minutes overall. &lt;/p&gt;

&lt;p&gt;The SAM CLI is an essential tool when working with SAM, it provides an easy way to test and debug your application locally. We use the CLI in conjunction with the AWS toolkit for JetBrains WebStorm, the IDE we predominantly use. It provides a Lambda-like execution environment locally, which helps us test the functions before we deploy them. It also allows us to step through and debug our code to understand what the code is doing, as you would with any other type of project.&lt;/p&gt;

&lt;p&gt;I’ll run through a few points that we used to get our SAM project setup with our environment (not all of the following steps are essential).&lt;/p&gt;

&lt;h3&gt;
  
  
  Install Requirements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Install and setup the SAM CLI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Docker for local testing &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/get-docker/" rel="noopener noreferrer"&gt;https://docs.docker.com/get-docker/&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pull the lambci lambda image for Docker&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://hub.docker.com/r/lambci/lambda/" rel="noopener noreferrer"&gt;https://hub.docker.com/r/lambci/lambda/&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install and setup the WebStorm AWS toolkit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/key-tasks.html#key-tasks-install" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/key-tasks.html#key-tasks-install&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the AWS CloudFormation plugin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://plugins.jetbrains.com/plugin/7371-aws-cloudformation" rel="noopener noreferrer"&gt;https://plugins.jetbrains.com/plugin/7371-aws-cloudformation&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install a YAML parser, I’m using this one&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://plugins.jetbrains.com/plugin/7792-yaml-ansible-support" rel="noopener noreferrer"&gt;https://plugins.jetbrains.com/plugin/7792-yaml-ansible-support&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you haven’t already, download and run the the sample application&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-hello-world.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-hello-world.html&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Local Testing With WebStorm
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Edit the Run/Debug Configurations and click on the Templates tab. With the AWS toolkit install you should see an AWS Lambda template tab. Click on that and then select Local.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the template make sure it is pointing to your YAML file, by default it is called template.yaml.  To the right of the template path, select the Function Name you are testing. If the function name doesn’t come up something is likely wrong with your template. Sometimes I need to save this setup, close and reopen for it to appear in the dropdown. The input is what is passed to the Lambda when it is invoked, you must have a value here. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frga9wkxg84zu1ng6wful.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frga9wkxg84zu1ng6wful.png" width="697" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If everything has been setup correctly (which it often isn’t, this process can be convoluted) you should be able to run your Lambda as you would any other project in WebStorm. Have it selected in the Run/Debug Configuration and press run or debug.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Deploying the Application
&lt;/h3&gt;

&lt;p&gt;While there are multiple ways to build and deploy the application, this is how we do it at HarperDB. Find out more here - &lt;a href="https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-command-reference.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-command-reference.html&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build the application
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;sam build&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Package the application. It creates a ZIP file of your code and dependencies, and uploads it to Amazon S3.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sam package --s3-bucket my-s3-bucket --output-template-file packaged.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Deploy the application. I suggest adding option -g for guided the first time your deploy your new application.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sam deploy --template-file packaged.yaml --region us-east-2&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Working with SAM can be a little confusing initially, it took me a while to get my head around adding resources to the template file (I found this &lt;a href="https://github.com/aws/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction" rel="noopener noreferrer"&gt;document&lt;/a&gt; helpful). However if you stick at it I’m sure you’ll find great value. If you're curious to learn more about other aspects of HarperDB, feel free to check out our &lt;a href="https://harperdb.io/blog/building-a-database-written-in-nodejs/" rel="noopener noreferrer"&gt;architectural overview&lt;/a&gt;, learn more about the &lt;a href="https://harperdb.io/product/" rel="noopener noreferrer"&gt;product&lt;/a&gt;, or &lt;a href="https://harperdb.io/developers/get-started/" rel="noopener noreferrer"&gt;spin up a free instance&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>showdev</category>
      <category>aws</category>
      <category>database</category>
    </item>
  </channel>
</rss>
