Java Code Examples for com.amazonaws.services.dynamodbv2.model.TableDescription#getProvisionedThroughput()
The following examples show how to use
com.amazonaws.services.dynamodbv2.model.TableDescription#getProvisionedThroughput() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DynamoDBBootstrapWorker.java From dynamodb-import-export-tool with Apache License 2.0 | 6 votes |
/** * returns the approximate number of segments a table should be broken up * when parallel scanning. This function is based off of either read and * write capacity, with which you can scan much faster, or the size of your * table, which should need many more segments in order to scan the table * fast enough in parallel so that one worker does not finish long before * other workers. * * @throws NullReadCapacityException * if the table returns a null readCapacity units. */ public static int getNumberOfSegments(TableDescription description) throws NullReadCapacityException { ProvisionedThroughputDescription provisionedThroughput = description .getProvisionedThroughput(); double tableSizeInGigabytes = Math.ceil(description.getTableSizeBytes() / BootstrapConstants.GIGABYTE); Long readCapacity = provisionedThroughput.getReadCapacityUnits(); Long writeCapacity = provisionedThroughput.getWriteCapacityUnits(); if (writeCapacity == null) { writeCapacity = 1L; } if (readCapacity == null) { throw new NullReadCapacityException( "Cannot scan with a null readCapacity provisioned throughput"); } double throughput = (readCapacity + 3 * writeCapacity) / 3000.0; return (int) (10 * Math.max(Math.ceil(throughput), Math.ceil(tableSizeInGigabytes) / 10)); }
Example 2
Source File: WriteIopsCalculator.java From emr-dynamodb-connector with Apache License 2.0 | 5 votes |
private double getThroughput() { TableDescription tableDescription = dynamoDBClient.describeTable(tableName); if (tableDescription.getBillingModeSummary() == null || tableDescription.getBillingModeSummary() .getBillingMode().equalsIgnoreCase(DynamoDBConstants.BILLING_MODE_PROVISIONED)) { ProvisionedThroughputDescription provisionedThroughput = tableDescription.getProvisionedThroughput(); return provisionedThroughput.getWriteCapacityUnits(); } return DynamoDBConstants.DEFAULT_CAPACITY_FOR_ON_DEMAND; }
Example 3
Source File: ReadIopsCalculator.java From emr-dynamodb-connector with Apache License 2.0 | 5 votes |
private double getThroughput() { TableDescription tableDescription = dynamoDBClient.describeTable(tableName); if (tableDescription.getBillingModeSummary() == null || tableDescription.getBillingModeSummary().getBillingMode() .equalsIgnoreCase(DynamoDBConstants.BILLING_MODE_PROVISIONED)) { ProvisionedThroughputDescription provisionedThroughput = tableDescription .getProvisionedThroughput(); return provisionedThroughput.getReadCapacityUnits(); } return DynamoDBConstants.DEFAULT_CAPACITY_FOR_ON_DEMAND; }
Example 4
Source File: DescribeTable.java From aws-doc-sdk-examples with Apache License 2.0 | 4 votes |
public static void main(String[] args) { final String USAGE = "\n" + "Usage:\n" + " DescribeTable <table>\n\n" + "Where:\n" + " table - the table to get information about.\n\n" + "Example:\n" + " DescribeTable HelloTable\n"; if (args.length < 1) { System.out.println(USAGE); System.exit(1); } String table_name = args[0]; System.out.format("Getting description for %s\n\n", table_name); final AmazonDynamoDB ddb = AmazonDynamoDBClientBuilder.defaultClient(); try { TableDescription table_info = ddb.describeTable(table_name).getTable(); if (table_info != null) { System.out.format("Table name : %s\n", table_info.getTableName()); System.out.format("Table ARN : %s\n", table_info.getTableArn()); System.out.format("Status : %s\n", table_info.getTableStatus()); System.out.format("Item count : %d\n", table_info.getItemCount().longValue()); System.out.format("Size (bytes): %d\n", table_info.getTableSizeBytes().longValue()); ProvisionedThroughputDescription throughput_info = table_info.getProvisionedThroughput(); System.out.println("Throughput"); System.out.format(" Read Capacity : %d\n", throughput_info.getReadCapacityUnits().longValue()); System.out.format(" Write Capacity: %d\n", throughput_info.getWriteCapacityUnits().longValue()); List<AttributeDefinition> attributes = table_info.getAttributeDefinitions(); System.out.println("Attributes"); for (AttributeDefinition a : attributes) { System.out.format(" %s (%s)\n", a.getAttributeName(), a.getAttributeType()); } } } catch (AmazonServiceException e) { System.err.println(e.getErrorMessage()); System.exit(1); } System.out.println("\nDone!"); }