Skip to content

Commit

Permalink
Update to add Shachars changes
Browse files Browse the repository at this point in the history
Signed-off-by: acarbonetto <[email protected]>
  • Loading branch information
acarbonetto committed Nov 21, 2023
1 parent 9bd197a commit bb282ed
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions docs/design-raw-ffi.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Babushka Socket Listener

## Sequence Diagram - Unix Domain Socket Manager
## Unix Domain Socket Manager

### Sequence Diagram

**Summary**: The Babushka "UDS" solution uses a socket manager to redis-client worker threads, and UDS to manage the communication
between the wrapper and redis-client threads. This works well because we allow the socket to manage the communication. This
Expand Down Expand Up @@ -58,7 +60,7 @@ deactivate Client
deactivate Socket
```

## Elements
### Elements
* **Wrapper**: Our Babushka wrapper that exposes a client API (java, python, node, etc)
* **Babushka FFI**: Foreign Function Interface definitions from our wrapper to our Rust Babushka-Core
* **Babushka impl**: public interface layer and thread manager
Expand All @@ -67,11 +69,13 @@ deactivate Socket
* **Unix Domain Socket**: Unix Domain Socket to handle communication
* **Redis**: Our data store

## (Current) Raw-FFI Benchmark Test
## Raw-FFI Benchmark Test

**Summary**: We copied the C# benchmarking implementation, and discovered that it wasn't using the Babushka/Redis client
at all, but instead spawning a single worker thread to connect to Redis using a general Rust Redis client.

### (Current) Sequence Diagram for test

```mermaid
sequenceDiagram
Expand All @@ -96,6 +100,35 @@ deactivate Wrapper
deactivate Client
```

### (New) Sequence Diagram for test

Shachar [updated C# benchmark tests](https://github.com/aws/babushka/pull/559/files) to connect to babushka core, instead
of a redis client.

```mermaid
sequenceDiagram
participant Wrapper as Client-Wrapper
participant ffi as Babushka FFI
participant worker as Tokio Worker
participant Client as Redis
activate Wrapper
activate Client
Wrapper ->>+ ffi: create_connection
ffi ->>+ worker: Create Tokio::Runtime (count: 1)
worker ->> Client: BabushkaClient::new
ffi -->> Wrapper: Connection
Wrapper ->> ffi: cmd[GET/SET]
ffi ->>+ worker: Runtime::spawn
worker ->> Client: Connection::clone.req_packed_command(cmd)
Client -->> worker: Result
worker -->> ffi: success_callback
ffi ->> Wrapper: async Result
deactivate Wrapper
deactivate Client
```

## Sequence Diagram - Managed Raw-FFI Client

**Summary**: Following the socket listener/manager solution, we can create a [event manager](https://en.wikipedia.org/wiki/Reactor_pattern)
Expand Down

0 comments on commit bb282ed

Please sign in to comment.