Skip to main content

Server Core Overview

Statsig Server Core

Statsig Server Core is our second generation of Server SDKs: a full rewrite with a shared, performance-focused core library that enables superior across-the-board perf and feature maturity across our Server SDKs. Server Core SDKs include:

  • Faster Evaluation: A shared, performance-focused Rust evaluation engine, that evaluates 3-5x as our pure native code SDKs.
  • Superior non-eval performance: more efficient network and CPU usage, plus other performance optimizations always arriving to each SDK.
  • Features new to Server SDKs: Parameter Stores, Contextual Multi-Armed Bandits, and more.
  • Quality-of-life improvements from certain SDKs: Observability Interface, streaming config changes (from the Statsig Forward Proxy) and more

Availability across SDKs

Server Core SDKs are available on an opt-in basis, with native SDKs still available and supported in all languages. If you're just getting started with Statsig, we recommend choosing a Server Core SDK if its convenient for you, but we continue to support bug fixes in our Legacy SDKs, and will until we set end-of-support dates for these SDKs. At that time - we'll also provide guidance to make migration as easy as possible.

Technical differences

Build process: Statsig Server Core uses a core library written in Rust, with bindings written to other languages. In the vast majority of cases, this results in an unchanged development experience with superior performance, but given that the Rust code must compile into a binary usable in your development and deployment environments, some development snafus exist:

  • Choosing the right build: In most cases, the SDK's package manager will automatically install the versions you need. The notable exception is in Java - where our SDK will print out the right build for you, if it's not included at runtime.
  • Managing lockfiles: If your deployment and development environments require different builds (as is common), you'll want to include both versions in a lockfile like package-lock.json.
  • Untested environments: Certain environments, like the edge, aren't friendly to this new build process - and for now, we recommend using our native SDKs for the time being.

New Configuration Spec: Server Core uses a smaller "ruleset", or configuration spec. If you use the spec directly, your logic and parsing will have to change.

Event Logging Server core SDKs, starting in v0.4.0+, have a new event logging architecture. This is designed to stream events freely to statsig servers during normal operation, and throttle/drop events SDK side during outages on the event logging endpoint to enable the service to spin up healthy before processing steady-state qps. We expose the following parameters to tune this implementation

- event_logging_max_queue_size: Controls batch size (default 2000).  Note that exceeding the backend request size limit (10MB) will drop requests
- event_logging_max_pending_batch_queue_size: Controls max pending batches (default: 20). The tradeoff here is increased memory usage to buffer events when requests fail if you increase it, and losing additional events if you decrease it
- disable_all_logging: Completely disables event logging
+----------------+     +----------------+     +----------------+
| Event Sources | | Event Queue | | Flush Triggers |
|----------------| |----------------| |----------------|
| - Gate Checks |---->| - Pending | | - Scheduled |
| - Config Reads | | Events | | (Time-based) |
| - Custom Events| | - Batches |<----| - Manual |
+----------------+ +----------------+ | - Shutdown |
| +----------------+
v
+----------------+
| Flush Process |
|----------------|
| - Batch Events |
| - Send to API |
| - Process |
| Response |
+----------------+
/ \
/ \
v v
+---------------------------+---------------------------+
| On Request Failure | On Request Success |
|---------------------------|---------------------------|
| - Double interval | - Halve interval |
| (max: 60000ms) | (min: 1000ms) |
| - Retry non-retryable | - No specific limit |
| errors up to 5 times | flush mechanism |
| - No specific retry | |
| buffer management | |
+---------------------------+---------------------------+

Support

If you have trouble with a Server Core SDK - we'd love to hear your feedback. Reach out in our Slack and we'll do our best to improve your experience!