Amazon DynamoDB is one of the most versatile and popular services on AWS. In seconds, we can deploy a highly available, dynamically scaling key-document store with global replication, transactions, and more! However, if we modify a list attribute on a document, we need to take extra steps to achieve correctness and concurrency. Below, I’ll describe the problem and offer several solutions.

Are your list updates safe?

Full code if you want to follow along.

Let’s clarify the problem. Suppose we insert the following document, using the JavaScript AWS-SDK and the DynamoDB DocumentClient:

In the DynamoDB console, here’s what the document looks like:


Seven reasons I’m excited about .net in 2019

It’s Portable: .net core and Mono are both battle-tested on Windows, Linux and Mac. Microsoft and .net workloads are obviously well-supported on Azure, but they’re also first-class citizens on AWS.

It’s Fun: Unity has become the standard for game developers, especially for mobile, AR, and VR. Unity abandoned UnityScript in 2017, making C# the primary scripting language.

It’s Fast: even faster than you think. .net Core is faster than Java across the board and up to 3x faster than Go on AWS Lambda.

Great Tools: Visual Studio and VSCode are two of the best IDEs available, and they are both…


A quick, hands-on demo

2018 was the year I won many imaginary arguments about why a serverless WebSocket API Gateway will never work. I was wrong.

Before I atone, let me explain: serverless patterns work best when state is separated from execution logic, but I argued that the two are inseparable in real-time applications, pertaining to connection state. So when the API Gateway team announced WebSocket support at re:Invent, I was eager to learn more.

Let’s refactor a simple real-time app into a serverless real-time app and deploy it to a WebSocket API Gateway.

Hello Hello

We begin with a simple NodeJS client that talks to…


There are two common ways to get live data from a GraphQL server: Subscriptions and Live Queries. A Subscription looks like this:

subscription {
eventX {
selection
}
}

A Live Query looks like this:

@live
query {
selection
}

What’s the difference between Subscriptions and Live Queries? When would you use one vs. the other? Let’s compare Subscriptions and Live Queries in theory and examples.

Similarities

Predictable Response Stream: Yes

Both are request/stream operations where the server responds to a client request with a stream of GraphQL responses, in the shape designated by the client’s request document. …


There are two common ways to get live data from a GraphQL server: Subscriptions and Live Queries. A Subscription looks like this:

subscription {
eventX {
selection
}
}

A Live Query looks like this:

@live
query {
selection
}

What’s the difference between Subscriptions and Live Queries? When would you use one vs. the other? Let’s compare Subscriptions and Live Queries in theory and examples.

Similarities

Predictable Response Stream: Yes

Both are request/stream operations where the server responds to a client request with a stream of GraphQL responses, in the shape designated by the client’s request document. …


Model-View-Controller (MVC) is one of the most widespread and influential patterns in software architecture. Despite rumors of MVC’s death, it remains a useful pattern to understand. In this post, rather than reining in the various definitions of MVC, I will highlight how it evolved into the modern web frameworks we know and love today.

Inception

In 1978, Trygve Reenskaugh and Adele Goldberg coined the name “Model-View-Controller”. Trygve believed MVC and its variants formed a Pattern Language, a shared language for people to talk about problems and their solutions. The concept of a software Pattern Language also influenced the Gang of Four…


Real-time APIs stream data from the server to the client over a persistent connection

Disclaimer: I no longer work at Facebook. These opinions are mine alone.

Last month, I took some time to reflect on what I learned while building real-time APIs at Facebook. One useful technique stands out: build the null API first.

Consider a null endpoint for a new HTTP API that returns Status Code 200 with an empty body. With the null 200 API, the client can:

  • Check network connectivity
  • Measure latency
  • Validate an access token
  • Test the SSL certificate
  • Test intermediate caching layers

The client can also detect and handle various failure cases:

  • Network unavailable (airplane mode)
  • DNS lookup failed


In this blog post, I’ll cover the theory, implementation, and challenges of building GraphQL Subscriptions from scratch.

In case you are unfamiliar with GraphQL, here’s a primer: GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL was open-sourced in 2015, and the subscription operation (added to the spec in 2017) allows you to subscribe to real-time data in GraphQL. GraphQL Subscriptions power a number of features on Facebook, including live comments and streaming reactions on live videos. If you’d like a more thorough overview GraphQL, check out graphql.org. …


When most people talk about GraphQL, they cite advantages in performance, predictable response format, type system, and versioning. All of these are awesome features, but I’d like to highlight another area where GraphQL shines: domain modeling.

Domain models capture concepts and processes for a specific business domain (ex: air travel, social networks, banking). Most business domains have complex rules, nuances, and requirements, even if they may seem simple at first. For example, let’s consider banking: What’s so hard about tracking an account balance and a log of credits and debits? For one, what type of currency does the account contain…

Robert Zhu

@AWS, ex-Facebook, ex-Microsoft

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store