Using the combined power of CLI, Streamlit, and Ollama, Stefan Pietrusky presents an end-to-end workflow that allows us to "talk" to PDF files without using proprietary models. https://t.co/BMWoYBovaL
AWS Glue federated datasets are available in BigQuery, which connects #BigQuery and an external data source at the dataset level. Federated dataset tables are populated from the tables in AWS Glue, and updates are reflected in BigQuery.
Check it out โ https://t.co/CxxiR8TB8V
Scaling Database: When and How to Shard
Database sharding refers to splitting data across multiple database servers and is commonly used for scaling. However, sharding introduces major operational and infrastructure complexity that should be ๐ฎ๐๐ผ๐ถ๐ฑ๐ฒ๐ฑ ๐๐ป๐น๐ฒ๐๐ ๐ฎ๐ฏ๐๐ผ๐น๐๐๐ฒ๐น๐ ๐ป๐ฒ๐ฐ๐ฒ๐๐๐ฎ๐ฟ๐.
๐๐น๐๐ฒ๐ฟ๐ป๐ฎ๐๐ถ๐๐ฒ ๐ฆ๐ฐ๐ฎ๐น๐ถ๐ป๐ด ๐๐ฝ๐ฝ๐ฟ๐ผ๐ฎ๐ฐ๐ต๐ฒ๐
Vertical Scaling: Use more powerful single database servers with more CPUs, memory, storage and I/O bandwidth. Much simpler to manage than sharding.
SQL Optimization: Tune SQL queries and database schema to maximize performance on a single server using proper indexes, efficient SQL, etc.
Caching: Use in-memory caches like Redis to reduce database load by serving common queries from the cache instead of hitting the database every time.
Read Replicas + Load Balancer: Add horizontal read scaleability without full complexity of sharding. Directs reads across replicas.
These optimization approaches should be exhausted before considering sharding.
๐ฆ๐ต๐ฎ๐ฟ๐ฑ๐ถ๐ป๐ด ๐ ๐ฒ๐๐ต๐ผ๐ฑ๐
There are two high-level approaches:
Vertical Sharding: Split database into columnar tables or sections vs rows. For example, having one table for names and another table for emails.
Horizontal Sharding: Split database into row partitions distributed evenly across multiple servers. Methods include range based, directory based, and hash based sharding.
๐ช๐ต๐ฒ๐ป ๐๐ต๐ฎ๐ฟ๐ฑ๐ถ๐ป๐ด, ๐๐๐ฒ ๐๐ต๐ฒ ๐๐ถ๐บ๐ฝ๐น๐ฒ๐๐ ๐ฎ๐ฝ๐ฝ๐ฟ๐ผ๐ฎ๐ฐ๐ต that meets requirements to minimize complexity. Seek to avoid sharding until necessary despite the scaling benefits. The infrastructure and operational overheads often outweigh gains.
โ
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/kNfv0DVDdf
Why is Kafka fast?
There are many design decisions that contributed to Kafkaโs performance. In this post, weโll focus on two. We think these two carried the most weight.
1๏ธ. The first one is Kafkaโs reliance on Sequential I/O.
2๏ธ. The second design choice that gives Kafka its performance advantage is its focus on efficiency: zero copy principle.
The diagram below illustrates how the data is transmitted between producer and consumer, and what zero-copy means.
๐นStep 1.1 - 1.3: Producer writes data to the disk
๐นStep 2: Consumer reads data without zero-copy
2.1: The data is loaded from disk to OS cache
2.2 The data is copied from OS cache to Kafka application
2.3 Kafka application copies the data into the socket buffer
2.4 The data is copied from socket buffer to network card
2.5 The network card sends data out to the consumer
๐นStep 3: Consumer reads data with zero-copy
3.1: The data is loaded from disk to OS cache
3.2 OS cache directly copies the data to the network card via sendfile() command
3.3 The network card sends data out to the consumer
Zero copy is a shortcut to save multiple data copies between the application context and kernel context.
โ
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/FIzCeaWsZV
Why is Redis Fast?
Redis is fast for in-memory data storage. Its speed has made it popular for caching, session storage, and real-time analytics. But what gives Redis its blazing speed? Let's explore:
RAM-Based Storage
At its core, Redis primarily uses main memory for storing data. Accessing data from RAM is orders of magnitude faster than from disk. This is a major reason for Redis's speed.
However, RAM is volatile. To persist data, Redis supports disk snapshots and append-only file logging. This combines RAM's performance with disk's permanence.
There is a tradeoff though - recovery from disk is slow. If a Redis instance fails, restarting from disk can be slow compared to failing over to a replica instance fully in memory. So while Redis offers durability via disk, it comes at the cost of slower recovery.
A better solution is Redis replication. With a synchronized replica kept in memory, failover is instant with no rehydration. This maintains speed and near-instant recovery.
IO Multiplexing & Single-threaded Read/Write
Redis uses an event-driven, single-threaded model for its core operations. A main event loop handles all client requests and data operations sequentially. This single-threaded execution avoids context switching and synchronization overhead typical of multi-threaded systems.
Redis uses non-blocking I/O to handle multiple connections asynchronously. This allows it to support many client connections with very low overhead,
Redis does leverage threading in certain areas:
- Background tasks like taking snapshots.
- I/O threads are used for certain operations.
- Modules can use threads.
- Since Redis 6.0, it supports multi-threaded I/O for network communication, improving performance on multi-core systems.
Redis also uses pipelining for high throughput. Clients pipeline commands without waiting for each response. This allows more efficient network round trips, boosting overall performance.
Efficient Data Structures
Redis supports various optimized data structures, from linked lists, zip lists, and skip lists to sets, hashes, and sorted sets, among others. Each is carefully designed for specific use cases for quick and efficient data access.
Over to you: With Redis now supporting some multi-threading, how should we configure it to fully utilize all the CPU cores of modern hardware when deploying in production?
โ
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/kNfv0DVDdf
Harvard University is offering Statistics Course for FREE!
Statistics 110: Probability is one of the best probability courses on the internet and it's FREE.
Course link ๐งต๐
๐ช๐ต๐ถ๐ฐ๐ต ๐ฐ๐น๐ผ๐๐ฑ ๐ฝ๐ฟ๐ผ๐๐ถ๐ฑ๐ฒ๐ฟ ๐๐ต๐ผ๐๐น๐ฑ ๐ฏ๐ฒ ๐๐๐ฒ๐ฑ ๐๐ต๐ฒ๐ป ๐ฏ๐๐ถ๐น๐ฑ๐ถ๐ป๐ด ๐ฎ ๐ฏ๐ถ๐ด ๐ฑ๐ฎ๐๐ฎ ๐๐ผ๐น๐๐๐ถ๐ผ๐ป?
The diagram below illustrates the detailed comparison of AWS, Google Cloud, and Microsoft Azure, created byย Satish Chandra Gupta.
They all use similar parts of solutions:
1. ๐๐ฎ๐๐ฎ ๐ถ๐ป๐ด๐ฒ๐๐๐ถ๐ผ๐ป of structured or unstructured data.
2. ๐ฅ๐ฎ๐ ๐ฑ๐ฎ๐๐ฎ ๐๐๐ผ๐ฟ๐ฎ๐ด๐ฒ.
3. ๐๐ฎ๐๐ฎ ๐ฝ๐ฟ๐ผ๐ฐ๐ฒ๐๐๐ถ๐ป๐ด, including filtering, transformation, normalization, etc.
4. ๐๐ฎ๐๐ฎ ๐๐ฎ๐ฟ๐ฒ๐ต๐ผ๐๐๐ฒ, including key-value storage, relational database, OLAP database, etc.
5. ๐ฃ๐ฟ๐ฒ๐๐ฒ๐ป๐๐ฎ๐๐ถ๐ผ๐ป ๐น๐ฎ๐๐ฒ๐ฟ, with dashboards and real-time notifications.
Hyperscalers use different names for the same service type, e.g., AWS "lambda" is Azure "function."
Which services did you use, and for what kind of solutions? What are your experiences with these three providers?
The full text is in the comments.
--
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.
Learn something new every day ๐!
#aws #technology #cloudomputing #data #softwareengineering