Faucet: Fast, Asynchronous, Concurrent R Application Deployment
Welcome to Faucet, your go-to solution for deploying Plumber APIs and Shiny Applications with blazing speed and efficiency. Faucet is a high-performance server built with Rust, offering Round Robin and Round Robin + IP Hash load balancing for seamless scaling and distribution of your R applications. Whether you're a data scientist, developer, or DevOps enthusiast, Faucet streamlines the deployment process, making it easier than ever to manage replicas and balance loads effectively.
Features
-
High Performance: Faucet is designed with speed in mind, leveraging Rust's performance benefits to ensure your R applications run smoothly and efficiently.
-
Load Balancing: Choose between Round Robin and Round Robin + IP Hash load balancing strategies to distribute incoming requests among multiple instances, optimizing resource utilization.
-
Replicas: Easily scale your Plumber APIs and Shiny Applications by running multiple replicas, allowing for improved performance and increased availability.
-
Simplified Deployment: Faucet simplifies the deployment process, making it a breeze to get your R applications up and running quickly.
-
Asynchronous & Concurrent: Faucet leverages asynchronous and concurrent processing, ensuring optimal utilization of resources and responsive handling of requests.
Usage
Get some help
To display the help message, run the following command:
Start a Plumber API
To start a plumber API, you will simply need to specify the directory containing the 'plumber.R' file. Faucet will automatically detect the file and start the API.
The server will automatically listen on port 3838 by default. To change the host and port, use the --host flag to specify the socket address to bind to the service.
By default Faucet will start as many workers as there are logical cores on the machine. To specify the number of workers, use the --workers flag.
Start a Shiny Application
To start a Shiny Application, you will simply need to specify the directory containing the 'app.R' file. Faucet will automatically detect the file and start the application.
The server will automatically listen on port 3838 by default. To change the host and port, use the --host flag to specify the socket address to bind to the service.
By default Faucet will start as many workers as there are logical cores on the machine. To specify the number of workers, use the --workers flag.
Note: On Shiny applications, Faucet will be forced to use Round Robin + IP Hash load balancing. This is because Shiny applications require a persistent connection between the client and the server. If Round Robin load balancing is used, the client will be redirected to a different instance on each request, causing the connection to be lost.
Pick a Load Balancing Strategy for Plumber APIs
Faucet supports two load balancing strategies for Plumber APIs: Round Robin and Round Robin + IP Hash.
By default, Faucet will use Round Robin load balancing. To change the strategy, use the --strategy flag.
Explicitly set the type of application
By default, Faucet will try to detect the type of application based on the files in the specified directory. If you want to explicitly set the type of application, use the --type flag.
Installation
Option 1: Binary Download (Linux)
Download the latest release of Faucet for Linux from the GitHub Releases page. This should work with most Linux distributions.
FAUCET_VERSION="v0.2.3"
# Make the binary executable
# Move the binary to a directory in your PATH (e.g., user local bin)
Option 2: Install with Cargo (Linux, macOS, Windows)
Install Faucet with Cargo, Rust's package manager.
- Install Rust by following the instructions here.
|
- Install Faucet with Cargo.
Option 3: Build from Source (Linux, macOS, Windows)
- Install Rust by following the instructions here.
|
- Clone the Faucet repository.
- Build Faucet with Cargo.