Skip to content

Commit

Permalink
doc: update overview
Browse files Browse the repository at this point in the history
Signed-off-by: MrCroxx <[email protected]>
  • Loading branch information
MrCroxx committed Sep 16, 2024
1 parent ec414ac commit c7089b1
Show file tree
Hide file tree
Showing 18 changed files with 114 additions and 51 deletions.
3 changes: 3 additions & 0 deletions docs/01-overview/assets/benchmarks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
3 changes: 3 additions & 0 deletions docs/01-overview/assets/hybrid-cache.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 100 additions & 0 deletions docs/01-overview/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Overview

<p align="center">
<img src="/img/logo/slogan.min.svg" style="width: 280px;" />
</p>

## What is foyer?

***foyer***, just as its slogan, is a hybrid cache library for the Rust programming language. 🦀

## What is hybrid cache?

A hybrid cache is a caching system that utilizes both memory and disk storage simultaneously.

<div style="text-align: center;">

![hybrid cache](./assets/hybrid-cache.svg)

</div>


It is commonly used to extend the insufficient memory cache for the system uses Object Store Service (OSS, e.g. AWS S3) as its primary data storage[^oss-dia] to **improve performance** and **reduce costs**[^risingwave].

## Why we need a hybrid cache?

More and more systems are using OSS as their primary data storage. OSS has many great features, such as low storage cost, high availability and durability, and almost unlimited scalability.

However, there are also downsides with OSS. For example, the latency is high and uncontrollable, and its price increases with each accesses. The downsides will be further amplified in a large working set because of more data exchange between cache and OSS.


<div style="text-align: center;">

![exchange](./assets/exchange.svg)

</div>

With a hybrid cache, the ability to cache the working set can be extended from memory only to memory and disk. This can reduce data exchange between cache and OSS, thereby improving performance and reducing costs.


<div style="text-align: center;">

![exchange hybrid cache](./assets/exchange-hybrid-cache.svg)

</div>

## Highlights of foyer

As a hybrid cache, ***foyer*** provides the following highlighted features:

- **Hybrid Cache**: Seamlessly integrates both in-memory and disk cache for optimal performance and flexibility.
- **Plug-and-Play Algorithms**: Empowers users with easily replaceable caching algorithms, ensuring adaptability to diverse use cases.
- **Fearless Concurrency**: Built to handle high concurrency with robust thread-safe mechanisms, guaranteeing reliable performance under heavy loads.
- **Zero-Copy Abstraction**: Leveraging Rust's robust type system, the in-memory cache in foyer achieves a better performance with zero-copy abstraction.
- **User-Friendly Interface**: Offers a simple and intuitive API, making cache integration effortless and accessible for developers of all levels.
- **Out-of-the-Box Observability**: Integrate popular observation systems such as Prometheus, Grafana, Opentelemetry, and Jaeger in just **ONE** line.

## Why use foyer, when you have 'X'?

Unfortunately, there is currently no general proposed hybrid cache library in the Rust community. If you have a need for hybrid cache, ***foyer*** would be your best choice.

CacheLib[^cachelib] provides a Rust binding. However, it only provides limited interfaces. You still need to patch the C++ codebase if you have requirements such as logging, metrics, or tracing supports. Besides, ***foyer*** provides a better optimized storage engine implement over CacheLib. You can try both ***foyer*** and CacheLib to compare the benchmarks.

For the needs as an in-memory only cache, ***foyer*** also provides compatible interfaces and competitive performance. Benchmarks[^benchmark] show that ***foyer*** outperforms moka[^moka] and is only second to quick-cache[^quick-cache].

<div style="text-align: center;">

![benchmarks](./assets/benchmarks.svg)

</div>

## What's next?

- Learn how to use ***foyer*** in your project, goto [Tutorial](/docs/category/tutorial).
- Learn how to solve various challenging situations with ***foyer***, goto [Topic](/docs/category/topic).
- Learn how other projects use ***foyer***, goto [Showcase](/docs/category/showcase).
- Learn the design of ***foyer***, goto [Design](/docs/category/design).

## Acknowledgement

***foyer*** draws inspiration from CacheLib[^cachelib], a well-known cache library written in C++, and Caffeine[^caffeine], a widely-used in-memory cache library in Java, among other projects like moka[^moka], intrusive-rs[^intrusive-rs], etc.

Thank you for your efforts! 🥰

[^oss-dia]: Systems using OSS as its primary data storage: [RisingWave](https://github.com/risingwavelabs/risingwave), [Chroma Cloud](https://github.com/chroma-core/chroma), [SlateDB](https://github.com/slatedb/slatedb), etc.

[^risingwave]: How streaming database RisingWave use foyer to improve performance and reduce costs: [Showcase - RisingWave](/docs/showcase/risingwave).

[^cachelib]: [FaceBook/CacheLib](https://github.com/facebook/cachelib).

[^benchmark]: Benchmark with mokabench[^mokabench]: [PR comments](https://github.com/moka-rs/mokabench/pull/20#issuecomment-2080429290).

[^moka]: [moka-rs/moka](https://github.com/moka-rs/moka).

[^quick-cache]: [arthurprs/quick-cache](https://github.com/arthurprs/quick-cache).

[^caffeine]: [ben-manes/caffeine](https://github.com/ben-manes/caffeine).

[^intrusive-rs]: [Amanieu/intrusive-rs](https://github.com/Amanieu/intrusive-rs).

[^mokabench]: [moka-rs/mokabench](https://github.com/moka-rs/mokabench).
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"label": "Tutorial",
"position": 1,
"link": {
"type": "generated-index"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"label": "Topics",
"position": 2,
"label": "Topic",
"link": {
"type": "generated-index"
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"label": "Showcase",
"position": 3,
"link": {
"type": "generated-index"
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"label": "Design",
"position": 4,
"link": {
"type": "generated-index"
}
Expand Down
42 changes: 0 additions & 42 deletions docs/tutorial/01-overview/index.md

This file was deleted.

8 changes: 6 additions & 2 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,17 @@ const config: Config = {
{
title: 'Docs',
items: [
{
label: 'Overview',
to: '/docs/overview',
},
{
label: 'Tutorial',
to: '/docs/category/tutorial',
},
{
label: 'Topics',
to: '/docs/category/topics',
label: 'Topic',
to: '/docs/category/topic',
},
{
label: 'Showcase',
Expand Down
3 changes: 1 addition & 2 deletions src/pages/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@
display: flex;
align-items: center;
justify-content: center;
margin-left: 0.5rem;
margin-right: 0.5rem;
margin: 0 0.5rem;
}

0 comments on commit c7089b1

Please sign in to comment.