Skip to content
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

DynamoDB plugin #76

Merged
merged 3 commits into from Feb 13, 2018
Merged

DynamoDB plugin #76

merged 3 commits into from Feb 13, 2018

Conversation

ipapapa
Copy link
Contributor

@ipapapa ipapapa commented Feb 10, 2018

This is the first cut of a simple DynamoDB plugin. There might be a few issues since I have not officially tested it yet. If you can add things that you would like to see in the comments then I can keep adding new plugins or functionalities that are important for Netflix.

In the configurations, there is the ability to configure capacity limits and read consistency guarantees. Global tables are something we want to investigate.

public String readSingle(String key) throws Exception {
Item item = null;
try {
GetItemSpec spec = new GetItemSpec().withPrimaryKey("Id", key).withConsistentRead(config.consistentRead());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consistent reads will use double the RCUs and can't be served by DAX. They're also only consistent within the region and won't be globally consistent when using cross region replication.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the idea is to test it in comparison with a quorum Cassandra read. By default, we will not be using it when we want to test DAX: @DefaultValue("false").

* @author ipapapa
*/
@Configuration(prefix = "ndbench.config.dynamodb")
public interface DynamoDBConfigs {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks interesting. I am curious about bindings though. Hopefully, this does not require explicit bindings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I missed that. I need to add a NdBenchClientPluginGuiceModule to leverage the custom configuration. I will do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it!


private void amazonServiceException(AmazonServiceException ase) {

logger.error("Caught an AmazonServiceException, which means your request made it "

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DO you want to log a single message or 6 different messages here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is standard AWS way of reporting errors. In fact, each message presents some information that is useful.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I was just wondering if it is needed for any reason (like grepping) to have the entire message in a single line rather than split across 6 lines. I am fine either ways.

} catch (AmazonClientException ace) {
amazonClientException(ace);
}
return item.toString();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is item here when an exception is thrown?

} catch (AmazonClientException ace) {
amazonClientException(ace);
}
return outcome.toString();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comments as above

@Override
public void shutdown() throws Exception {
try {
logger.info("Issuing DeleteTable request for " + config.getTableName());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we want to delete the table at shutdown? Can it happen that we restart the test at a pre-filled table?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good question. NDBench provides a prefill. This is the proper way to make your database hot. The issue with a managed service (table) is that you can configure with high WCUs and RCUs pay a lot of money and then forget it. After you are done with your tests we need to make sure that there is a way to clean the resources. What other options do you propose?

*/

logger.debug("Creating table if it does not exist yet");
table = dynamoDB.createTable(this.config.getTableName(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens when the table already exists? does it fail or is ignored?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResourceInUseException
The operation conflicts with the resource's availability. For example, you attempted to recreate an existing table, or tried to delete a table currently in the CREATING state.

HTTP Status Code: 400

Resource: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html

String getTableName();

/*
* Attributes – Each item is composed of one or more attributes. An attribute is

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you elaborate on what is an item?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*
* @author ipapapa
*/
@Configuration(prefix = "ndbench.config.dynamodb")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to follow the standard conventions, can you change the prefix to use
NdBenchConstants.PROP_NAMESPACE +

Copy link
Contributor Author

@ipapapa ipapapa Feb 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this too late and I merged it. I will revert the changes and follow up in another PR.

@ipapapa ipapapa merged commit b148b57 into master Feb 13, 2018
ipapapa added a commit that referenced this pull request Feb 13, 2018
@ipapapa ipapapa deleted the dynamodb branch February 13, 2018 19:05
@ipapapa ipapapa mentioned this pull request Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants