Friday, January 23, 2015

Read a Thin Book - Cloud Architecture Patterns - 4 - Scalabiity

Scalability Primer


Definition


Vertically Scaling Up
-- to increate capacity of individual nodes through hardware improvement
-- hardware or infrastructure focused
Horizontally Scaling Out
-- increase overall capacity by adding more nodes
-- shifts the focus from maximizing the power of individual nodes to combining the power of many nodes.
-- more complex than vertical scaling
-- more fundamental influence on application structure.
-- software/development and architecture focused

Note:
Scalability is better described as elasticity since scaling down is also important in this model. People are used to extend/stretch capacity and rarely want to contract it.

Benefits


Vertically Scaling Up

--simple

Horizontally Scaling Out

-- commodity systems
-- unlimited growth

Constraints


Vertically Scaling Up

--can be costy
-- has a limit on maximum capacity

Horizontally Scaling Out

-- complex on implementation and maintenance
-- each node is less efficient on resource usages due to overhead of scaling out support

Misc

Cloud-native applications allocate resources horizontally. and scalability is one of the benefits.

The key to efficiently utilizing resources is stateless autonomous compute nodes. State
less nodes do not imply a stateless application. Important state can be stored external
to the nodes in a cloud cache or storage service, which for the web tier is usually done
with the help of cookies. Services in the service tier typically do not use session state, so
implementation is even easier: all required state is provided by the caller in each call.

Thursday, January 22, 2015

OData Protocal

http://www.odata.org/


It's good to see people eventually realize XML and SOAP have their disadvantages, but it's not good to see people start again to make it ridiculous complex. I am talking about features as shown in queries, relating resources and invoking functions. These are stupid ideas. Do you have to do these through JSON and RESTful?


Use JSON and RESTful to do reasonable things they are good at. Please do not try to use them for everything, just like when people used to use XML and SOAP for everything!

Tuesday, January 13, 2015

Read a Thin Book - Cloud Architecture Patterns - 3 - Database Sharding

Database Sharding


It is a technique to scale data horizontally.

Impress on this is to start with single database and then divvy up its data across multiple ones (shards). Each one has same schema as original one. most data is distributed so that each row appears in exactly one shard. The combined data from all shards form single logical database.

When to use


-- when query volume, update volume and storage requirements etc exceed capacity of single database
--when you can no longer scale up or scaling up involves unacceptable cost comparing to scaling out.

Implementation


In database integrated sharding support, such as federation in MySQL and SQL Server.
This pushes complexity out of application code and into the database service.

Application layer support. expensive and complex, but more flexible. If you want to shard Oracle database, likely you will have to go through this approach.

Usually specific database column is designed as shard key that determines which shard node data should goes to. the shard key is also needed in order to access data.

Even sharding usually means horizontal split and stores different set of same structured data into different nodes, functional split or vertical split is very often the first step to go before data can be further sharded (horizontal split). Each function area has a shard group, in each shard group, data is horizontally split. For example, for a function area dedicated for customers, a shard group is created for it, with the group, customer data is split and distributed according to last name.

Well designed sharding may only shard certain tables, commonly used reference tables can simply be replicated entirely.

In order to be efficient, single shard should be able to satisfy most of common database operations without having to resort to another shard. (share nothing)

As a common practice, all the shard nodes should have UTC as their time,

Related Concept or Areas


Scalability, eventual consistency, shared nothing/autonomous

Challenges


Aggregation usually for report usually is a challenge and has to resort to application, NoSQL database such as CouchBase support MapResuce that span shards, but not common to most of databases.

Adding nodes and design shard key is also a challenge. poorly designed sharding plan may introduce huge volume of data movement.

Materials

http://www.google.com/url?q=http%3A%2F%2Fintermediatesql.com%2Fsharding%2Fioug-collaborate-2012-the-art-of-database-sharding%2F&sa=D&sntz=1&usg=AFQjCNFxJ6PTrdYTsV1Q-TRieXl4K6z-7Q



Tuesday, January 06, 2015

Read a Thin Book - Cloud Architecture Patterns - 2

CDN

Content Delivery Network

Definition

A service that provide global caching.

Benefits


Reduce latency by routing client to nearest data node.
Distribute load to multiple nodes
Redundancy by replication
Availability
scalability

Drawbacks


First access to the file is slower(subsequent access is faster by accessing local region cache)

Mechanics

Edge caching. providing content to user from closest location. CDN's role is to provide edge caching.

Cache content (files) on many nodes globally around the world.

Only master copy matters.

It differs from multisite deployment in term of content vs application, reading vs reading and writing.

Using URL provided by CDN provider so that CDS can determine when to use cache

Whenever user want to access content controlled by CDN service, CDN will determine closest CDN node to serve client. anycast protocal)

Cached content has expiration period, and changes will be propagated by CDN service.

Challenges

Cache can be out of dated. Sync needs time to happen. (example of eventual consistency. immediate consistency is traded off to availability ad scalability)

Usage

Good for repeatedly used files,  big multimedia files such as video and voice content

Misc

Usually this can be enabled in cloud storage service. E.g. Windows Azure Blob Storage.

Monday, January 05, 2015

Read a Thin Book - Cloud Architecture Patterns - 1

Multisite Deployment


Definition


Deploying your application to multiple data centers. For both reading and writing.

Benefits


Reduce latency by routing client to nearest data center.
failover across data centers improves availability.

Constraints


Costly.
There will have data loss during failover.

Mechanics


Cloud platform provides service for geographic load balancing. Traffic Manager in Azure and Elastic Load Balancing in AWS.

Data replication between data storage in different data centers. (eventual consistency)


Challenges

Determine service failure

Misc

Geographic load balancing and data replication are all configurable in cloud platforms.