How does end-to-end encryption work?
End-to-end encryption (E2EE) protects your messages and files from being accessed and manipulated by other people other than those you send them to.
๐๐ผ๐ ๐ถ๐ ๐๐ผ๐ฟ๐ธ๐:
๐ญ) ๐๐ฒ๐๐ ๐ด๐ฒ๐ป๐ฒ๐ฟ๐ฎ๐๐ฒ๐ฑ
In each app, every account has two keys: one is public and can be shared with anyone; the other should be kept secret.ย Although these keys are mathematically related, it's impossible to determine someone's private key from their public key.
๐ฎ) ๐ฃ๐๐ฏ๐น๐ถ๐ฐ ๐ธ๐ฒ๐ ๐ฒ๐ ๐ฐ๐ต๐ฎ๐ป๐ด๐ฒ
When two people begin a conversation, they exchange their public keys.ย Since public keys don't have to be kept secret, this can occur through any type of communication channel.
๐ฏ) ๐๐ป๐ฐ๐ฟ๐๐ฝ๐๐ถ๐ผ๐ป
When a user wants to send a message, it is protected using symmetric and asymmetric encryption. In asymmetric encryption, the public key is used for encryption, and the private key for decryption. Whereas symmetric encryption uses a single session key for both. In E2EE, the sender generates a unique session key and encrypts the data with it. Then, they encrypt the session key itself with the recipient's public key.
๐ฐ) ๐๐ฎ๐๐ฎ ๐๐ฟ๐ฎ๐ป๐๐บ๐ถ๐๐๐ถ๐ผ๐ป
The encrypted message and session key are then sent over the internet. The encryption makes sure that only the sender and receiver can read the data, even if someone intercepts it during transmission.
๐ฑ) ๐๐ฒ๐ฐ๐ฟ๐๐ฝ๐๐ถ๐ผ๐ป
When an encrypted message is received, the receiver uses their private key to unlock the session key; which they then use to decrypt the message.
End-to-end encryption is only as powerful as the cryptographic algorithms used, and how well they are implemented. When done right, E2EE boosts the security of digital communications, protecting them from eavesdropping and tampering.
๐ฅ๐ฎ๐ฏ๐ฏ๐ถ๐๐ ๐ค vs ๐๐ฎ๐ณ๐ธ๐ฎ vs ๐๐ฐ๐๐ถ๐๐ฒ๐ ๐ค
Let's briefly look at how each of these stands out:
1๏ธโฃ ๐ฅ๐ฎ๐ฏ๐ฏ๐ถ๐๐ ๐ค
โข ๐๐ฎ๐ป๐ด๐๐ฎ๐ด๐ฒ: Built on Erlang
โข ๐ฃ๐ฟ๐ผ๐๐ผ๐ฐ๐ผ๐น๐: Supports a multitude of protocols, including AMQP, MQTT, and STOMP.
โข ๐๐ฎ๐๐ฒ ๐ผ๐ณ ๐จ๐๐ฒ: Known for being developer-friendly.
โข ๐จ๐๐ฒ-๐ฐ๐ฎ๐๐ฒ: Excellent for complex routing to multiple consumers.
2๏ธโฃ ๐๐ฎ๐ณ๐ธ๐ฎ
โข ๐๐ฎ๐ป๐ด๐๐ฎ๐ด๐ฒ: Built on Scala and Java
โข ๐ฃ๐ฟ๐ผ๐๐ผ๐ฐ๐ผ๐น๐: Proprietary Kafka Protocol over TCP
โข ๐ฆ๐ฐ๐ฎ๐น๐ฎ๐ฏ๐ถ๐น๐ถ๐๐: Highly scalable with the ability to handle huge volumes of data.
โข ๐จ๐๐ฒ-๐ฐ๐ฎ๐๐ฒ: Perfect for real-time analytics and monitoring, data lakes, aggregating data from different sources.
3๏ธโฃ ๐๐ฐ๐๐ถ๐๐ฒ๐ ๐ค
โข ๐๐ฎ๐ป๐ด๐๐ฎ๐ด๐ฒ: Built on Java
โข ๐ฃ๐ฟ๐ผ๐๐ผ๐ฐ๐ผ๐น๐: Supports various protocols like AMQP, STOMP, MQTT, and more.
โข ๐๐น๐ฒ๐ ๐ถ๐ฏ๐ถ๐น๐ถ๐๐: Provides a lot of features and can be used in multiple configurations.
โข ๐จ๐๐ฒ-๐ฐ๐ฎ๐๐ฒ: Often used in enterprise systems and excels in scenarios that require complex routing and transformations.
Credit: Brij kishore Pandey
SOLID principle is one of the most important design principles in OOP languages like Java, Python, C#, etc.
Sadly, most of the programmers find it super difficult to understand.
Here's the simplest guide to understand SOLID principles:
Parallelism, Concurrency, and AsyncIO in Python - by example
https://t.co/1vUrkMMz6a
Looks at how to speed up CPU-bound and IO-bound operations with multiprocessing, threading, and AsyncIO and when you should use each.
by @amal_ytics#Python
๐๐ฃ๐ ๐๐ฎ๐๐ฒ๐๐ฎ๐ ๐๐ ๐๐ผ๐ฎ๐ฑ ๐๐ฎ๐น๐ฎ๐ป๐ฐ๐ฒ๐ฟ
Regarding a system design, we often need clarification about the roles of a Load Balancer and an API Gateway. Most of our resources are about their implementation rather than real-life use cases.
๐น ๐๐ฃ๐ ๐๐ฎ๐๐ฒ๐๐ฎ๐ sits between a client and a group of backend services. It performs the function of a reverse proxy by accepting all application programming interface (API) calls, aggregating the different services needed to fulfill them, and returning the right outcome. ๐จ๐๐ฒ๐ฟ ๐ฎ๐๐๐ต๐ฒ๐ป๐๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป, ๐ฟ๐ฎ๐๐ฒ ๐น๐ถ๐บ๐ถ๐๐, ๐ฎ๐ป๐ฑ ๐๐๐ฎ๐๐ถ๐๐๐ถ๐ฐ๐ are typical duties that API gateways take care of on behalf of a system of API services. Also, the API gateway can handle faults (circuit breaker) but also do logging and monitoring.
๐น ๐๐ผ๐ฎ๐ฑ ๐๐ฎ๐น๐ฎ๐ป๐ฐ๐ฒ๐ฟ is a service that distributes incoming traffic across many servers or resources. Usually, we have two or more web servers on the backend, and it ๐ฑ๐ถ๐๐๐ฟ๐ถ๐ฏ๐๐๐ฒ๐ ๐ป๐ฒ๐๐๐ผ๐ฟ๐ธ ๐๐ฟ๐ฎ๐ณ๐ณ๐ถ๐ฐ ๐ฏ๐ฒ๐๐๐ฒ๐ฒ๐ป ๐๐ต๐ฒ๐บ. Its primary purpose is to use resources optimally. As a result of an equal task allocation and the system's increased capacity, this can enhance the system's responsiveness and reliability. There are three load balancers at a high level: hardware-based, cloud-based, and software-based.
So, the main thing that differs these two is that an ๐๐ฃ๐ ๐๐ฎ๐๐ฒ๐๐ฎ๐ ๐ถ๐ ๐ณ๐ผ๐ฐ๐๐๐ฒ๐ฑ ๐ผ๐ป ๐ฟ๐ผ๐๐๐ถ๐ป๐ด ๐ฟ๐ฒ๐พ๐๐ฒ๐๐๐ to the appropriate service and it handles requests for APIs, while a ๐๐ผ๐ฎ๐ฑ ๐ฏ๐ฎ๐น๐ฎ๐ป๐ฐ๐ฒ๐ฟ ๐ถ๐ ๐ณ๐ผ๐ฐ๐๐๐ฒ๐ฑ ๐ผ๐ป ๐ฑ๐ถ๐๐๐ฟ๐ถ๐ฏ๐๐๐ถ๐ป๐ด ๐ฟ๐ฒ๐พ๐๐ฒ๐๐๐ ๐ฒ๐๐ฒ๐ป๐น๐ between a group of servers and handles requests that are sent to a single IP address, which works at protocol or socket level (TCP, HTTP).
Some ๐ฒ๐ ๐ฎ๐บ๐ฝ๐น๐ฒ๐ of API Gateways are Amazon API Gateway, Ocelot (.NET-based), Tyk, or Apache APISIX, while Load Balancers are Azure Load Balancer, HAProxy, or Seesaw.
_______
If you like my posts, please follow me, @milan_milanovic, and hit the ๐ on my profile to get a notification for all my new posts.
Grow with me ๐!
#technology #softwareengineering #cloudcomputing #techworldwithmilan #api
๐10 Microservices Patterns ๐
1. ๐ Service Registry: This pattern involves managing the locations of services in a distributed system. It maintains a list of all available services and their locations, which can be queried by other services to find and communicate with them.
2. โก๏ธ Circuit Breaker: This pattern is used to prevent cascading failures in a distributed system. It monitors the availability of a service and, if it detects a failure, it can quickly isolate the problematic service and prevent other services from being affected.
3. ๐ช API Gateway: This pattern provides a single entry point to a microservices-based system. It acts as a reverse proxy and routes incoming requests to the appropriate microservice. It can also perform authentication, rate limiting, and other security-related tasks.
4. ๐ Event Sourcing: This pattern involves capturing all changes to the state of a system as a series of events. These events can be used to reconstruct the current state of the system at any point in time. This pattern is useful for systems with complex business logic that require auditability, traceability, or compliance.
5. ๐ญ Saga: This pattern is used to manage long-running transactions that involve multiple microservices. It ensures that all services involved in a transaction are completed successfully or rolled back in case of failures.
6. ๐ CQRS: This pattern separates the read and writes operations of a system. It uses separate models for reads and writes, which allows for the optimization and scalability of each. This pattern is particularly useful for systems with high read-and-write workloads.
7. ๐พ Database per Service: This pattern involves using a separate database for each microservice. This ensures that each microservice has its own data store, which can be optimized for its specific needs. It also helps to prevent coupling between services.
8. ๐บ Saga Choreography: This pattern is similar to the Saga pattern, but instead of having a central orchestrator, each microservice involved in the transaction communicates directly with other services to coordinate the transaction.
9. ๐ธ๏ธ Service Mesh: This pattern provides a dedicated infrastructure layer for managing communication between microservices. It adds features such as load balancing, service discovery, and security to the network layer, which can be used by any microservice in the system.
10. ๐งณ Sidecar: This pattern involves deploying a separate process alongside a microservice, which handles certain tasks such as service discovery, load balancing, or communication with other services. This allows the microservice to focus on its core functionality, while the sidecar handles cross-cutting concerns.
๐จโ๐ป Join Amigoscode today for premium programming courses -ย https://t.co/Y65dNK5bQ6
ps: credits to the respective owner(s).
#programming #coding #webdevelopment #python #javascript #microservices #java #learntocode #beginnerprogramming #techindustry #opensource #developers
Some thoughts on ๐ฅ๐ฒ๐ฎ๐ฑ๐ถ๐ป๐ด ๐๐ฎ๐๐ฎ from ๐๐ฎ๐ณ๐ธ๐ฎ.
Kafka is an extremely important ๐๐ถ๐๐๐ฟ๐ถ๐ฏ๐๐๐ฒ๐ฑ ๐ ๐ฒ๐๐๐ฎ๐ด๐ถ๐ป๐ด ๐ฆ๐๐๐๐ฒ๐บ to understand, last time we covered Writing Data.
๐ฆ๐ผ๐บ๐ฒ ๐ฟ๐ฒ๐ณ๐ฟ๐ฒ๐๐ต๐ฒ๐ฟ๐:
โก๏ธ Clients writing to Kafka are called ๐ฃ๐ฟ๐ผ๐ฑ๐๐ฐ๐ฒ๐ฟ๐.
โก๏ธ Clients reading the Data are called ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ๐.
โก๏ธ Data is written into ๐ง๐ผ๐ฝ๐ถ๐ฐ๐ that can be compared to tables in Databases.
โก๏ธ Messages sent to ๐ง๐ผ๐ฝ๐ถ๐ฐ๐ are called ๐ฅ๐ฒ๐ฐ๐ผ๐ฟ๐ฑ๐.
โก๏ธ ๐ง๐ผ๐ฝ๐ถ๐ฐ๐ are composed of ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป๐.
โก๏ธ Each ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป is a combination of and behaves as a write ahead log.
โก๏ธ Data is written to the end of the ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป.
โก๏ธ Each ๐ฅ๐ฒ๐ฐ๐ผ๐ฟ๐ฑ has an ๐ข๐ณ๐ณ๐๐ฒ๐ assigned to it which denotes its order in the ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป.
โก๏ธ ๐ข๐ณ๐ณ๐๐ฒ๐๐ start at 0 and increment by 1 sequentially.
๐ฅ๐ฒ๐ฎ๐ฑ๐ถ๐ป๐ด ๐๐ฎ๐๐ฎ:
โก๏ธ Data is read sequentially per partition.
โก๏ธ ๐๐ป๐ถ๐๐ถ๐ฎ๐น ๐ฅ๐ฒ๐ฎ๐ฑ ๐ฃ๐ผ๐๐ถ๐๐ถ๐ผ๐ป can be set either to earliest or latest.
โก๏ธ Earliest position initiates the consumer at offset 0 or the earliest available due to retention rules of the ๐ง๐ผ๐ฝ๐ถ๐ฐ (more about this in later episodes).
โก๏ธ Latest position initiates the consumer at the end of a ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป - no ๐ฅ๐ฒ๐ฐ๐ผ๐ฟ๐ฑ๐ will be read initially and the ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ will wait for new data to be written.
โก๏ธ You could codify your consumers independently, but almost always the preferred way is to use ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ ๐๐ฟ๐ผ๐๐ฝ๐.
๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ ๐๐ฟ๐ผ๐๐ฝ๐:
โก๏ธ ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ ๐๐ฟ๐ผ๐๐ฝ is a logical collection of clients that read a ๐๐ฎ๐ณ๐ธ๐ฎ ๐ง๐ผ๐ฝ๐ถ๐ฐ and share the state.
โก๏ธ Groups of consumers are identified by the ๐ด๐ฟ๐ผ๐๐ฝ_๐ถ๐ฑ parameter.
โก๏ธ ๐ฆ๐๐ฎ๐๐ฒ is defined by the offsets that every ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป ๐ถ๐ป ๐๐ต๐ฒ ๐ง๐ผ๐ฝ๐ถ๐ฐ is being consumed at.
โก๏ธ ๐ฆ๐๐ฎ๐๐ฒ of ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ ๐๐ฟ๐ผ๐๐ฝ๐ is written by the ๐๐ฟ๐ผ๐ธ๐ฒ๐ฟ (more about this in later episodes) to an internal ๐๐ฎ๐ณ๐ธ๐ฎ ๐ง๐ผ๐ฝ๐ถ๐ฐ named __๐ฐ๐ผ๐ป๐๐๐บ๐ฒ๐ฟ_๐ผ๐ณ๐ณ๐๐ฒ๐๐.
โก๏ธ There can be multiple ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ ๐๐ฟ๐ผ๐๐ฝ๐ reading the same ๐๐ฎ๐ณ๐ธ๐ฎ ๐ง๐ผ๐ฝ๐ถ๐ฐ having their own independent ๐ฆ๐๐ฎ๐๐ฒ๐.
โก๏ธ Only one ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ per ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ ๐๐ฟ๐ผ๐๐ฝ can be reading a ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป at a single point in time.
๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ ๐๐ฟ๐ผ๐๐ฝ ๐ง๐ถ๐ฝ๐:
โ๏ธ If you have a prime number of ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป๐ in the ๐ง๐ผ๐ฝ๐ถ๐ฐ - you will always have at least one ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ per ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ ๐๐ฟ๐ผ๐๐ฝ consuming less ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป๐ than others unless number of ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ๐ equals number of ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป๐.
โ If you want an odd number of ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป๐ - set it to a ๐บ๐๐น๐๐ถ๐ฝ๐น๐ฒ ๐ผ๐ณ ๐ฃ๐ฟ๐ถ๐บ๐ฒ ๐ก๐๐บ๐ฏ๐ฒ๐ฟ.
โ๏ธ If you have more ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ๐ in the ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ ๐๐ฟ๐ผ๐๐ฝ then there are ๐ฃ๐ฎ๐ฟ๐๐ถ๐๐ถ๐ผ๐ป๐ in the ๐ง๐ผ๐ฝ๐ถ๐ฐ - some of the ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ๐ will be ๐๐ฑ๐น๐ฒ.
โ Make your ๐ง๐ผ๐ฝ๐ถ๐ฐ๐ large enough or have less ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ๐ per ๐๐ผ๐ป๐๐๐บ๐ฒ๐ฟ ๐๐ฟ๐ผ๐๐ฝ.
--------
Follow me to upskill in #MLOps, #MachineLearning, #DataEngineering, #DataScience and overall #Data space.
Also hit ๐to stay notified about new content.
๐๐ผ๐ปโ๐ ๐ณ๐ผ๐ฟ๐ด๐ฒ๐ ๐๐ผ ๐น๐ถ๐ธ๐ฒ ๐, ๐๐ต๐ฎ๐ฟ๐ฒ ๐ฎ๐ป๐ฑ ๐ฐ๐ผ๐บ๐บ๐ฒ๐ป๐!
Join a growing community of Data Professionals by subscribing to my ๐ก๐ฒ๐๐๐น๐ฒ๐๐๐ฒ๐ฟ.
What are the most common ๐จ๐๐ฒ ๐๐ฎ๐๐ฒ๐ ๐ณ๐ผ๐ฟ ๐๐ฎ๐ณ๐ธ๐ฎ?
We have covered lots of concepts around Kafka already. But what are the most common use cases for The System that you are very likely to run into as a Data Engineer?
๐๐ฒ๐โ๐ ๐๐ฎ๐ธ๐ฒ ๐ฎ ๐ฐ๐น๐ผ๐๐ฒ๐ฟ ๐น๐ผ๐ผ๐ธ:
๐ช๐ฒ๐ฏ๐๐ถ๐๐ฒ ๐๐ฐ๐๐ถ๐๐ถ๐๐ ๐ง๐ฟ๐ฎ๐ฐ๐ธ๐ถ๐ป๐ด.
โก๏ธ The Original use case for Kafka by LinkedIn.
โก๏ธ Events happening in the website like page views, conversions etc. are sent via a Gateway and piped to Kafka Topics.
โก๏ธ These events are forwarded to the downstream Analytical systems or processed in Real Time.
โก๏ธ Kafka is used as an initial buffer as the Data amounts are usually big and Kafka guarantees no message loss due to its replication mechanisms.
๐๐ฎ๐๐ฎ๐ฏ๐ฎ๐๐ฒ ๐ฅ๐ฒ๐ฝ๐น๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป.
โก๏ธ Database Commit log is piped to a Kafka topic.
โก๏ธ The committed messages are executed against a new Database in the same order.
โก๏ธ Database replica is created.
๐๐ผ๐ด/๐ ๐ฒ๐๐ฟ๐ถ๐ฐ๐ ๐๐ด๐ด๐ฟ๐ฒ๐ด๐ฎ๐๐ถ๐ผ๐ป.
โก๏ธ Kafka is used for centralized Log and Metrics collection.
โก๏ธ Daemons like FluentD are deployed in servers or containers together with the Applications to be monitored.
โก๏ธ Applications send their Logs/Metrics to the Daemons.
โก๏ธ The Daemons pipe Logs/Metrics to a Kafka Topic.
โก๏ธ Logs/Metrics are delivered downstream to storages like ElasticSearch or InfluxDB for Log/Metrics discovery respectively.
โก๏ธ This is also how you would track your IoT Fleets.
๐ฆ๐๐ฟ๐ฒ๐ฎ๐บ ๐ฃ๐ฟ๐ผ๐ฐ๐ฒ๐๐๐ถ๐ป๐ด.
โก๏ธ This is usually coupled with ingestion mechanisms already covered.
โก๏ธ Instead of piping Data to a certain storage downstream we mount a Stream Processing Framework on top of Kafka Topics.
โก๏ธ The Data is filtered, enriched and then piped to the downstream systems to be further used according to the use case.
โก๏ธ This is also where one would be running Machine Learning Models embedded into a Stream Processing Application.
๐ ๐ฒ๐๐๐ฎ๐ด๐ถ๐ป๐ด.
โก๏ธ Kafka can be used as a replacement for more traditional messaging brokers like RabbitMQ.
โก๏ธ Kafka has better durability guarantees and is easier to configure for several separate Consumer Groups to consume from the same Topic.
โ๏ธHaving said this - always consider the complexity you are bringing with introduction of a Distributed System. Sometimes it is better to just use traditional frameworks.
--------
Follow me to upskill in #MLOps, #MachineLearning, #DataEngineering, #DataScience and overall #Data space.
Also hit ๐to stay notified about new content.
๐๐ผ๐ปโ๐ ๐ณ๐ผ๐ฟ๐ด๐ฒ๐ ๐๐ผ ๐น๐ถ๐ธ๐ฒ ๐, ๐๐ต๐ฎ๐ฟ๐ฒ ๐ฎ๐ป๐ฑ ๐ฐ๐ผ๐บ๐บ๐ฒ๐ป๐!
Join a growing community of Data Professionals by subscribing to my ๐ก๐ฒ๐๐๐น๐ฒ๐๐๐ฒ๐ฟ.