Databricks Advances Spark Structured Streaming With Project Lightspeed ..and RocksDB Stutters
By Adi Gelvan , CEO @ Speedb
Databricks Takes Pole Position in AI
The recent Databricks acquisition of MosaicML had a lot of people scratching their heads.
Is Databricks an AI company?
As Databricks moves old fashioned data warehousing into the AI age with its Lakehouse offering, recent reports from CEO Ali Ghodsi validate Databricks is currently the fastest growing software company, reaching a staggering $1 Billion in revenue for 2022, with a 60% growth rate.??
The MosaicML acquisition for $1.3 billion was a bold move, signaling leadership in real-world AI innovation from Databricks
Databricks is quickly transforming itself into the unified shared data platform for AI, governance, and analytics by creating an open and strategic approach to managing and extracting value from the unbounded amounts of data being generated by the world today.
Recent AI workloads are emerging; LLM training, inference and generative AI are now amplifying the challenges organizations face with data management, pushing bottlenecks throughout the systems, sniffing out weaknesses and forcing new comprehensive solutions, like the kind that Databricks are delivering.?
One thing we love about Databricks is their openness on current and future strategies, documented by their own engineers in the form of their engineering blogs.?
A recent blog that caught our attention is Databricks Project Lightspeed Update - Advancing Apache Spark Structured Streaming
Recognizing the importance of Apache Spark Structured Streaming, Databricks engineers have been working on RocksDB, the state storage engine for Spark Streaming and its components to improve performance for ultimate use in Databricks Lakehouse.?
This insightful Databricks blog summarizes their great work on Project Lightspeed in the last year. Calling out several RocksDB challenges in relation to using RocksDB as state store provider, the blog outlines how these issues were improved within the constraints of RocksDB.
Before we review Databricks engineering efforts to improve RocksDB for Spark Streaming, let's take a look at the default performance advantages Speedb provides out of the (software) box:
(The following section is quoted directly from this Databricks Engineering Blog)
Summary RocksDB Challenges and Solutions
"Unpredictable and Inconsistent (RocksDB) Performance"
In the existing model, when Structured Streaming pipelines used RocksDB state store provider, we used to observe higher and variable latency.?
"During a detailed investigation, we identified that commit operations related to the state store contributed to 50-80% of task duration and also accounted for the high, variable latency."
Here are some of the issues that we have seen:
Towards Faster and Consistent Performance
"To address the issues discussed above, we have made a number of improvements to achieve faster and consistent performance."
Why Use RocksDB?
RocksDB started life as LevelDB, created by Google to run indexing and various forms of caching used by Google Chrome. Then Facebook’s team forked LevelDB and released it as open source in 2012 as RockDB, with some dramatic improvements, like multi-threading and API support. It was designed to be embedded, meaning it’s a library running inside of, or called by another application. This keeps the memory and related disk operations physically close to each other (by eliminating any networks for memory-to-disk processing) as well as requiring the least amount of system (server/resource) overhead.?
RocksDB is the most prevalent embedded storage engine library in use today for modern unstructured databases and hyperscale applications, having wide adoption across the entire hyperscaler landscape. Used by Twitter, Dropbox, Netflix, Google, Facebook, Pinterest, Microsoft (for Bing) and thousands of others, RocksDB is built into many of the world’s largest online services and is the storage engine for storing state in event streaming infrastructure like Kafka Streams and Apache Flink, and often in Spark Streaming, referenced here by Databricks.?
RocksDB is known for being FAST, but finicky, with over 300 variables that all affect each other, taking valuable engineering time and resource to get it optimized.
RocksDB uses a log structured database engine, written entirely in C++, for maximum performance. Keys and values are just arbitrarily-sized byte streams. Aggregating bytes in server memory, RocksDB transforms data into block formats that match physical SSDs block sizes and writes these arbitrary bytes sequentially to help speed large ingest, (aka - disk writes).
领英推荐
By being able to manipulate the format of the data in memory before writing to disk, a high level of efficiency for writes can be achieved with RocksDB, when compared to most other existing storage engines and databases which reorganize B-Trees (and its many forms) upon each write, naturally optimizing for reading back later.?
Why not use RocksDB?
The talented RocksDB team at Meta has produced (and is still producing) amazing work improving the RocksDB storage engine to make Meta internal use-cases faster and more efficient within their infrastructure, deployed on hundreds of thousands of distributed servers, used by hundreds of internal applications. RocksDB is well tuned for their use-cases, but not necessarily for everything (and everyone) else, even though RocksDB is commonly deployed for many varying use-cases, and works well-enough for most cases.
Challenges with RocksDB?(for the rest of us)
While RocksDB engineering teams at hyperscalers and vendors like Databricks leverage their expertise to typically ‘tweak’, and in some cases, modify RocksDB, it’s not an easy job and takes time.?It also has limited potential unless significant engineering resource is applied to rearchitect various components manually and with great effort.
Enter Speedb - Hold My Beer..!?
Speedb was founded by veteran data structure developers who were confronted by various real-world RocksDB scaling issues and decided to re-design key parts of RocksDB to deliver a more performant, scalable, and resource efficient implementation, allowing RocksDB to scale from 50GB to multiple TBs per node (scale-up) and a cascade of other positive outcomes for larger per node data sizes.
When designing Speedb, the engineers wanted to maintain two ground rules:?
By using Speedb, you get RocksDB, but with all of Speedb’s innovations and improvements, making RocksDB more performant, efficient and simple to use at scale. And no downsides.?
Speedb’s core innovation is its new Multi-Dimensional Adaptive Compaction data structure, which adds more dimensions in the LSM-Tree, enabling micro-compactions to reduce WAF, increase performance and allow for TB scale per node.
In addition Speedb adds an adaptive component to the compaction, which optimizes the new LSM data structure for the particular IO workload, adjusting in seconds to keep the read/write flow optimized for best performance.
A key outcome of Speedb's Multi-Dimensional Adaptive Compaction is consistently reducing WAF (write amplification factor) by 85%, meaning you’ll need a lot less disk space to operate, improve performance and avoid thrashing and rewrites on your SSDs, extending their lifespan significantly.
Speedb is showing advantages in large-scale, real-world event streaming cases like XM Cyber, where 10x output was archived on Apache Flink (Streaming), and critical persistent state restore times reduced by 80% with Kafka Streams.
Speedb is being rapidly adopted by the industry as the natural starting point for large scale key-value store requirements, and especially by engineering teams who would rather reap developed benefits rather than trying to re-invent the key-value wheel.
Here you can find Speedb’s other innovations, captured in the OSS version on Github and in the Enterprise binary:?
We at Speedb applaud Databricks engineering effort to improve and stabilize RocksDB for their customer's benefit. By leveraging Speedb as an API compatible alternative to RocksDB, the chances of order-of-magnitude improvements can still be achieved.
We're standing by to help any and all RocksDB focused engineering teams who want a head-start in their key-value store engineering and tuning efforts.
Join our RocksDB/Speedb Discord Server: https://discord.gg/5fVUUtM2cG
Or Contact us for a cooperative effort to improve your strategic RocksDB needs: [email protected]