NATS messaging for microservices
Use NATS for messaging in distributed systems and microservices. Performance depends on network, deployment location, resources, and workload.
NATS features and deployment options
NATS provides messaging features in a container-based deployment. Configure resources and network access for your workload.
NATS messaging patterns and performance
NATS is designed for lightweight messaging, including real-time workloads. Throughput and latency depend on deployment, network, and workload.
Go implementation and resource use
NATS is written in Go. Resource use depends on configuration, message volume, and workload.
Pub/Sub and Request-Reply communication patterns
NATS supports publish-subscribe and request-reply patterns; queue groups are available for distributing messages among subscribers.
JetStream persistence (requires configuration)
NATS JetStream can provide stream and key-value storage when enabled and configured with suitable persistent storage.
Container-based messaging service
NATS can run in a container. Clustering, horizontal scaling, and recovery require supporting configuration and infrastructure.
Authentication and transport security
NATS supports authentication and TLS-related options. Available security settings depend on the server configuration.
Frequently asked questions about NATS
Answers to common questions about NATS deployment, messaging patterns, and optional JetStream configuration:
NATS: messaging for distributed systems
NATS is an open-source messaging system used in distributed applications. It supports several communication patterns; performance, availability, and persistence depend on the deployment and configuration.
NATS compared with Kafka and RabbitMQ
Messaging systems have different resource, routing, persistence, and maintenance requirements. Compare them based on the features and workload your application needs.
| Comparison criteria | NATS template on Deplomo Cloud | Apache Kafka (Kafka) | RabbitMQ |
|---|---|---|---|
| Resource use | Depends on server configuration and workload | Depends on server configuration and workload | Depends on server configuration and workload |
| Message latency | Depends on network, workload, and configuration | Depends on network, workload, and configuration | Depends on network, workload, and configuration |
| Setup and deployment | Container deployment; availability depends on service status | Setup requirements depend on the chosen Kafka deployment | Setup requirements depend on the chosen RabbitMQ deployment |
| Messaging and storage features | The template supports NATS messaging; optional features require configuration | Kafka supports retained event logs, depending on configuration | RabbitMQ uses exchanges and routing keys |
| Operations and maintenance | Requirements depend on configuration and operational needs | Requirements depend on configuration and operational needs | Requirements depend on configuration and operational needs |
NATS deployment and connection
The NATS template runs in a container deployed through the Cloud containers service. The current template exposes port 4222 on the private network only; connect from a permitted service and review its settings.
Connecting NATS with Go microservices
The NATS server and official Go client are both written in Go. Applications in Go can use the client library to connect to NATS from Go hosting over the configured private network. Connectivity and performance depend on network and service configuration.
Choosing between NATS and event-streaming platforms
For event history or stream-processing workloads, platforms such as Apache Kafka support event streaming and retention features depending on configuration. NATS and Kafka have different delivery and storage models; choose based on your requirements.
NATS JetStream and message persistence
NATS JetStream can add message persistence, deduplication, and key-value storage when enabled and configured with suitable storage. The current Deplomo Cloud NATS template does not enable JetStream or attach a persistent volume.
Free trial setup and testing at Deplomo
Evaluate NATS throughput and latency with a workload representative of your application. International service creation is paused and no trial credit is granted; review approved package limits before planning benchmarks.
Plan a NATS deployment
NATS resources count toward your selected monthly package. The current template does not enable JetStream or persistent storage; international service creation is paused.