Understanding Cloud Native Architecture and Data Frameworks
Written on
Evolution of Servers
Bare-Metal Servers
Each server available for lease is a unique piece of hardware that operates independently; essentially, every physical unit serves as a standalone server.
Virtual Machine (VM)
Virtualization enables the use of a single physical server to host multiple operating systems and workloads by deploying a hypervisor. This hypervisor allows several virtual machines to operate concurrently, each with its own allocated CPU, memory, and storage on the physical hardware. The hypervisor effectively manages and separates the physical resources to ensure that each VM can function independently.
Container
A container is a compact unit of software that encapsulates application code along with all its dependencies to ensure quick and reliable execution, independent of the environment. This lightweight, self-sufficient software package enables consistent deployment across various platforms, whether on a private data center, public cloud, or personal computer. Containers share the underlying physical hardware and operating system but operate in isolated environments, allowing for either single or multiple services to be hosted.
High-level Comparison between VM and Container
Various Cloud Services
SaaS (Software as a Service): - Office 365 (Microsoft), Google Workspace (GCP), Salesforce (AWS), Oracle Cloud Applications (OCI)
IaaS (Infrastructure as a Service): - Amazon EC2 (AWS), Azure Virtual Machines (Azure), Google Compute Engine (GCP), Oracle Compute Cloud Service (OCI)
DaaS (Data as a Service): - Amazon Redshift (AWS), Azure SQL Database (Azure), Google BigQuery (GCP), Oracle Autonomous Data Warehouse (OCI)
CaaS (Containers as a Service): - Amazon Elastic Kubernetes Service (EKS) (AWS), Azure Kubernetes Service (AKS) (Azure), Google Kubernetes Engine (GKE) (GCP), Oracle Container Engine for Kubernetes (OKE) (OCI)
PaaS (Platform as a Service): - AWS Elastic Beanstalk (AWS), Azure App Service (Azure), Google App Engine (GCP), Oracle Cloud Platform (OCI)
FaaS (Function as a Service): - AWS Lambda (AWS), Azure Functions (Azure), Google Cloud Functions (GCP), Oracle Functions (OCI)
Other Services: - AWS: Amazon S3, Amazon RDS, Amazon DynamoDB, Amazon SQS, Amazon Kinesis, Amazon ECS - Azure: Azure Blob Storage, Azure SQL Database, Azure Cosmos DB, Azure Service Bus, Azure Event Hubs, Azure Container Instances - GCP: Cloud Storage, Cloud SQL, Firestore, Cloud Pub/Sub, Cloud Dataflow, Cloud Run - OCI: Object Storage, Autonomous Database, Streaming, Oracle Messaging Service, Oracle Data Flow, Oracle Container Engine for Kubernetes.
Microservices Architecture and Design
Microservices architecture involves developing a business application as a collection of domain services, each operating within its container and communicating through lightweight methods, either synchronously or asynchronously. These services are tailored around specific business capabilities and can be independently deployed using automated tools, promoting a decentralized approach while adhering to polylithic and polyglot principles.
Characteristics of Microservices
Organized Around Business Capabilities
Autonomous
Microservices function as independent units of functionality, with loosely coupled dependencies. They exist as distinct entities within isolated container environments, communicating through network calls using HTTP, GRPC, and messaging protocols.
Smart Endpoints and Dumb Pipes
This approach involves creating intelligent endpoints within the microservices logic, while relying on basic HTTP or message queues for communication. However, managing the code and collaboration across decentralized teams can be challenging.
An alternative approach involves the use of smart pipes, which is considered an anti-pattern in microservices design. Instead, a more effective method is to externalize communication mechanisms to a sidecar proxy, allowing microservices to focus on business logic while the proxy handles network-level communication.
Further extending this idea, a service mesh can facilitate communication across services using sidecar proxies, enhancing overall management and organization.
Sidecar
The sidecar pattern separates technical configuration from functional implementation, deploying them together in containers. This allows for third-party configurations to be added without altering the microservice itself.
What Is a Service Mesh?
Service meshes provide intent-based networking for microservices, outlining the desired behavior of the network topology. They employ sidecar proxies to enable secure, efficient service-to-service communications.
What Is an Event Mesh?
Event meshes manage the asynchronous routing of information between microservices, intelligently directing events between brokers to create a virtual event broker environment.
How to Build Resilient Microservices?
Circuit Breaker Pattern
The circuit breaker concept involves wrapping potentially failing function calls within a circuit breaker object that monitors failures. Once a certain failure threshold is crossed, the circuit breaker interrupts further calls.
- Closed: The operation continues normally, tracking recent failures. If failures exceed a specified threshold, the circuit breaker enters an open state.
- Open: Any requests from the application fail immediately, returning an exception.
Bulkhead Pattern
The bulkhead pattern derives its name from maritime design, where partitions prevent damage from affecting the entire vessel. In a microservices context, this means partitioning services to avoid cascading failures when one service becomes overloaded.
Stateless Services
Designing resilient microservices involves utilizing stateless services that do not retain data. This enables quick scaling and load balancing based on current demand.
Retry
Incorporating retry mechanisms can help recover from transient failures, allowing for a few attempts to receive a response.
Fail Fast
It is preferable to receive no response rather than a slow one, prompting the implementation of self-restart mechanisms based on monitoring data.
Timeout
Configuring timeouts for connections and reads helps free up resources, particularly when services or databases are experiencing delays.
Throttling
Rate-limiting incoming requests within a specified timeframe helps manage throughput and resource utilization.
Containerization
Containers serve as standard software units that package code and dependencies, ensuring quick and reliable execution across different environments.
Design for Failure
Recognizing that systems will inevitably fail, microservices must be designed to tolerate failures, detect issues quickly, and implement self-healing mechanisms through real-time monitoring.
Event-Driven Architecture
Event-driven technology facilitates high-speed, asynchronous communication, allowing machines and programs to exchange data via queues or channels. This setup supports robust and reliable event delivery.
Serverless Architecture
Serverless computing offers back-end services on an as-needed basis, eliminating the need for infrastructure management.
- No server management required.
- Flexible scaling based on application needs.
- Automated high availability built into serverless components.
Evolution of Serverless
Key components include API gateways for synchronous service communication, event bridges for asynchronous interactions, and various storage and authentication services.
In conclusion, while serverless computing operates atop virtualized and containerized services, users engage with it without direct interaction with underlying infrastructure. It addresses long-standing issues by removing the need for traditional server management, thereby enabling rapid development of reactive, event-driven systems.
Cloud Native Data Architecture
Objects, Files, and Blocks
Different storage formats—objects, files, and blocks—organize and present data in various ways. Object storage uses metadata and keys for data management, while file storage organizes data hierarchically. Block storage divides data into smaller chunks for flexible usage.
Relational Database
A relational database comprises interconnected data organized into tables, supporting CRUD operations and ensuring ACID properties for data integrity.
Key-Value
Key-value stores represent a nonrelational database format that utilizes unique keys to access stored data, ideal for real-time retrieval.
Document Database
Document-oriented databases store data in JSON format, allowing for flexible schema definitions.
Wide-Column Database
Wide-column databases organize data into rows and columns, offering greater flexibility compared to traditional relational databases.
Time-Series Database
Time-series databases track data points over time, allowing for analysis of trends and changes.
Graph Database
Graph databases manage complex data structures, focusing on relationships between entities, often used in social networks and fraud detection.
Event Store Database
Event stores maintain an immutable stream of events for validation and audit purposes, ensuring that past records cannot be altered.
Search Engine Database
Search engine databases facilitate efficient searching of information across various data sources, optimizing for speed and accuracy.