Managing Hundreds of Millions of Orders with Table Store

Background

Scenario

Technical Considerations

Solution Evolution

Ordinary Solutions

(1) MySQL Database/Table Sharding

(2) MySQL + HBase

(3) MySQL +ElasticSearch

Table Store

Overview of the Order System Based on Table Store

Preparation for Building

(1) Activate Table Store

(2) Create an Instance

(3) Download SDKs

<dependency>
<groupId>com.aliyun.openservices</groupId>
<artifactId>tablestore</artifactId>
<version>4.8.0</version>
</dependency>
$ go get github.com/aliyun/aliyun-tablestore-go-sdk
$ npm install tablestore@4.1.0

(4) Design a Table

Start Building (Core Code)

(1) Create a Data Table

(2) Create a Data Table Index

(3) Data Import

(4) Data Reading

List<Query> mustQueries = new ArrayList<Query>();TermQuery termQuery = new TermQuery();
termQuery.setFieldName("cId");
termQuery.setTerm(ColumnValue.fromString("c0001"));
mustQueries.add(termQuery);
RangeQuery rangeQuery = new RangeQuery();
rangeQuery.setFieldName("totalPrice");
rangeQuery.setFrom(ColumnValue.fromDouble(99.99));
mustQueries.add(rangeQuery);
BoolQuery boolQuery = new BoolQuery();
boolQuery.setMustQueries(mustQueries);

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store