I posted this in the wrong place so here it is: H...
# ask-questions
a
I posted this in the wrong place so here it is: Hey team, we currently have GrowthBook set up in one of our services. In order to run an experiment we are calling the following method:
Copy code
def evaluateFeature(
    feature: String,
    experimentAttributes: String,
  ): FeatureResult[String] = {
    GrowthBook.setAttributes(experimentAttributes)
    GrowthBook.evalFeature(feature, classOf[String])
  }
The issue is that at any given time N concurrent calls of that can be made. Each call tries to set the attributes but the problem arises when client X sets attributes, then client Y sets attributes, and immediately after that client X calls
GrowthBook.evalFeature
and the attributes being used are from client Y and not client X. The issue is that this is including some of our subjects in experiments when it shouldn’t be because they would not actually fit the targeting conditions. One way to fix this is to instantiate a GrowthBook instance per client so that it has its own context, but I know that is not recommended. Do you guys have any good solution for this type of problem? cc: @rhythmic-agency-4145
@fresh-football-47124 sorry for the direct ping but we’re trying to get an AB experiment up soon and this caused issues
We are using the Java SDK
r
@fresh-football-47124 we’re considering instantiating a new SDK client for each request that goes out, since the attributes are different each time. Is it advisable to do so? we’re looking at potentially 1000s of requests per second
https://github.com/growthbook/growthbook/issues/437 i found this, but we’re a little concerned about creating that many instances and just want to confirm