Reducing latency is crucial when delivering a better user experience. Bucketeer has just made a game-changing update for developers using its Node.js and Go server SDKs. This new version allows end-user evaluations to happen locally within the SDK, significantly reducing latency.
The Bucketeer backend operated previously to deliver end-user evaluations in less than 20 milliseconds. Network traffic creates delays in the system more frequently where servers operated at longer distances from the Bucketeer backend. Server SDKs adopt a local evaluation feature that enables them to cache feature flags so they can deliver faster responses through local evaluations instead of external requests.
Why Reducing Latency Matters
When handling direct end-user requests, speed is critical. Whether it’s loading a personalized dashboard or delivering results from a search algorithm, delays can frustrate users and degrade the overall experience. This update ensures that feature evaluations are returned in just a few milliseconds, enhancing the responsiveness of applications.
Speed becomes a top priority when dealing with directly received end-user demands. User experience suffers from both dashboard loading times along with search algorithm result delivery times because any delay becomes frustrating for users. This update ensures that feature evaluations are returned in just a few milliseconds, enhancing the applications response.
Technical Details
How Does Local End-User Evaluation Work?
Developers simply need to enable local evaluation by passing a boolean during SDK initialization. The server SDK caches all feature flags and evaluates them locally.
Key Changes to the SDKs
- Caching Mechanism: All feature flags are cached in the SDK.
- Evaluation Algorithm: The same algorithm used in the Bucketeer backend is implemented in the SDK, ensuring identical results for local and remote evaluations.
- Polling: The SDK updates the local cache every minute by default to keep it fresh. Developers can adjust this interval if needed.
Benefits for Node.js and Go Users
Both Node.js and Go server SDK users can now deliver end-user evaluations in just a few milliseconds, thanks to local evaluation.
Real-World Scenarios
Improved User Experience
Remote Evaluation (Before Update)
This approach requires a request to the Bucketeer backend, which introduces potential latency.
In this flow, the request goes from the end user to the server SDK, then to the Bucketeer backend, and back to the server SDK before reaching the user. Network latency between the server SDK and the backend can slow down the process.
Local Evaluation (With the Latest Update)
This approach caches feature flags locally and evaluates requests directly within the server SDK, avoiding external requests.
By evaluating requests locally, the server SDK can return a response almost instantly without relying on the backend, significantly improving performance.
Faster A/B Testing
Remote Evaluation Scenario
Imagine testing search algorithms on a website where each request requires a remote evaluation.
Local Evaluation Scenario
With local evaluation, responses are immediate since all evaluations happen directly in the SDK.
Pros and Cons of Local Evaluation
Pros
- Reduced Latency: End-user evaluations happen in just a few milliseconds without external requests.
- Lower Bucketeer Request Costs: Since requests are limited to cache updates every minute, the request count to Bucketeer remains low.
- Consistent Evaluation Logic: The same evaluation algorithm as Bucketeer’s backend ensures accurate results.
Cons
- Increased Server Load: The application hosting the server SDK must handle the CPU load for local evaluations.
- Potential Compute Costs: High volumes of evaluations could increase compute engine costs.
- Maintenance Responsibility: Developers need to manage server performance and scaling.
Trade-Offs
- For small projects or scenarios where latency is less critical, using the Bucketeer backend might be preferable since developers won’t need to manage server load.
- On the other hand, for high-performance applications that require fast responses, local evaluation is a superior choice despite the increased server responsibilities.
Implementation
Here’s a quick example for the Go SDK:
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
client, err := bucketeer.NewSDK(
ctx,
bucketeer.WithAPIKey("YOUR_API_KEY"),
bucketeer.WithHost("YOUR_API_ENDPOINT"),
bucketeer.WithTag("YOUR_FEATURE_TAG"),
bucketeer.WithEnableLocalEvaluation(true), // <--- Enable the local evaluation
bucketeer.WithCachePollingInterval(10*time.Minute), // <--- Change the default interval if needed
)
if err != nil {
log.Fatalf("Failed initialize the new client: %v", err)
}
Developers can find more detailed setup instructions in the Go SDK documentation and the Node.js SDK documentation.
Conclusion
The speed improvements of local end-user evaluation are available now through the latest version. You can find all the necessary details in the documentation:
New features are coming soon, stay tuned!