🚀 Fauna Architectural Overview White Paper: Learn how Fauna's database engine scales with zero ops required
Download free
Fauna logo
Product
Solutions
Pricing
Resources
Company
Log InContact usStart for free
Fauna logo
Pricing
Customers
Log InContact usStart for free
© 0 Fauna, Inc. All Rights Reserved.

Related posts

How Fauna and Cloudflare Make Serverless Development Faster & More ScalableAnnouncing General Availability of Fauna SchemaFauna adds support for Change Data Capture

Start for free

Sign up and claim your forever-free Fauna account
Sign up and get started

Table of Contents

Edge computing

Why Use Fauna with edge computing?

Anish Devasia|Aug 25th, 2022|

Categories:

Edge applicationsFeaturesServerlessTutorial
⚠️ Disclaimer ⚠️

This post refers to a previous version of FQL.

This post refers to a previous version of FQL (v4). For the most current version of the language, visit our FQL documentation.

Cloud infrastructure has enabled a radical shift in how enterprises perform computing. In the centralized cloud computing model, all data travels from individual data sources to cloud computing platforms. This model, however, has in some ways had a negative impact on the end-user experience, exacerbated by the rapid pace of growth in the number of internet users and the amount of data that flows through the internet.
Edge computing can overcome many of these challenges and deliver a superior user experience for your consumers. In this article you will learn more about edge computing and why you need it, as well as how using Fauna can help you optimize your edge architecture.

What is edge computing?

Edge computing is the concept of bringing computing power closer to the data source. This means that the data generated doesn’t need to be routed all the way back to centralized cloud computing infrastructure before it is processed. Edge computing enables developers to build logic at the edge to deliver a fast, secure, and scalable user experience.
Best practices for edge computing

Why do you need edge computing?

For example, say you run a video streaming service with all media and applications running in cloud computing servers in London. If a user accesses your service from Australia, the data from the user and from the server has to travel a long distance to reach the other party. This high latency impedes the user experience.
Similarly, when millions of users are sending requests to your centralized cloud computing infrastructure, the load on your London servers is enormous. The bandwidth and computing resources needed at the London location will be huge and often not feasible, because there is a limit to the number of users that can be served concurrently from a location. Additionally, it’s difficult to dynamically scale infrastructure at a single location.
Due to these constraints, a better solution is a computing model in which processing and data storage are distributed across geographical regions. Edge computing overcomes the many disadvantages of cloud computing.

Benefits of edge computing

Edge computing coupled with cloud infrastructure offers benefits for businesses of all sizes:
  • Faster page loads: Since data and processing is much closer to the user, webpages, applications, and different types of media will load more quickly.
  • Concurrent users: Since end users are served by multiple servers close to them, those servers undergo very little strain. Edge computing supports a large number of concurrent users by distributing content delivery and processing.
  • Efficient computing: Data and processing requirements are decentralized, and infrastructure requirements at the edge are much less than with a centralized cloud model. The smaller infrastructure also makes this a much more energy-efficient model.
  • Better data security: Data in edge computing is transferred over shorter distances than with cloud computing, which reduces the risk of spoofing attacks. Even if one edge is compromised, less information is exposed. That edge can also be easily cut off from the rest of the network.
  • Reliability: The edge model is more reliable than the cloud computing model. Even if one of the edges fails, users can be automatically served from one of the other edges instead.
  • Scalability: You can increase or decrease the number of edges in operation according to the demand. This gives you great flexibility and agility in dynamically scaling your infrastructure.
  • Lower costs: Since data travels shorter distances, the cost of moving data around is lower. The ability to dynamically scale also helps to keep costs in check.
Tip

Ready to start building faster, more performant edge applications?

Since Fauna is distributed dy default, you can reduce latency for your apps with a close-proximity database for your edge nodes. Easily integrate with Cloudlfare workers and Fastly Compute@Edge platforms out of the box.

  1. On-demand webinar: Realize the full potential of your edge architecture with Fauna
  2. Getting started with Fauna and Cloudflare Workers
  3. How to build an edge API gateway with Fastly's Compute@Edge and Fauna

Edge computing with Fauna

