You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/design-raw-ffi.md
+21-22
Original file line number
Diff line number
Diff line change
@@ -2,25 +2,22 @@
2
2
3
3
## Summary
4
4
5
-
The Babushka client enables Redis users connect to Redis using a variety of languages and supported commands. The client
6
-
uses a performant core to establish and manage connections, and a thin wrapper layer written in various languages, to
7
-
communicate
5
+
The Babushka client allows Redis users to connect to Redis using a variety of commands through a thin-client optimized for
6
+
various languages. The client uses a performant core to establish and manage connections and communicate with Redis. The thin-client
7
+
wrapper talks to the core using an FFI (foreign function interface) to Rust.
8
8
9
-
The following document discusses two primary communication protocol architectures for wrapping the babushka clients, and
10
-
how Java-Babushka and Go-Babushka use each of those protocols differently by taking advantage of language-specific attributes.
11
-
12
-
### References
13
-
14
-
* Babushka - communication protocol architecture: describes high-level approaches to communication protocols.
9
+
The following document discusses two primary communication protocol architectures for wrapping the Babushka clients. Specifically,
10
+
it details how Java-Babushka and Go-Babushka each use a different protocol and describes the advantages of each language-specific approach.
15
11
16
12
# Unix Domain Socket Manager Connector
17
13
18
14
## High-Level Design
19
15
20
16
**Summary**: The Babushka "UDS" solution uses a socket listener to manage rust-to-wrapper worker threads, and unix domain sockets
21
-
to deliver package between the wrapper and redis-client threads. This works well because we allow the unix sockets to pass messages
22
-
through the OS and is very performant. This results in simple/fast communication. But the concern is that the unix sockets can
23
-
become a bottleneck for data-intensive communication; ie read/write buffer operations.
17
+
to deliver command requests between the wrapper and redis-client threads. This works well because we allow the unix sockets to pass messages and manage threads
18
+
through the OS, and unix sockets are very performant. This results in simple/fast communication. The risk to avoid is that
19
+
unix sockets can become a bottleneck for data-intensive commands, and the library can spend too much time waiting on I/O
20
+
blocking operations.
24
21
25
22
```mermaid
26
23
stateDiagram-v2
@@ -40,7 +37,7 @@ stateDiagram-v2
40
37
41
38
## Decision to use UDS Sockets for a Java-Babushka Wrapper
42
39
43
-
The decision to use Unix Domain Sockets (UDS) to manage the Java-wrapper to Babushka Redis-client communication was two-fold, as opposed to a raw-FFI solution:
40
+
The decision to use Unix Domain Sockets (UDS) to manage the Java-wrapper to Babushka Redis-client communication was two-fold, vs a raw-FFI solution:
44
41
1. Java contains an efficient socket protocol library (netty.io) that provides a highly configurable environment to manage sockets.
45
42
2. Java objects serialization/de-serialization is an expensive operation, and a performing multiple io operations between raw-ffi calls would be inefficient.
46
43
@@ -50,7 +47,7 @@ The decision to use Unix Domain Sockets (UDS) to manage the Java-wrapper to Babu
| Unix Domain Sockets (jni/netty) | JNI to submit commands; netty.io for message passing | netty.io standard lib; | complex configuration; limited by socket interface |
52
49
| Raw-FFI (JNA, uniffi-rs, j4rs, interoptopus) | JNA to submit commands; protobuf for message processing | reusable in other languages | Slow performance and uses JNI under the hood; |
53
-
| Panama/jextract | Performance similar to a raw-ffi using JNI || lacks early Java support (JDK 18+); prototype |
50
+
| Panama/jextract | Performance similar to a raw-ffi using JNI |modern| lacks early Java support (JDK 18+); prototype |
0 commit comments