Amazon DynamoDB详解
今早Amazon发布了DynamoDB,作为AWS服务的新成员,提升了AWS管理结构化数据的能力。总体来说,DynamoDB是基于Amazon Dynamo技术实现的可伸缩性和可用性优异的NoSQL数据库托管服务。
DynamoDB的数据模型可以说是SimpleDB/BigTable与Oracle NoSQL的融合。系统首先分成多张表(Table)。表中的记录拥有单属性简单哈希主键或两属性Hash Key+Range Key组合主键。记录内容可包含任意多个属性,属性分单值或多值两种。属性值可以是字符串或数值类型。表没有统一的模式,建表时只需要指定主键的定义,其余各记录都可以拥有自己不同的属性集合。记录由主键和多个属性组成这一点类似于SimpleDB与BigTable,这比简单的KV模型更易用。主键可以由Hash Key+Range Key组合而成则类似于Oracle NoSQL,这主要为了提供相同Hash Key的记录集合操作。
Dynamo service对PrimaryKey的规则定义:
1. 可以只有一列作为primary key,则该列作为hash的输入,也就是用来分Partition
2. 可以由两列作为composite primary key,则第一列仍然作为hash输入,用来分partition,而第二列及其之后的列就可以提供range的查询了
Simple Hash Key
。这个Key对应的Attribute在每个Item里都必须存在而且唯一。
Composite Hash Key with Range Keys
。顾名思义,在Hask Key的基础上,用户可以增加一个Attribute作为范围查询的Key。此时不需要保证Hash Key的唯一性,只需要这两个组合Key是唯一的就可以。这在我们做时间范围查询时非常有用,比如某个用户在24小时内访问过的网页。
Amazon 发布DynamoDB NoSql 服务: http://www.cnblogs.com/raymondshiquan/articles/amazon_dynamo_service.html
DynamoDB的数据会在不同的地理位置机房保存3份。3份数据的同步通常在1秒内完成。
Read consistency
l 最终一致性读((Default): 写操作之后立刻发起读操作返回的可能不是最新数据。只是保证数据最终同步成一致。
最终一致性读操作是强一致性读的半价.
l 强一致性读: 写操作之后立刻发起读操作返回的就是最新数据.
支持单记录原子操作(Atomic Counters):
支持条件更新,支持更新时返回所有属性旧/新值、被更新属性旧/新值
支持基于非主键查询: 使用scan扫描全表,效率较差。
Provisioned Throughput:读写操作的速率限制。用户要指定每张表第秒能提供多少次读写操作(以1KB大小的记录为基准).
Units ofCapacity required for writes = Number of item writes per second x item size(rounded up to the nearest KB)
Units ofCapacity required for reads* = Number of item reads per second x item size(rounded up to the nearest KB), 以实际读取的记录数为准, 和API调用次数无关。 例如想从一张表中每秒读取500条记录, 不管调用的是50个BatchGetItem(每个call返回10条记录)还是500个GetItem, Throughput都必须设为500.
如果读写速度超过了设定的上限, 超出部分读写将失败。
限制:
1. Item size < 64KB(include attribute name and value binary length (UTF-8 length))
2. Attribute values: Attributevalues cannot be null or empty.
3. Hash primary key attribute value< 2048 bytes
4. Range primary key attributevalue < 1024 bytes
5. Query result < 1MBper API call
6. Scan data set size < 1MBper API call(每次只能扫描1MB数据集)
In case of a scan operation, it is not the size of items returned by scan,rather it is the size of items evaluated by Amazon DynamoDB. That is, for ascan request, Amazon DynamoDB evaluates up to 1 MB of items and returns onlythe items that satisfy the scan condition.
a single scan request consumes up to 1 MB / 1 KB = 500 capacity units(because scan returns only eventually consistent result which takes half the capacity units of a consistent read), which is a sudden burst of usage of the configured capacity units for the table. This sudden use of capacity units by a scan starves your other potentially more important requests for the same table from using the available capacity units. As a result, you likely get the "ProvisionedThroughputExceeded" exception for those requests.
You should configure your application to retry any request that receives a response code that indicates you have exceeded your provisioned throughput, or increase the provisioned throughput for your table using the UpdateTable API. If you have temporary spikes in your workload that cause your throughput to exceed, occasionally, beyond the provisioned level, retry the request with exponential backoff.
Error Retries and Exponential Backoff
Numerous components on a network, such as DNS servers, switches, load-balancers, and others can generate errors anywhere in the life of a given request.
The usual technique for dealing with these error responses in a networked environment is to implement retries in the client application. This technique increases the reliability of the application and reduces operational costs for the developer.
Each AWS SDK supporting Amazon DynamoDB implements retry logic, automatically.The AWS SDK for Java automatically retries requests, and you can configure the retry settings using the ClientConfiguration class.For example, in some cases, such as a web page making a request with minimal latency and no retries, you might want to turn off the retry logic. Use the ClientConfiguration class and provide a maxErrorRetry value of 0 to turn off the retries. For more information, see Using the AWS SDKs with Amazon DynamoDB.
http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/ErrorHandling.html#APIRetries
http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/WorkingWithDDTables.html#CapacityUnitCalculations
Amazon DynamoDB详解相关推荐
- Amazon DynamoDB
DynamoDB 是Amazon最新发布的NoSQL产品,那什么是DynamoDB呢? DynamoDB 是一个性能好.可靠高且具有可扩展性的NoSQL云数据库服务,DynamoDB集15年分布式非关 ...
- 详解 Amazon Go 三大核心技术
12月5日,亚马逊发布 Amazon Go 震惊业界,我们第一时间研究了专利文件,并采访资深计算机视觉算法工程师,最终出文从2份专利文件,一窥Amazon Go到底藏了什么黑科技? 今天特地采访了无人 ...
- 深度丨详解 Amazon Go 三大核心技术
12 月 5 日,亚马逊发布 Amazon Go 震惊业界.雷锋网第一时间研究了专利文件,并采访资深计算机视觉算法工程师,最终出文从2份专利文件,一窥Amazon Go到底藏了什么黑科技? 今天雷锋网 ...
- 全方位保护您在 Amazon S3 的数据资产-访问控制详解
2006年,Amazon S3 作为亚马逊云科技发布的第一款公有云服务面世,如今,成千上万的亚马逊云科技客户在利用 Amazon S3 创造各类激动人心的应用.从企业数据湖.机器学习存储,到 HPC. ...
- 【图文详解】一文全面彻底搞懂HBase、LevelDB、RocksDB等NoSQL背后的存储原理:LSM-tree日志结构合并树...
LSM 树广泛用于数据存储,例如 RocksDB.Apache AsterixDB.Bigtable.HBase.LevelDB.Apache Accumulo.SQLite4.Tarantool.W ...
- 【图文详解】一文全面彻底搞懂HBase、LevelDB、RocksDB等NoSQL背后的存储原理:LSM-tree 日志结构合并树...
LSM 树广泛用于数据存储,例如 RocksDB.Apache AsterixDB.Bigtable.HBase.LevelDB.Apache Accumulo.SQLite4.Tarantool.W ...
- 多维系统下单点登录深入详解
多维系统下单点登录深入详解 1. 从淘宝天猫的单点登录说起 1.1 SSO单点登录 1.2 淘宝天猫登录场景解析 2. 单点登录之整体解决方案 2.1 设计方案-Cookie 2.2 设计方案-分布式 ...
- 详解亚马逊:物流为何是电商命脉
在物流环节上,亚马逊(AMZN)主要涉及物流中心运营,商品配送环节主要采取和第三方快递公司合作完成.那么,亚马逊物流促销活 动反映在财务收支上的结果又如何?根据年报数据,2011年亚马逊收到来自用户支 ...
- ★核心关注点_《信息系统项目管理师考试考点分析与真题详解》
★核心关注点_<信息系统项目管理师考试考点分析与真题详解> 真诚感谢你选用<信息系统项目管理师考试考点分析与真题详解>作为高级项管的辅导用书.对于使用该书的读者们,在备考201 ...
最新文章
- 《评人工智能如何走向新阶段》后记(再续25)
- 小工具发布,QCountDown-语音倒计时
- python文本解析_Python之文本文件解析
- 加工中心刻字宏程序_【宏程序高级案例】涡轮发动机转动轴叶轮的编程思路与程序解析...
- H3C交换机做DHCP
- Matlab画图颜色设置
- Session存放token/获取token,销毁session
- java jbutton 省略号_JButton显示省略号
- HECO使用docker部署单节点的开发网
- WIN7 (64 位)安装AutoCAD2012失败解决方法
- markdown(md)编辑 全部格式
- 计算机主机的跳线怎么接,手把手教你台式机电脑主板跳线接法
- CAD中如何调整对象的前后顺序、AUTOCAD——参照编辑如何使用
- Linux小实验11|添加组group,添加用户aa、bb并加入group组 (2)新建文件/abc.txt (3)设置用户aa对文件拥有读、写和执行权限
- 一文弄懂Redis慢查询
- java程序设计 计算器_java 编程一(计算器)
- 基于规则的语音合成中文文本前端设计
- 2021河南省第十三届ACM/icpc大学生程序设计竞赛榜单
- Python基础:str字符串和list列表的转换
- 您的计算机无法启动后,在多次尝试后,你的电脑上的操作系统仍无法启动