TiDB at PayPay
How we migrated in 3 months
Presented by
Munenori Hirakawa
PayPay inc.
PayPay is..
● No.1 share mobile payment in Japan
● 29M users / 2M merchants / 1B transactions
● Launched at Oct 2018 by Softbank,
Yahoo! JAPAN and Paytm
Payment
Finnet Wallet
App POS Online
Credit card
Network
Architecture of PayPay
● Offline and online payment
● Users can pay with credit card or user’s balance
● Microservice architecture on Amazon AWS
● Spring Boot + MySQL (Amazon Aurora)
● Payment became the bottleneck
● MySQL compatible
● Horizontal scalability and high availability
● Free from application level sharding
● A lot of experience in production
Why we chose TiDB
● Pros of Aurora
○ Read-write separation contributes to stability
○ AWS managed service
● Cons of Aurora
○ Binlog replication becomes bottleneck for latency under high TPS
(We need binlog replication for DR)
Comparison with Amazon Aurora
New Payment DB with TiDB
PD
TiDB
TiKV
PD
TiDB
TiKV
Pump
Drainer
Drainer Backup
binlog replication
DR site
Slave cluster
Master cluster
● Clone production data
● Verify with sync-diff-inspector
Ensure accuracy:
In-domain verification
Application
in production
Aurora
p6spy
Aurora TiDB
Consumer
Compare by
sync-diff-inspector
Compare by Amazon
EMR (like Hadoop)
Payment
Finnet Wallet
App POS Online
Credit card
Network
Ensure accuracy:
Cross-domain verification
● Verify across microservice components
● Keep verifying after the migration
Ensure performance and availability
● Verified the performance by optimizing the setting and the application
○ Connection pool size, drop indices
● Tested 30+ failure scenarios and confirmed RPO and RTO
○ Instance down, Cluster down, AZ down etc..
● We chose “one-shot” migration
rather “incremental”
● Set binlog in the opposite direction
for rollback
Migration steps
Aurora TiDB
Payment
Aurora TiDB
Payment
Before migration
After migration
Thoughts after the migration
● Expected performance
● 0 incident for first 3 months, it’s reliable
● Good support (Thanks to PingCAP)
● Upgrade to 3.x or higher
● Migrate other databases
● Get more knowledge and experience,
and contribute to TiDB community!
Future roadmap
Thanks!

TiDB at PayPay

  • 1.
    TiDB at PayPay Howwe migrated in 3 months Presented by Munenori Hirakawa PayPay inc.
  • 2.
    PayPay is.. ● No.1share mobile payment in Japan ● 29M users / 2M merchants / 1B transactions ● Launched at Oct 2018 by Softbank, Yahoo! JAPAN and Paytm
  • 3.
    Payment Finnet Wallet App POSOnline Credit card Network Architecture of PayPay ● Offline and online payment ● Users can pay with credit card or user’s balance ● Microservice architecture on Amazon AWS ● Spring Boot + MySQL (Amazon Aurora) ● Payment became the bottleneck
  • 4.
    ● MySQL compatible ●Horizontal scalability and high availability ● Free from application level sharding ● A lot of experience in production Why we chose TiDB
  • 5.
    ● Pros ofAurora ○ Read-write separation contributes to stability ○ AWS managed service ● Cons of Aurora ○ Binlog replication becomes bottleneck for latency under high TPS (We need binlog replication for DR) Comparison with Amazon Aurora
  • 6.
    New Payment DBwith TiDB PD TiDB TiKV PD TiDB TiKV Pump Drainer Drainer Backup binlog replication DR site Slave cluster Master cluster
  • 7.
    ● Clone productiondata ● Verify with sync-diff-inspector Ensure accuracy: In-domain verification Application in production Aurora p6spy Aurora TiDB Consumer Compare by sync-diff-inspector
  • 8.
    Compare by Amazon EMR(like Hadoop) Payment Finnet Wallet App POS Online Credit card Network Ensure accuracy: Cross-domain verification ● Verify across microservice components ● Keep verifying after the migration
  • 9.
    Ensure performance andavailability ● Verified the performance by optimizing the setting and the application ○ Connection pool size, drop indices ● Tested 30+ failure scenarios and confirmed RPO and RTO ○ Instance down, Cluster down, AZ down etc..
  • 10.
    ● We chose“one-shot” migration rather “incremental” ● Set binlog in the opposite direction for rollback Migration steps Aurora TiDB Payment Aurora TiDB Payment Before migration After migration
  • 11.
    Thoughts after themigration ● Expected performance ● 0 incident for first 3 months, it’s reliable ● Good support (Thanks to PingCAP)
  • 12.
    ● Upgrade to3.x or higher ● Migrate other databases ● Get more knowledge and experience, and contribute to TiDB community! Future roadmap
  • 13.