rockeetterark
We Developed a Rule Database
database are often used to store data and search data by 'conditions', ex: `select * from ... where <conditions>`.on the other side, in many cases we need to store MANY 'conditions' and search the stored conditions by 'data'. such as:* online AD, the Advertisers define many conditions for user profiles, contexts ... * content filtering(forbidden words with very complex boolean...
on the other side, in many cases we need to store MANY 'conditions' and search the stored conditions by 'data'. such as:
* online AD, the Advertisers define many conditions for user profiles, contexts ... * content filtering(forbidden words with very complex boolean expression) * risk control, alert ... conditions * data cleaning, curation... * auto labeling...
Such businesses often use Elastic Search percolator(or its underlying lucene monitor), more recent tantivy percolator(lucene's rust alternative).
Now, we have developed RuleDB for such use case, our enterprise users showing RuleDB is more than 1000x faster than ES(excluding RPC network overhead).
RuleDB has two parts: 1. the compiler and 2. the runtime.
1. The Compiler compiles rule code written by RuleDB DSL into binaries
* AC automata binaries: for normal 'words'
* **Multi** Regex engine: our **extended regex** with regular language algebras(not/and/or/concat/non-greedy-op...), many different extended regex in many rules are compiled into one DFA(the supported regex num is 100x of hyperscan)
* cost based recall optimization: for example in `A and B and C`, the least frequent of A,B,C is selected as the recall term, this is in recursive approach.
* The rule verification VM: AC automata and regex just scan text for atoms, such atoms are combined with boolean expressions, ex: a near/3 quick near/4 "brown fox" and not(lazy near/+2 dog or diligent near/2 wolf).
* The VM code are highly optimized by the compiler
2. The applications use RuleDB API calling the runtime lib * load the compiled binaries(just mmap)
* scan + verify
Advanct features: * numbers: integeral range `{i{3000,5000}}`, real number range `{r{2.71828,3.14159265}}`, -- save and matched as text, no width limit
* composite index: `gender[1] and age[23] and income{i{3000,5000}}` will be compiled into an composite index 'i-gender-age-income'.
* multi dimentions: the typical case geofencing: `longitude{r{116.2418,116.2441}} and latitude {r{39.5424,39.5450}}` -- RuleDB natively support any dimention search
* such numeric expression and text expressions can be mixed: `(america or china) and gender[1] and age[23] and income{i{3000,5000}}`
A complex rule:``` gender{{1}} and age{i{20,28}} and income{i{18000,23000}} and longitude{r{116.2418,116.2441}} and latitude {r{39.5424,39.5450}} and interesting{{movie|food|sport}} and books{{The Red and the Black|The Great Gatsby}} and a near/3 quick near/4 "brown fox" and not(lazy near/+2 dog or diligent near/2 wolf) ```
There are real world single rule with more than 50KB in our enterprise users, a rule source code file with 2MB is fully compiled in 150 milliseconds, a query using a 10KB document to search 70000 rules with 20 matched rules takes just 300us(micro seconds, not milli seconds)!
---- I'am also the author of ToplingDB, I had posted several months ago https://news.ycombinator.com/item?id=44432322
We Developed a Rule Database
With embedded http server, all DB configurations and status are visually displayed, for example: the compaction progress, the SST file list with the compacting files are highlighted -- with different colors for different compaction jobs, different icons for different compaction types(https://github.com/topling/sideplugin-wiki-en/wiki/Compactio...)
Another significant improvement is `select count(*) from SomeTable` in MyTopling, I optimized such query by 30x+ faster than MyRocks, 10x+ faster than InnoDB, while the multi-thread scaling is near linear -- better than InnoDB.
-- prometheus is supported by this this http server.
ToplingDB: A Persistent Key-Value Store for External Storage
The Todis author was also the author of TerarkDB/Terark which was acquired by Bytedance at 2019.
Todis is Cloud Native, users can experiencing Managed Todis based on aliyun in 10 minutes.
The key features of todis are:
1. Computing and Storage are seperated for elastic scaling
2. Auto scaling, no need for sharding/partitioning
3. Elastic Distributed Compaction(feature of ToplingDB which forked from RocksDB)
4. Plenty (grafana) monitoring metrics
5. Web view for DB internal statsTodis: A New Redis server on external storage
We do not have any benchmark against PostgreSQL though. It is not in our plans to adapt our storage engine to PostgreSQL, so we're not comparing it against it, but the gains are just as significative.
I hope that answer your questions, and feel free to reach us at [email protected]
For benchmarks on TerarkDB's performance in particular, you can have a look here: https://github.com/Terark/terarkdb/wiki/Benchmark
But we're open on the question. Our storage engine is also compatible with MongoDB and MySQL, so if we could partner with a large company providing support for MongoDB/MySQL on Terark (think something like Percona, for instance), and that open sourcing all our code was a must, we would consider it.
We do that by using a data structure called Succinct Nested Trie, and we've introduced concepts such as CO-Index (Compressed Ordered Index) and PA-Zip (Point Accessible Zip).
We were at first a compression company, and turned to storage engines and database as a domain of application for our algos, hence the analogy with Pied Piper :)
- We provide several different benchmark results and detailed procedures: https://github.com/Terark/terarkdb/wiki/Benchmark - We provide a free license of TerarkDB and you can download the exact scripts we used and run your own benchmarks with the configuration you want.
We're a bunch of geeks (I think the picture is worth a thousand words ^^) who had a scratch to itch and a lightbulb moment. We built a product around it and we're trying to make a sustainable business. Any feedback or comment is welcome. We understand some people might be skeptical and we're happy to answer any question. And if you like it, we would be thrilled if you could help spread the word. We're not the bests at marketing... haha
We also provide a free license of TerarkDB and you can download the exact scripts we used and run your own benchmarks with the configuration you want. We know the claim may sound outlandish, so we try to be as transparent as possible.
Regarding the license of our products: the core of TerarkDB is a plug-in for RocksDB. It is loaded as a dynamic library for librocksdb.so and compliant with RocksDB’s license. All the code related to MongoDB/MySQL is open source (We use MongoRocks and MyRocks).
Making the core algorithms open source is a dilemma for us. At this stage, as a young startup, keeping the core algorithms proprietary gives us leverage on the valuation and insulates us from potential competitors. But this is something we may reconsider in the future in order to facilitate a wider adoption of our products.
It's a big debate, even for us internally. If anyone else here has been facing the same dilemma, we'd love to hear about your opinion, what you chose in the end and how things turned out.
Terark built a new storage engine for Database and Data Systems based on the Succinct Nested Trie data structure. Our technology enables direct search on highly compressed data without decompressing it. Thanks to that we obtain >200X faster performance and more than 15X storage savings (better than Google's LevelDB or Facebook's RocksDB). We are a Y Combinator company (W17).