Internship at ABACUS digital Part 1: Feature Flag with GrowthBook

Pisit Wongsripisant
ABACUS digital
Published in
3 min readJul 4, 2023

During my internship as a Software Engineer at ABACUS digital, I had the opportunity to work on a fascinating project that involved utilizing GrowthBook for feature flagging and addressing scalability challenges with k6 load testing. In this medium blog, I will share my learnings and experiences while working on this project, along with the solutions we implemented :)

GrowthBook : Empowering Feature Flagging

Figure 1 : Frontend UI for user interaction
Figure 2 : Setting for each features

GrowthBook is a powerful tool that enables feature flagging, allowing developers to control the release of features to different user groups and being used as a circuit breaker to prevent unexpected behavior. It offers a self-hosting option through Docker Compose, which simplifies the deployment process.

GrowthBook also provides a tools for A/B testing experimentation which you can defines your own existing data and metrics. In this project, we will mainly focus on feature flagging feature.

Understanding the GrowthBook Container

Figure 3 : Self-hosting option through Docker Compose
// Example JSON response from Express.js API
{
"status": 200,
"features": {
"feat1": {
"defaultValue": false
},
"feat2": {
"defaultValue": "red"
}
},
"dateUpdated": "2023-07-03T03:48:35.354Z"
}

GrowthBook consists of a NextJS front-end UI interaction, an ExpressJS API to retrieve JSON data that indicated the status of each features in different environments, and a Python stats engine. Everything is bundled together in a single Docker Image.

Load Testing with k6

import http from "k6/http";
import { sleep } from "k6";

export let options = {
stages: [
{ duration: "1m", target: 10000 }, // traffic ramp-up from 1 to 10000 users over 1 minute.
{ duration: "5m", target: 10000 }, // stay at 10000 users for 5 minutes
{ duration: "1m", target: 0 }, // ramp-down to 0 user
],
};

export default function () {
http.get("http://localhost:3100/api/features/sdk-s5ve4yOConiHuLxD");
sleep(1);
}
Figure 4 : Load Testing result

However, during load testing to retrieve JSON data with the k6 tool in our local environment, we discovered that the system couldn’t handle a large number of requests efficiently. This posed a challenge for scaling the application.

Webhook and Amazon S3 Solution

Figure 5 : Webhook setting in GrowthBook UI
Figure 6 : Overall architecture

To overcome the scalability challenge, we decided to implement a Webhook approach available in GrowthBook. We utilized Webhook to listen for events such as feature.created, feature.updated and feature.deleted to trigger an API call to custom Express.js server.

Then, Express.js server will receive a latest feature information and write updated JSON data to Amazon S3 bucket.

By leveraging Webhook and storing feature data in Amazon S3, we eliminated the need for frequent API calls and improved the overall efficiency.

Conclusion

Working with GrowthBook for feature flagging and finding scalable solutions was a significant learning experience. Moreover, the chance to engage in load testing and leverage Amazon S3 for storage not only expanded my knowledge but also provided practical insights into efficient system performance.

I am grateful for the opportunity to contribute to this project and to work with such innovative technologies.

--

--