$30 off During Our Annual Pro Sale. View Details »

サーバーを超えて: 開発者のために作られたTiDB ServerlessとChat2Query

PingCAP-Japan
September 29, 2023

サーバーを超えて: 開発者のために作られたTiDB ServerlessとChat2Query

イベント開催日:2023年09月23日

サーバーレス・データベースの未来は、クラウドとAIテクノロジーの融合を受け入れる態勢が整いつつあります。デジタル時代へのさらなる進展に伴い、企業や開発者はデータを管理するために、より効率的でスケーラブルかつインテリジェントなソリューションを常に求めています。サーバーレスデータベースは、従来のデータベースシステムに代わる強力な選択肢としてすでに勢いを増しており、その可能性は今後数年でさらに高まることが予想されます。

※このスライドは英語資料になります。

PingCAP-Japan

September 29, 2023
Tweet

More Decks by PingCAP-Japan

Other Decks in Technology

Transcript

  1. Momento Confidential
    Beyond the Server: Crafting TiDB
    Serverless and Chat2Query for Developers
    Max Liu
    Co-founder and CEO, PingCAP

    View Slide

  2. Momento Confidential
    Agenda
    ● Brief introduction of PingCAP & TiDB
    ● The journey of building TiDB Serverless
    ● Example: AI powered OSSInsight.io on TiDB Serverless
    ● TiDB Serverless key capabilities
    ● Developer resources

    View Slide

  3. Momento Confidential
    Silicon Valley
    Amsterdam
    Beijing
    Tokyo
    The creators of TiDB
    Founded in 2015
    Based in Sunnyvale, CA
    More than 550+ employees globally
    Over $600M in total funding
    Mission:
    Empower engineers and enterprises
    to innovate with speed, agility,
    and scale
    Singapore

    View Slide

  4. Momento Confidential
    The most advanced,
    open source,
    distributed SQL database
    for modern applications.
    Scalable. Versatile. Titanium (Ti) Reliable.
    35K+ GitHub Stars 800+ Contributors
    Trusted By
    FlipKart
    Pinterest

    View Slide

  5. Momento Confidential
    Where Does the Journey of
    TiDB Serverless Begin?

    View Slide

  6. Momento Confidential
    “How about offering a free
    database for every developer?”
    Is it possible?
    Is it affordable?
    Let's do some math

    View Slide

  7. Momento Confidential
    26.9 million
    Well, A big surprise?

    View Slide

  8. Momento Confidential
    26.9 million clusters
    Even we provide a tiny tidb (aws t2.nano) cluster.
    For each year it will cost:
    26.9 million * 4 vCPUs (3 storage node+ 1 compute
    node + 1 placement driver) * (0.003 * 365 * 24)
    = $2.83 billion / year
    Really? what a shocking number!

    View Slide

  9. Momento Confidential
    ELB ~ 30$ for each cluster/year, we need another
    $807 million.
    We need total $3.6 billion/year.
    Oh, I forget to mention ELB, storage, HA and more…

    View Slide

  10. Momento Confidential
    ELB ~ 30$ for each cluster/year, we need another
    $807 million.
    We need total $3.6 billion/year.
    Let’s forget about the cost of the storage, monitoring system
    and so on, that’s too scary to calculate.
    What’s more, AI transforms individuals into developers. The
    number could be 10x larger in the next few years.
    Oh, I forget to mention ELB, storage, HA and more…

    View Slide

  11. Momento Confidential
    So, We gave up
    Well, that’s too hard

    View Slide

  12. Momento Confidential
    We gave up the traditional architecture
    Well, that’s too hard

    View Slide

  13. Momento Confidential
    Why Not Shut Down the Cluster When It's Not in Use?
    Well, let’s try one more step

    View Slide

  14. Momento Confidential
    Let's rethink the architecture

    View Slide

  15. Momento Confidential
    Yes! Serverless architecture

    View Slide

  16. Momento Confidential
    To Make it possible
    ● Reuse as many spot instances as we can. ~70% off discount
    ● 80/20 theory. 80% of the cluster are not active. 80% off
    Quick math in your mind: $3.6 billion/year * 30% * 20%
    One more thing

    View Slide

  17. Momento Confidential
    ChatGPT works

    View Slide

  18. Momento Confidential
    Load
    balancer
    Isolated
    SQL Layer
    Shared
    Disk Cache Layer
    Object storage
    Gateway Gateway
    Row
    Engine
    Row
    Engine
    Shared Storage( Amazon S3, Google Cloud Storage…)
    Resource
    Pool
    Virtual Cluster - Tenant n
    Micro
    Services Compression Analyze DDL
    Virtual Cluster - Tenant 1

    View Slide

  19. Momento Confidential
    I know it!
    The classical principle:
    Separation of compute and storage.

    View Slide

  20. Momento Confidential
    Yeah! That’s not enough
    Separation of compute and compute.
    ?

    View Slide

  21. Momento Confidential
    Yeah! That’s not enough
    Separation of lightweight compute and heavy compute.
    Not all computations are equal

    View Slide

  22. Momento Confidential
    Tell me more about
    ● lightweight compute
    ○ Read/Write a few records or indexes
    ○ Small OLTP transactions
    ● heavy compute
    ○ Adding index
    ○ Change/Remove a column from a table
    ○ Collect table statistics(Analyze table)
    ○ Scan a whole table or lots of records
    ○ Compression
    ○ And more

    View Slide

  23. Momento Confidential
    Tell me more about
    ● lightweight compute
    ○ Read/Write a few records or indexes
    ○ Small OLTP transactions (e.g. primary key lookup)
    ● heavy compute (offload to dynamic micro services)
    ○ Adding index
    ○ Change/Remove a column from a table
    ○ Collect table statistics(Analyze table)
    ○ Scan a whole table or lots of records
    ○ Compression
    ○ And more

    View Slide

  24. Momento Confidential
    Results of Lightweight compute
    ● 2x better cpu utilization ( Saved 50% money, again! )
    ● Lower latency for lightweight compute, less spike
    Now it’s $100 million per year. Wow, it’s close to $3.7 per developer
    per year.

    View Slide

  25. Momento Confidential
    It is possible! We made it.
    Wow, It’s hard to believe.
    Innovation changed everything

    View Slide

  26. Momento Confidential
    That’s TiDB Serverless

    View Slide

  27. Momento Confidential
    We didn’t stop there

    View Slide

  28. Momento Confidential
    Separation of compute and compute
    ● Better user experience ( after offload heavy compute)
    ○ 100x Faster adding index (WIP)
    ○ Fast table statistics collection (Done. leverage the distributed
    architecture)
    ○ Backup large clusters in seconds (Done. e.g., hundreds of TBs,
    with the help of S3)
    ● Higher Durability & Availability
    ○ Leverage the durability of S3
    ○ Recover from a failed server faster by loading data from S3
    concurrently

    View Slide

  29. Momento Confidential
    TiDB Serverless Architecture
    Offload Compute
    :
    Virtual Cluster - Tenant 1
    SQL SQL
    Storage
    S3 / Blob / Cloud Storage
    Virtual Cluster - Tenant n
    SQL SQL
    DDL worker
    MPP Compute service
    Data Ingestion service
    Storage
    Storage
    Isolated
    SQL Layer
    (For
    OLTP)
    Storage
    Cache
    Layer
    (For OLTP)
    Shared
    Storage
    Pool

    View Slide

  30. Momento Confidential
    Example: OSSInsight.io
    https://github.com/pingcap/ossinsight
    OSSInsight is a powerful open-source tool that gives detailed and up-to-date
    information about the open source world by analyzing over 6 billion GitHub
    events.
    OSS Insight's Data Explorer makes exploring GitHub data easy. Simply ask a
    question in natural language, and Data Explorer will create a SQL, execute the
    SQL, and show you the results visually.

    View Slide

  31. Momento Confidential

    View Slide

  32. Momento Confidential
    OSSInsight on TiDB Serverless
    Data Volume - 12 TBs, over 6 Billion rows of
    data - all growing in real-time.
    Random Mixed Workloads - Serving online
    transactions plus analytical queries
    generated by AI
    Unpredictable Traffic Spikes - Featured on
    HackerNews with 7x traffic in one day.
    72.7%
    Cost Reduction
    Zero
    Manual Intervention
    During Spikes
    5X
    Development Efficiency
    for LLM Data Apps
    https://github.com/pingcap/ossinsight

    View Slide

  33. Momento Confidential
    Unpredictable Traic Spikes
    https://github.com/pingcap/ossinsight

    View Slide

  34. Momento Confidential
    TiDB Serverless: Key capabilities

    View Slide

  35. Momento Confidential
    MySQL Compatible
    Use a familiar language including MySQL drivers and ORMs.

    View Slide

  36. Momento Confidential
    TiDB Serverless
    Lalency
    Time
    Workload
    Peak
    100
    Time
    PVs
    Automatically scale in and out to meet workload
    demands in real-time
    Resource Pool
    Real-time elasticity

    View Slide

  37. Momento Confidential
    What is
    scalability?
    And why
    should we
    care?

    View Slide

  38. Momento Confidential
    Sysbench
    Scale out from 0 to
    ~1.3M QPS
    After the peak, scale
    back to zero.
    Within 30 mins
    Without any
    configuration or
    tuning 🎉

    View Slide

  39. Momento Confidential
    12,491ms vs 187.5ms
    67x Faster with HTAP
    Versatile to run Hybrid Transactional and Analytical (HTAP)
    workloads with smart optimizer and two distinct storage layers

    View Slide

  40. Momento Confidential
    Pay as you go
    Start free, then only pay for the storage and data processing you
    use - and never overspend with a spending limit

    View Slide

  41. Momento Confidential
    AI-Assisted Enhancements
    With OpenAI powered features like Chat2Query and
    TiDB-Bot, it’s designed to boost developer productivity

    View Slide

  42. Momento Confidential
    Developer Resources
    TiDB Cloud CLI
    VS Code
    @TiDB_Developer
    Partner integrations to meet
    where developers are
    Comprehensive docs to
    learn about TiDB Cloud
    Resource hub and online
    courses for developers

    View Slide

  43. Momento Confidential
    [NEW] Serverless Driver for Edge Computing!
    https://docs.pingcap.com/tidbcloud/serverless-driver

    View Slide

  44. Momento Confidential
    AJU Center of Independent Living
    & TiDB Serverless
    AJU migrated some websites below (built with Wordpress) to TiDB Serverless:
    1) こころの絆創膏    2) ゲートキーパー研修    3) なごや食育ひろば (coming soon)
    AJU Center for Independent
    Living is an association run
    by colleagues of wheelchair
    users in Aichi Prefecture.

    View Slide

  45. Momento Confidential
    THANK YOU.
    https://pingcap.co.jp/tidb-cloud/
    Sign up Today!
    No creditcard required.

    View Slide