Asynchronous Execution
To enable high performance and scalability, Valkey GLIDE uses connection multiplexing in its Rust core. This makes it async by nature with each client wrapper implementing the asynchronous patterns of their language. This provides a consistent interface across languages while taking advantage of Rust’s performance.
Rust Core Multiplexing
Section titled “Rust Core Multiplexing”In connection multiplexing, all requests are sent through a single connection as opposed to using a connection pool. As a result, each GLIDE client instance only maintains a single connection per node.
When combined with Valkey’s pipelining capabilities, it allows the Rust Core to send off requests without waiting for responses using a single multiplex connection. This design allows GLIDE clients to deliver high asynchronous performance with only a single connection.
Asynchronous Patterns
Section titled “Asynchronous Patterns”One of GLIDE’s goals is to provide a consistent and friendly interface. To achieve this, each of GLIDE’s clients supports the native asynchronous execution model.
# Support python's async/awaitawait client.set("user:101", "active")// Support Javascript Promises syntaxconst status = await client.set("user:101", "active");// Async set operation using Future interfaceCompletableFuture<String> future = client.set("user:101", "active");go func(ctx){ // Blocking, but Goroutine compatible result, err := client.Set(ctx, "user:101", "active") if err != nil { log.Println(err) }}()