Developers often use external services, such as databases, worker queues, and cache or data processing pipelines, to add new dimensions and functionalities to their web apps. As Rust has grown in popularity, naturally, so has its ecosystem of high-quality crates for implementing communication protocols and other external services.
In this guide, we’ll look at some of the best high-performance external services the Rust community has to offer.
lapin
lapin
provides a complete async implementation of the Advanced Message Queuing Protocol (AMQP) used for communication with the RabbitMQ message broker. It’s the base library for creating microservices, worker queues, and interservice communication.
lapin
is the base library for multiple crates with support for Tokio runtime, async-io runtime, and async-std runtime through different wrappers. It has a production-level implementation of the AMQP and support for native SSL and OpenSSL. The lapin
crate also supports different types of authentication, e.g. SSL certificate and username/password authentication.
Production-ready: Yes
Async support: Yes
rdkafka
rdkafka
provides an implementation of Kafka for Rust. It’s fully asynchronous.
The rdkafka
crate is based on the librdkafka C library. It provides a safe and complete interface for the librdkafka library. It supports all versions of Kafka greater than 0.8.
rdkafa
is extremely fast; it can process up to 1 million messages per second, according to the benchmark on rdkafka's
readme. rdkafka
internally uses the rdkafka-sys
crate for FFI in the librdkafka library.
Features of rdkafka
include:
Production-ready: Yes
Async support: Yes
nats
The nats
crate provides support for the NATS messaging system in Rust. It has both sync and async support and works with both Tokio and async-std out of the box. It is written in pure Rust.
nats
is the official client for Rust and is maintained by the nat.io team. It has support for JWT, based, token, Nkeys, and username/password-based authentication.
The main advantage of the nats
crate is its ability to generate iterators.
Features of the nats
crate include:
arrow
and datafusion
arrow
provides data types required for Apache Arrow and datafusion
provides an SQL like a query over the arrow
array and data layout.
Generally speaking, the arrow
crate offers the functionality to develop code that uses Arrow arrays, and datafusion
offers most operations typically found in SQL, with the notable exceptions of join and window functions.
arrow
implements all formats in the specification, except certain dictionaries. It also supports SIMD operations to some of its vertical operations.
datafusion
supports async execution, user-defined functions, aggregates, and whole execution nodes.
Production-ready: Yes
Async support: Yes
tantivy
tantivy
is a building block for full-text search. Tt has support for the tokenization of 17 Latin languages and many other regional languages. tantivy
also supports multithreading and SIMD for fast and efficient indexing and search.
tantivy
has a natural querying language (e.g., “logrocket” and “frontend”) and is extremely fast, according to the benchmark provided by the tantivy
crate.
Notable features:
&[u8]
fast fieldsProduction-ready: Yes
Async support: n/a
elasticsearch
The elasticsearch
crate is an official Elasticsearch client. It supports async using Tokio runtime, as well as both native-tls
and rust-tls
.
elasticsearch
is in alpha version but it has a complete implementation of the Elasticsearch protocol. It supports both credential- and certificate-based authentication.
Production-ready: No
Async support: Yes
redis
redis
is an in-memory database that can be used for creating a cache, worker queues, and creating microservices. Rust has excellent support for the Redis database.
As noted in “11 database drivers and ORMs for Rust that are ready for production,” redis
provides both high- and low-level APIs. All the queries are pipelined, meaning more than one query can be sent simultaneously.
redis
has a full implementation of the Redis communication protocol, but does not yet support pub/sub. The crate uses Tokio as async runtime and supports Lua scripts, auto-reconnect, and connection pool using the r2d2
crate.
pulsar
pulsar
is an async client for Apache Pulsar. It’s written in pure Rust and doesn’t rely on the Pulsar CPP library.
The pulsar
crate supports both Tokio and async-std
runtime out of the box.
Notable features:
pulsar://
and pulsar+ssl://
) connections with DNS lookupasync-std
)Production-ready: Yes
Async support: Yes
Library | Production-ready | Async support | External service |
---|---|---|---|
lapin |
Yes | Yes | Redis, AMQP protocol |
rdkafka |
Yes | Yes | Apache kafka |
nats |
Yes | Yes | NATS.io |
arrow |
Yes | No | Apache Arrow |
datafusion |
Yes | Yes | Apache Arrow (SQL query) |
tantivy |
Yes | Not Applicable | Full Test Search |
elasticsearch |
No | Yes | Elasticsearch |
redis |
Yes | Yes | Redis |
pulsar |
Yes | Yes | Apache Pulsar |
Debugging Rust applications can be difficult, especially when users experience issues that are hard to reproduce. If you’re interested in monitoring and tracking the performance of your Rust apps, automatically surfacing errors, and tracking slow network requests and load time, try LogRocket.
LogRocket is like a DVR for web and mobile apps, recording literally everything that happens on your Rust application. Instead of guessing why problems happen, you can aggregate and report on what state your application was in when an issue occurred. LogRocket also monitors your app’s performance, reporting metrics like client CPU load, client memory usage, and more.
Modernize how you debug your Rust apps — start monitoring for free.
Hey there, want to help make our blog better?
Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.
Sign up nowBackdrop and background have similar meanings, as they both refer to the area behind something. The main difference is that […]
AI tools like IBM API Connect and Postbot can streamline writing and executing API tests and guard against AI hallucinations or other complications.
Explore DOM manipulation patterns in JavaScript, such as choosing the right querySelector, caching elements, improving event handling, and more.
`window.ai` integrates AI capabilities directly into the browser for more sophisticated client-side functionality without relying heavily on server-side processing.