Skip to content

Latest commit

 

History

History
200 lines (156 loc) · 7.35 KB

intro-technologies.md

File metadata and controls

200 lines (156 loc) · 7.35 KB

Technologies

The technologies chosen are cloud-agnostic which makes the solution independent of a specific cloud provider.

  • Integration - Kafka, gRPC, WebSocket, HTTP
  • Data storage - Yugabyte, Cassandra, MinIO, Redis
  • Operations - OpenTelemetry, Docker, Kubernetes
  • Services - .NET, ASP.NET, SignalR, EF Core
  • Libraries - Autofac, Serilog, FluentValidation, AutoMapper, Polly, IdGen
  • Automated testing - NUnit, FluentAssertions, Coverlet

Technologies

Client communication

WebSocket MessagePack HTTP JSON Swagger

  • Clients use WebSocket transport with MessagePack message format to communicate with the Messaging service
  • Clients use HTTP transport with JSON message format to communicate with the BFF service

Service synchronous communication

gRPC Protocol Buffers

Services communicate synchronously with each other via gRPC:

  • open-source software backed by Google
  • supports multiple languages
  • lightweight and has good performance
  • based on HTTP/2 which allows for both inter-operability and optimizations from the protocol

Service asynchronous communication

Kafka Protocol buffers

Services communicate asynchronously via the PUB/SUB backplane which is based on Kafka:

  • open-source software backed by Confluent
  • a linearly scalable message broker
  • enables a superb throughput due to its balanced distribution of partition leadership throughout the cluster
  • fault-tolerant and persists messages with customizable durability
  • can be tuned for either low latency, high-throughput or something in-between
  • allows different consumer groups each of which can process messages independently of each other
  • has a pull model which allows consumers to process messages at their own rate
  • a good solution for an event log, especially when processing a single message is fast
  • has some known operability issues with partition redistribution among a consumer group
  • relies on ZooKeeper as an additional element in the infrastructure

User database

Yugabyte Postgres

User database is based on Yugabyte DB

  • distributed SQL database
  • based on Postgres and driver-compatible with it
  • highly-available with built-in data replication and follower reads
  • horizontally scalable
  • supports partitioning (sharding) by hash or range
  • handles distributed transactions in a scalable and resilient way with optimistic concurrency
  • supports traditional SQL indexes and constraints
  • has different multi-region deployment modes
  • supports change data capture (CDC)
  • observable with integration for popular existing technologies

User cache

Redis

User cache is based on Redis:

  • open-source software
  • lightweight and performant
  • easy to use and manage

Chats database

Cassandra

Chats database is based on Cassandra:

  • open-source software backed by DataStax
  • linearly scalable
  • distributed with auto-partitioning and auto-replication
  • supports multi data-center auto-replication
  • suitable for random small fast writes and reads
  • suitable for random range queries
  • suitable for time series
  • eliminates the need of caching
  • allows precise control over the consistency used for writes and reads
  • ensures data consistency via hinted handoffs and read repairs
  • needs regular anti-entropy repairs which are CPU-bound

File storage

Minio

File storage is based on MinIO:

  • object store - stores both file and metadata
  • horizontally scalable
  • supports multi-site replication
  • has global identity and access management
  • supports bucket encryption
  • supports immutability and versioning of objects
  • provides tools for monitoring
  • provides data-management interfaces
  • HTTP-accessible with a native client out of the box
  • AWS S3-compatible

Dynamic configuration

Yugabyte Postgres Kafka gRPC Protocol Buffers

Dynamic configuration is based on multiple technologies:

  • storage is based on Yugabyte DB which is Postgres driver-compatible
  • services are notified for configuration changes via dedicated Kafka topic
  • services acquire configuration both initially and when changed using gRPC
  • both Kafka and gRPC data format is Protocol Buffers

Observability

OpenTelemetry Jaeger ElasticSearch Kibana Prometheus Grafana

  • Distributed tracing is based on OpenTelemetry and Jaeger
  • Log aggregation is based on OpenTelemetry, ElasticSearch and Kibana
  • Metrics is based on OpenTelemetry, Prometheus and Grafana

Deployment

Docker Kubernetes Helm

  • Containerization relies on Docker for its maturity, popularity, tooling and integration
  • Orchestration is based on Kubernetes and Helm for its power, maturity, popularity, tooling
  • infrastructure as code - TBD, probably Terraform

Services

.NET ASP.NET EFCore SignalR

The services are based on .NET, ASP.NET, SignalR and Entity Framework Core:

  • open-source software backed by Microsoft
  • very mature, feature-rich, lots of tools
  • widely-used with a big community
  • well-supported

Autofac Serilog FluentValidation AutoMapper Polly Refit

Additional libraries which are all open-source and created, supported and developed by the community:

  • Autofac is the most popular DI container
  • Serilog is one of the most popular logging frameworks
  • FluentValidation is the most popular data validation library
  • AutoMapper is the most popular mapping library
  • Polly is a popular HTTP client policies library
  • IdGen is used to generate Snowflake IDs
  • Refit is one of the most popular REST clients

NUnit Testcontainers FluentAssertions Coverlet

Automated testing is done using open-source libraries, supported and developed by the community:

  • NUnit is one of the 2 most popular unit testing frameworks
  • Testcontainers is a framework for spinning up Docker containers
  • Fluent Assertions is the most mature assertion framework
  • Coverlet is a powerful code coverage toolset

Tools

Ubuntu Git JetBrainsRider Minikube

  • Ubuntu is an excellent choice for power users doing development
  • Git is a non-negotiable VCS for development at the time of writing
  • JetBrains Rider is the second most used .NET IDE
  • Minikube is one of the most popular Kubernetes local clusters