-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable autoscaling when using programmatic tables #140
Conversation
c815697
to
2a59e8c
Compare
@@ -252,8 +278,8 @@ private void initializeTable() { | |||
|
|||
logger.debug("Creating table if it does not exist yet"); | |||
|
|||
Long readCapacityUnits = Long.parseLong(this.config.getReadCapacityUnits()); | |||
Long writeCapacityUnits = Long.parseLong(this.config.getWriteCapacityUnits()); | |||
Long readCapacityUnits = this.config.getReadCapacityUnits(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for myself: In my initial PR for the DDB plugin #76 I had this as Long
and Eureka had some issues with it. That is why I changed it to String and did the funky parseLong stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -134,6 +154,12 @@ public void init(DataGenerator dataGenerator) throws Exception { | |||
} else { | |||
dynamoDB = new DynamoDB(client); | |||
} | |||
autoScalingClient = AWSApplicationAutoScalingClientBuilder.standard() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we want to configure autoscaling if we use this.config.programmableTables()
otherwise, the user should use the AWS Console to play around with Table configurations. Therefore this should fit in the initializeTable()
method. Am I missing something here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, programmableTables=false and autoscaling=true is an invalid configuration. ill put this logic in initialize.
@amcp @vinaykumarchella @jolynch @shailesh33 I am not sure if it clear in the code. There are two ways to use the plugin. One way that the user does everything through the AWS Console and the second way that the user does most Table configurations programmatically. It feels to me that the first would be the majority of the use cases. Hence this PR should fit in the |
writeCapacityUnits, | ||
limits.getTableMaxWriteCapacityUnits().intValue(), | ||
targetWriteUtilization); | ||
createAndVerifyScalableTargetAndScalingPolicy(serviceRoleArn, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason calling createAndVerifyScalableTargetAndScalingPolicy
twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, once for the read utilization/capacity target and once for the write utilization/capacity target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, my mistake. I missed the difference in the arguments. It might worth adding a comment above for people who read the code.
|
||
// configure autoscaling - from aws docs | ||
// https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/AutoScaling.HowTo.SDK.html | ||
final String resourceID = "table/" + config.getTableName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These final
variables definition at the end of the method does not help the readability of the code. Their scope of usage is in createAndVerifyScalableTargetAndScalingPolicy
hence I am wondering if it is better to define them in there. Moreover, the class is becoming too long, does it worth splitting into a different class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the final and moving to a different class.
@ipapapa seems like I am going to have to do the credential refactoring first then rebase this branch on the credential refactoring. lets put this PR on hold until then. |
OK, I will block it to avoid mistakenly merging it until you tell me to unblock it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking it based on author request.
761f1da
to
442a17c
Compare
Is there an update on this PR? is it WIP? |
53fcc9c
to
dde7e12
Compare
I rebased on the cli branch for easier testing. |
Setup: sudo yum update -y \
&& sudo yum upgrade -y \
&& sudo yum install -y java-1.8.0-openjdk-devel git emacs \
&& sudo yum remove -y java-1.7.0-openjdk \
&& git clone https://github.com/amcp/ndbench.git \
&& cd ndbench \
&& git checkout consumed \
&& ./gradlew build Test: DISCOVERY_ENV=AWS ./gradlew run \
-Dndbench.config.cli.clientName=DynamoDBKeyValue \
-Dndbench.config.cli.bulkSize=1 \
-Dndbench.config.cli.timeoutMillis=600000 \
-Dndbench.config.dataSize=1000 \
-Dndbench.config.numKeys=1 \
-Dndbench.config.readEnabled=true \
-Dndbench.config.readRateLimit=4 \
-Dndbench.config.writeEnabled=true \
-Dndbench.config.writeRateLimit=4 \
-Dndbench.config.dynamodb.rcu=5 \
-Dndbench.config.dynamodb.wcu=5 \
-Dndbench.config.dynamodb.tablename=auto \
-Dndbench.config.dynamodb.consistentread=true \
-Dndbench.config.dynamodb.maxRetries=0 \
-Dndbench.config.dynamodb.requestTimeout=100 \
-Dndbench.config.dynamodb.maxConnections=1 \
-Dndbench.config.dynamodb.numReaders=1 \
-Dndbench.config.dynamodb.numWriters=1 \
-Dndbench.config.dynamodb.programmableTables=true |
c5e535b
to
d5e15a1
Compare
10b332b
to
f0f1455
Compare
Partially addresses Netflix#118
Fixes #131
I use default values present in the AWS console for all numbers (initial r/w CU, minimum r/w CU, maximum r/w CU and target r/w utilization).