AirJD 焦点
AirJD

没有录音文件
00:00/00:00
加收藏

付宝红包—双11的挑战与应对 by 邱硕@蚂蚁金服

发布者 devops
发布于 1458089525180  浏览 5694 关键词 并发, DevOps 
分享到

第1页

⽀付宝红包

——双11的挑战与应对

蚂蚁⾦服-⽀付核算技术部 邱硕



第3页

• • • • •



第4页

• •



•/

• •

• •





第5页

11

spanner



server_1



server_2 …

cluster



server_n



server_1



server_2 …

cluster



server_n



server_1



server_2 …

cluster



server_n



server_1



server_2 …

cluster



server_n



msgBroker



server_1



server_2 …

cluster



server_n



server_1



server_2 …

cluster



server_n







biz data



DB_0



DB_1 …



DB_19



DB_0



DB_1 … DB_19



share data



read_db



read_db



e.g.



第6页

()



第7页

——



start transaction lock budget record and get its value ( ); subtract budget record by ∆ insert business orders... commit



start transaction; lock budget record and get its value;



< rollback;



>;



50 tps —> 800 tps

start transaction; insert business orders... subtract budget record by ∆

when value is sufficient commit start transaction insert business orders... subtract budget record by ∆

when value is sufficient rollback;



第8页

——MySQL patch



start transaction; add business orders... subtract budget record by ∆

when value is sufficient commit



EXE:update OK

EXE:commit



MySQL



• DB





800 tps —> 4000 tps



第9页



• DB

• •



——

budget id:1

: 100



sub_budget bid:1 sbid:1

: 10 DB 1

sub_budget bid:1 sbid:2

: 10 DB 2



sub_budget bid:1 sbid:10

: 10 DB 10



第10页

sub_budget bid:1 sbid:1

:1

sub_budget bid:1 sbid:2

:2

sub_budget bid:1 sbid:3

:1



sub_budget bid:1 sbid:10

:0



sub_budget bid:1 sbid:1

:4

sub_budget bid:1 sbid:2

:0

sub_budget bid:1 sbid:3

:0

sub_budget bid:1 sbid:10

:0



•• ••



第11页



• •

• •



sub_budget bid:1 sbid:1

: 10 DB 1

sub_budget bid:1 sbid:2

: 10 DB 2



sub_budget bid:1 sbid:10

: 10 DB 10



sub_budget_route



bid:1; sbid:1; bid:1; sbid:2; …



: 10 : 10



bid:1; sbid:10; : 10



DB 1



第12页



• •

• •



sub_budget bid:1 sbid:1

50000 :10 tps DB 1



4000 tps —> ≥10000~50000 tpssub_budget bid:1 sbid:2 : 10

DB 2



sub_budget_route bid:1; sbid:1; : 10 bid:1; sbid:2; : 10 … bid:1; sbid:10; : 10

DB 1







sub_budget bid:1 sbid:10

: 10

DB 10



第13页

——



SubBudget_99

SubBudget_81 SubBudget_80 SubBudget_79

SubBudget_61 SubBudget_60 SubBudget_59

SubBudget_41 SubBudget_40 SubBudget_39

SubBudget_21 SubBudget_20 SubBudget_19

SubBudget_01 SubBudget_00



Budget



DB



第14页

50,000 tps



• •



16 14 12 10

8 6 4 2 0

0



%

500 1000 1500 2000 2500 3000 3500 4000 4500 5000 %



DB

SOA DB



-



500,000+ tps



第15页

CAP

• Consistency

• C1 • C2

• Availability



• Partition-Tolerance





CA



C-( A( P-(



) )

)



PA PA PA PA



第16页

()



第17页

N1×N2×N3



N1’+ N2’



• • •



17 18 13 14



19 20 15 16











9 10 11 12



DB



第18页



• •



• C2C





• LRU





template_1 template_2 template_3



user_id_a

coupon_1 coupon_2 coupon_3



+ pc00-03



pc04-07



… pc16-19



CZone share

table sharding



第19页

SQL





• •

• SQL

• O(n) —> O(1)



coupon id=1 cur_amt=10

coupon id=2 cur_amt=5

coupon id=3 cur_amt=2



第20页

/

SQL DB patch

( ) 50 ->50,000 tps

SQL



第21页

• • •



第22页

• • • •

• RPC

• •



• •

• DB



DB







CDN



CDN



CDN



… CDN



mock



DDBDBBAAA



DDBDBBBAA







msg



msg



mock



DDBDBBAAA DDBDBBBAA

N



第23页

•••

••• ••• ••• ••

• • DB

••

0 •…



第24页

•••

••• ••• ••• ••

• • DB

••

0 •…



第25页





••

• •











• •

••



10 9 8 7 6 5 4 3 2 1

0



5 10 15 20 25 30 35 40 45 50 00



2 1.8 1.6 1.4 1.2

1 0.8 0.6 0.4 0.2

0 1 2 3 4 5 6 7 8 9 10



第26页

——





• •



tps









1 1

tps





hit-count











hit-count



1 1



111 234

00 111 234



1111 5678

000 1111 5678



第27页

——



80 60







第28页

——





第29页

• • •



第30页







• •







• ()









第31页

• /DB • • DB •



支持文件格式:*.pdf
上传最后阶段需要进行在线转换,可能需要1~2分钟,请耐心等待。