The distributed nature of edge computing can make it incredibly beneficial for your organization, but it is also incredibly difficult to model, architect, and implement such an infrastructure at large scale. The challenge is that traditional relational databases and contemporary NoSQL databases are not designed to automatically handle the throughput requirements and distributed nature of edge computing infrastructure without significant configuration, operations and engineering overhead.
A purpose built distributed and serverless database natively supports the distributed nature of edge computing infrastructure. This can be accomplished with a solution like Fauna, a distributed document-relational database. Fauna, which works locally or across region groups, provides a serverless operations model with simplified scalability. The database doesn’t need to be provisioned, sharded, or replicated, and developers can use Fauna to more easily build low-latency applications for distributed infrastructures.
Fauna offers several features that benefit edge computing systems:
  • Database delivered as a secure cloud API
  • Single global endpoint to access data
  • ACID-compliant database
  • Integration with edge computing vendors such as Cloudflare, Fastly, or Azion

Setting Up Fauna

To demonstrate how Fauna can help with edge computing, you’re going to set up a database to track room inventory across all the properties of a global hotel chain.
First, you need to complete the sign-up procedures for Fauna. Once you see the Fauna dashboard, click one of the CREATE DATABASE buttons.
In the slide-out menu, provide a name for the database and choose a region group. This tutorial uses the name hotel-inventory and Europe as the region group:
Creating database from dashboard
Once your fields are populated, click the CREATE button.
In the database, you'll create a Rooms collection to store information on available inventory using Fauna Query Language (FQL) from the Fauna shell, which can be accessed by clicking Shell in the left-hand menu. Rather than being a general purpose programming language, FQL is the native API required to query the Fauna database. You can use the FQL cheat sheet to learn more about FQL functions.
The CreateCollection function is used to initiate the collection Rooms:
CreateCollection({name: "Rooms"})
Running the query yields the following result:
CreateCollection({name: "Rooms"})

{
ref: Collection("Rooms"),
ts: 1657013548760000,
history_days: 30,
name: "Rooms"
}

>> Time elapsed: 56ms
FQL execution
Going line by line:
  • ref is a reference to the collection itself
  • ts is the timestamp of its creation in microseconds
  • history_days determines how long Fauna will retain changes in the collection documents
  • name is the collection’s name
The next step is to create a server key, which can be used to run apps on edge computing platforms such as Cloudflare, Fastly, or Azion. Go to the Security section of the dashboard and create a new key with the Server role:
Creating new key
After clicking Save, you should see your key:
Secret key displayed after creation
With this database and secret key, you can move forward to work on the logic side of the application. Keep the secret key safe so no one else can use it to access the database.

Edge computing success stories

The following three case studies highlight how organizations are benefiting from distributed edge infrastructure.

MeetKai

MeetKai is a conversational intelligence company with an advanced search engine powering next-gen voice assistants. The company serves clients with more than 100 million monthly active users. Serving such a large userbase could become cumbersome, which is why MeetKai uses Fauna as the backend data store to push and pull logs and the personalization information of millions of users. This helps it deliver a mature voice recognition experience with minimal latency.

Climatiq

Climatiq uses a globally distributed API and an open database to calculate carbon emissions in real time so that clients can monitor their sustainability operations. It requires a distributed serverless model for lower emissions and low global latency. It uses the Compute@Edge platform from Fastly, and pairs it up with Fauna as the serverless database, so that responses to requests are delivered from the closest edge node to the user. This helps Climatiq keep emissions low and deliver products quickly. Using Fauna eliminates the time and effort that goes into spinning up and maintaining database infrastructure.

Dhamira

Dhamira is a software consultancy firm with clients in the healthcare and financial technology industries. They use Fauna so that database maintenance is ops-free, allowing them to maintain low DevOps and quickly scale by focusing on applications and customer needs. The flexible permissions model and asset compliance of Fauna are critical features for Dhamira because it reduces the need for middleware infrastructure. The decentralized nature of Fauna also allows Dhamira to move fast and logically with evolving client requirements.

Conclusion

Edge computing offers a fast, scalable solution for organizations dealing with ever-increasing amounts of data. It addresses the major drawbacks of cloud computing by processing data at a computing node closer to the data source. It also reduces the volume of data transmitted to cloud servers over a public network, which reduces an organization’s processing and storage requirements as well as costs.
In order to make the switch to a distributed computing infrastructure, you’ll also need a distributed database like Fauna. A transactional document-database, delivered as a cloud API, saves you the trouble of managing your own database infrastructure. This frees you up to focus on your applications instead. To give Fauna a try, register for a free account.
Anish Devasia is an electrical and electronics engineer who is enthusiastic about technology, heuristic problem solving, and philosophy.

If you enjoyed our blog, and want to work on systems and challenges related to globally distributed systems, and serverless databases, Fauna is hiring

Share this post

‹︁ PreviousNext ›︁

Subscribe to Fauna's newsletter

Get latest blog posts, development tips & tricks, and latest learning material delivered right to your inbox.