Fauna, the company behind the Fauna transactional database, recently announced the general availability of event streaming, a push-based stream that sends changes at both the document and collection levels to subscribed clients.
Shashank Golla, senior product marketing manager at Fauna, explains:
Fauna’s event streaming employs an open, push-based streaming method to automatically stream real-time data updates to your clients when there is a change in your database. Unlike polling, in event streaming the subscription from the client side happens once and changes are automatically broadcast to the client whenever the subscribed document or collection is updated.
Fauna supports two types of event streaming: document streaming, where the client subscribes to a document reference, and set streaming, where the client subscribes to a set reference and when one or more documents enter or leave the set an event notification is triggered.
Avoid running a query to fetch a document and then establishing a stream. Multiple events may have modified the document prior to stream startup, which can lead to an inaccurate representation of the document data in your application.
Event streaming databases have become popular in the last few years and the major cloud providers offer different managed options to stream data, including DynamoDB Streams and AWS Kinesis Datastream, Datastream on Google Cloud and Azure Event Hubs. CockroachDB and Astra DB support event-driven architectures using Change Data Capture (CDC). Jeremy Daly, GM of serverless cloud at Serverless Inc, comments in his latest newsletter:
If you are a database provider and you’re not drifting into the world of event-driven architecture, you might as well start looking for something else to do.
To ensure that clients have least privilege access, Golia suggests using ABAC, a Fauna’s extension of the traditional role-based access control:
With ABAC, you can implement least privilege access using streaming and provide real-time changes to only the users who should be receiving the updates.
The following limitations apply to Fauna event streaming: GraphQL subscriptions are currently not supported, a browser can open a maximum of 100 streams and a document stream reports only events for the fields and values within the document’s data field.
Event streaming is charged according to usage and is available in all Fauna pricing plans. Each streamed event counts two read operations and includes 4k bytes read from storage, plus one read operation per additional 4k bytes, per subscriber. One compute operation per subscriber is counted for every second a stream is held open.