Database Tuning at Zerodha - India's Largest Stock Broker

Поділитися
Вставка
  • Опубліковано 6 жов 2024

КОМЕНТАРІ • 134

  • @mzs114
    @mzs114 3 місяці тому +141

    Boring tech is usually better in most cases.

  • @codingwithsam4992
    @codingwithsam4992 2 місяці тому +41

    These are the guys and their content which people should be consuming and not those of LinkedIn didis

  • @pankajsharma-cb4ok
    @pankajsharma-cb4ok 3 місяці тому +35

    By listening to it, I got to know that I also faced similar issues and worked on similar set of solutions except materialised views and redis. Happy to see myself on same path...

  • @CoppsMusic
    @CoppsMusic 2 місяці тому +22

    Zerodha sits on top of SEBI's tech APIs. God, One has to listen from SEBI on how their orchestration is.

  • @haloboy777
    @haloboy777 3 місяці тому +32

    Sensible defaults go a long way, but they only work in certain scenarios. I commend their choice of sticking to the basics.
    To be honest, their main engineering efforts are focused on rewriting their codebase, and I believe that is their core competency. I wish more companies allowed frequent rewrites [where needed].

    • @gokukakarot6323
      @gokukakarot6323 3 місяці тому +2

      The rewrites are not unwarranted, they hit scaling requirements and then improve. Their PDF sending blog is a great example. Some engineers would probably start at that, but that's not how things work in real life. Most startups face this problem as well. Starts with java or rails and then splits into microservicrs to scale independently

  • @HardikGajjarTechy
    @HardikGajjarTechy 3 місяці тому +11

    PG always shock engineers with new features and flexibility

  • @micheljohn5898
    @micheljohn5898 Місяць тому

    Great talk. So refreshing to see someone talk about actually getting stuff done instead of just some over-engineered setup

  • @arpanmukherjee4625
    @arpanmukherjee4625 3 місяці тому +6

    I love this guy seriously. Very powerful insights.

  • @manishmundra7303
    @manishmundra7303 3 місяці тому +20

    No doubt this is a gem talk..
    Though I feel slides could be done much better with the kind of content talk had.. Still learned a lot & cheers to this great talk!!

  • @Dipesh_Sol
    @Dipesh_Sol 2 місяці тому +2

    At 37:27, not just the speed of computation, but also the egress cost of transferring all that unnecessary data over the wire to your server from database to perform reduce type computations which can simply be done on the database layer itself.
    And if you find yourself querying such data frequently, then you can have materialised views for it, making it even faster. Finally, if your use case doesn't require the most latest data and is fine with eventual consistency, then you can add a caching layer in front of it, making it blazing fast.

  • @parasharp28
    @parasharp28 2 місяці тому +5

    It all felt like an interesting discussion, but I couldn't understand (won't say I couldn't digest) a few things he mentioned such as - copying terabytes of data and restarting the server under 1 min, letting the database do most of the calculative work, no replica sets (how about contingency planning) and in a way portraying Postgres as an 'all weather database'......seems like a wake up call for myself.....

  • @j2klegend
    @j2klegend Місяць тому +1

    Ahh TBs of data with 16 core 32 GB setup!! Me looking back at my days at startup where a 300 GB DB was running on a Out of support PSQL with 16 core 32 GB server. Literally any moderate bulk record operation would light up all 16 cores to 99.9%!! I even increased PG max number of connections after modifying Linux sysctl defaults!!
    Since developers were so adamant on writing everything Sync and poetic queries (it gets creative as they type). No one other than me suspected these Sync APIs, bad queries and garbage tables. No wonder my questions were not answered in DBStackExchange but all were double checking the DB size and Spec again and again 😅
    Note: I was not a DBA, may be thats why our Eng team never took my points seriously. Thankful to all those learning experience though. Here I am hearing valuable points from experts.

  • @TheBrahmadath
    @TheBrahmadath 2 місяці тому +13

    So finally found the responsible guy for the recent backend glitch..

  • @sakshisingh-ue4nr
    @sakshisingh-ue4nr Місяць тому

    video full of real time challenges and the power of postgres

  • @ravishmahajan9314
    @ravishmahajan9314 3 місяці тому +7

    Only hardcore techies or IT professionals will find this video a Gem💎 .
    Well in the era of the Graph database, MongoDB, NOSQL etc. the legend in the video is talking basically about SQL database.😂 ❤
    Yes he is definitely correct. With Oracle as an enterprise paid database, we have the king of open source database called Postgres, a boon for startups.
    I am really surprised, zerodha with millions of customers uses Postgres..... ❤
    I thought they were using some high tech AWS virtual nosql databases 😂

  • @shivamurugan_office2733
    @shivamurugan_office2733 7 днів тому

    Thanks for the presentation. Appreciate it

  • @mukulhowale3414
    @mukulhowale3414 2 місяці тому +3

    What about durability? what if the db instance goes down? He mentioned they use a single node db without replication. How does that work?

  • @souravhazari6725
    @souravhazari6725 Місяць тому +3

    It's fifteen past seven in the morning. Just found this video, have been following zeroda's journey for quite a long time.
    The purpose of this comment is, tried to find a single video where a production grade live application auth has shared their journey on postgresql. And finally found it.
    Left job, it's been 8 months. Single handedly writing the db [pg] for my dream project. All the insights shared in this video, I don't know how much thankful I am for this.
    The journey is too relatable! Kuddos to the team.

  • @SayantanHack
    @SayantanHack 2 місяці тому

    craazzy setup man 25:00 so minimal and simple.

  • @WaseemAshraf
    @WaseemAshraf 3 місяці тому +6

    I don't agree with offloading all of the computations to the database. Yes some computations are good on the database side, but if you are doing some heavy computation that should be on the app side. The benefit of that is you can have multiple backend machines and single database. Using loadbalancer and multiple workers is very easy for backend as compared to having multiple databases.

    • @srikanth1281
      @srikanth1281 3 місяці тому +1

      Agree, suffered a lot with my analytics platform (mongo) only because we offloaded queries to db. This is even after good amount of denormalisation, huge data means aggregation are consume all the resources.

    • @RakeshWaghela
      @RakeshWaghela 2 дні тому

      I agree with the approach where some computation could offload outside the database.
      The only downside is developer friction, earlier one was able to write queries directly in SQL.
      Whereas now one has to take care of doing it outside the database in some other way.
      Luckily new age tools like DuckDB help us do that effortlessly.

  • @hemanthaugust7217
    @hemanthaugust7217 Місяць тому +1

    single db to store all the transactions placed on kite in real-time (easily 1M/Sec)... this is possible only if you have extremely high end machine and there is no fault-tolerance in this.
    If ur db goes down, it would take a few mins to bring it up.
    It's also too operational haeavy in nature..every night switching disks (though automated) ...seems like a college project.
    singe point of failure, heavy on ops :(

  • @shortandshine8279
    @shortandshine8279 Місяць тому

    Very good open talk by the zerodha presenter...

  • @ketansarode74
    @ketansarode74 День тому

    Awesome!!

  • @pankajkaushik7744
    @pankajkaushik7744 5 днів тому

    looks at his eyes... so much thinking going on..

  • @an_other_world
    @an_other_world 2 місяці тому +3

    frequent code rewrites === frequent down times (if the code changes do not have sufficient coverage and are not properly tested by QA)

  • @anantmishra6783
    @anantmishra6783 3 місяці тому +4

    hahaha ..good one! Very valid points were made!! x)

  • @varunyadav85
    @varunyadav85 4 дні тому

    Oracle u didn't mentioned, pg is open source that's why used

  • @VIKASJAIN-no5wt
    @VIKASJAIN-no5wt 2 місяці тому +5

    Hope Kamath brothers are paying you well..

  • @nabhamg
    @nabhamg 2 місяці тому +1

    Super interesting :) more such insights tech talks🙌

  • @itshgirish
    @itshgirish 3 місяці тому +13

    am i missing something here? Able to bring up db 15-20 TB of fresh copy from S3 in < 2 mins!

  • @abhishekbhardwaj563
    @abhishekbhardwaj563 3 місяці тому +2

    I have always found simple dumb solutions to be the best solution that lasts long without any crash.

  • @Stacy-od8qq
    @Stacy-od8qq 2 місяці тому +1

    One doubt here, Redis is a NOSQL database. And from the lecture i get that Redis is used as the caching layer. And when Queries hit from Sqljobber, it checkes whether it is in the caching layer or not. If not, it goes to the primary DB (PostgreSQL).
    How are the queries checked between NOSQL and SQL databases?

    • @abysebastian9708
      @abysebastian9708 27 днів тому +1

      From what I understood, what he said is
      They have one primary postgres db and another postgres db used as a cacheing layer or db.
      When a query executs, it looks on this cacheing postgres db and if data is not found there then it looks on the primary db.
      But they do use redis for other services cacheing.

  • @nikhilkartha
    @nikhilkartha 2 місяці тому

    Understanding this is as exciting as watching paint dry.

  • @rushivachhani8615
    @rushivachhani8615 Місяць тому

    What's on the sealing? Still learned a lot & cheers to this great talk!!

  • @BhagyashreeJha-h1v
    @BhagyashreeJha-h1v 2 місяці тому

    Boring is good for you. Thanks for sharing the knowledge.

  • @minimilitiapro6528
    @minimilitiapro6528 2 місяці тому

    Great talk , got to learn a lot from this video 😍

  • @AlfredDavid-k9f
    @AlfredDavid-k9f 2 місяці тому

    Do they implement CQRS ?? not clear ; what kind of postgres scaling ?; Any SOR layer - System of record; what ORM ??; some high level banter about postgres DB tuning with no specifics; Query optimization no specicifs

  • @InvincibleMan99
    @InvincibleMan99 9 днів тому

    Do they invest via Zerodha?

  • @kparag01
    @kparag01 2 місяці тому +1

    He wants to keep talking light but the audience is damn serious

  • @viputdBeast
    @viputdBeast 2 місяці тому +1

    Atleast mention the speaker name in video title or in the description

  • @ganeshbabu8263
    @ganeshbabu8263 3 місяці тому +10

    I feel dumb

  • @Anonymous-im2dy
    @Anonymous-im2dy 3 місяці тому +5

    1:42 why there is small laugh on mongodb 😂

    • @VarunKeshav
      @VarunKeshav 2 місяці тому

      Yeah WTF

    • @VarunKeshav
      @VarunKeshav 2 місяці тому

      That one slide of how do we manage big data pretty much throws light on points where MongoDB shines. Maybe they had a poor experience and wrote it off.

    • @shantanukulkarni8883
      @shantanukulkarni8883 2 місяці тому +1

      I guess nosql ism't really suited for a very structured thing like a stock broker database. Others he mentioned like Mysql, Cockroachdb are SQL. It's kind of just like an experimental thing. But maybe he just remembered something funny about it.

    • @VinayKumarcs127
      @VinayKumarcs127 2 місяці тому

      Hahaha same feeling

  • @sarbajitnandy9291
    @sarbajitnandy9291 2 місяці тому

    Where does this kind of tech conferences happens?

  • @ChristieDsouza
    @ChristieDsouza 2 місяці тому

    this is gold !☺

  • @nikunjmmistry
    @nikunjmmistry 2 місяці тому

    This is good, are these conferences invite only?

  • @animalempire5513
    @animalempire5513 3 місяці тому +1

    That's good to know😊

  • @TesthelloUser2
    @TesthelloUser2 3 місяці тому +1

    Thank you for the video....

  • @ans_human
    @ans_human 2 місяці тому

    Can you share the RCAs on recent failures on the kite platform

  • @hemanthaugust7217
    @hemanthaugust7217 Місяць тому +3

    22:00 15tb of S3 file loaded into PG in 2mins !! Don't lie.
    U don't have slave/replicas.
    U don't load balance. U have a PG on top of another PG as caching? Why man? Why can't you use memcache or redis for this? These will be much faster.
    There is scope for a lot more improvement in the architecture.

  • @deva8496
    @deva8496 2 місяці тому

    Sorry you are not Robinhood of India in trading. Robinhood offers research and lot of reasearch and recommendations with lot of features. But you are one of best discount broker to save money of swing traders

    • @thiccboi6211
      @thiccboi6211 2 місяці тому

      It was a simple comparison for understanding the product and its domain. Its not an official statement of the company

  • @ShaileshGuptaKoolwallost
    @ShaileshGuptaKoolwallost 2 місяці тому +3

    DB backup, restoring everyday. postgres as caching layer - it seems like they just want to rely on one thing only which is absurd. Seems like they are trying to find solution to problem which shouldn't have been problem as such. Totally absurd, they are ok with everything running, donot want to do things at higher scale. How can you be ok with such kind of system.

  • @YugalkishorJha-z2x
    @YugalkishorJha-z2x 2 місяці тому

    Wow

  • @velloer
    @velloer 3 місяці тому +1

    Awesome

  • @samannwaysil4412
    @samannwaysil4412 3 місяці тому +1

    so informative

  • @NIKHILVERMA-xr7lc
    @NIKHILVERMA-xr7lc 2 місяці тому

    Good lecture ⭐

  • @mrpam4672
    @mrpam4672 2 місяці тому

    Great!

  • @godisgreat1000
    @godisgreat1000 2 місяці тому

    why most of the crucial times zerodha app stock responding?

  • @cringelord511
    @cringelord511 3 місяці тому +2

    is it okay to share your applications db architecture like this?

    • @BashDroid
      @BashDroid 2 місяці тому

      yes, because he mentioned that they had made this changes by looking on the specific data that are dealing with and anybody else doing the same thing with there data won't work the same

    • @cringelord511
      @cringelord511 2 місяці тому

      @@BashDroid was this organized by zerodha or postgres?

    • @BashDroid
      @BashDroid 2 місяці тому +1

      none, it's done by the postgres community in india.. pgconf

  • @kodewithkamran
    @kodewithkamran 23 дні тому

    why that smirk at mongodb 😢

  • @yashvarshney8651
    @yashvarshney8651 3 місяці тому +9

    gold

  • @gangadharm
    @gangadharm 3 місяці тому +9

    Terabytes of data copied to a server and starting in less than a minute? Are you joking? Copying the data from S3 to your local server itself will take the time for terabytes of data. May be I am missing something here.

    • @Vikasptl07
      @Vikasptl07 3 місяці тому +5

      Now you know reason why zerodha is down every now and then. Haha.. but on lighter note i think for trading broker they should have robust backup mechanism in place, s3 to db in minute is a dream scenario but that works for them so who knows

    • @haloboy777
      @haloboy777 3 місяці тому +1

      I think they're not compressing the data. But that is way too wasteful.

    • @satyamverma
      @satyamverma 3 місяці тому

      they must be loading that 500 GB of cache data or max 1TB.

    • @v.rajasekar5044
      @v.rajasekar5044 3 місяці тому +1

      100% not possible even with newer instances with more than 100Gb of network speed. The ones with more than 200Gb of network speed requires special drivers and interfaces. Either he was bluffing or misremembering details. As they were partitioning by month, it could be possible that he is referring to restoring each DB hosting a month/s worth of data in under 2 minutes as that is possible. But data in that single server would be in the range of 1 or 2 TB and even then only with compression it is possible to do it under a minute.

  • @GagandeepSingh-op8mb
    @GagandeepSingh-op8mb 2 місяці тому +2

    Zerodha doesn't have replicas and doesn't have slaves. All they have is a sorry when their server or db crashes. People lose money, and they think replicas are not important.

  • @gyanpattnaik520
    @gyanpattnaik520 2 місяці тому

    Better if you can move to the cloud. AWS or Azure both provide great support.

  • @vaibhav-bhavsar
    @vaibhav-bhavsar 2 місяці тому

    What is his name?

  • @DK-ox7ze
    @DK-ox7ze 2 місяці тому +2

    No replica? So what happens if the DB crashes and data gets corrupted? You loose customer data!

  • @MrDasamitkumar
    @MrDasamitkumar 3 місяці тому +3

    15tb in 2 mins !!! Really?? How ??

    • @v.rajasekar5044
      @v.rajasekar5044 3 місяці тому +3

      100% not possible even with newer instances with more than 100Gb of network speed. either he was bluffing or misremembering details. As they were partitioning by month, it could be possible that he is referring to restoring each DB hosting a month/s worth of data in under 2 minutes as that is possible. But data in that single server would be in the range of 1 or 2 TB only.

    • @phoneix24886
      @phoneix24886 2 місяці тому

      When did he say that?

  • @shauryaverma8780
    @shauryaverma8780 23 дні тому

    Wondering why Zerodha crashes!

  • @sekhar4033
    @sekhar4033 2 місяці тому

    What is his name

  • @kamleshgorasiya3854
    @kamleshgorasiya3854 2 місяці тому

    Can share RCA for Issue we are facing since last two months. I am Software engineer and also Customer of Zerodha. I want to know why other broker are runing fine and zerodha not.

    • @Desh-o7b
      @Desh-o7b 2 місяці тому

      no you are not, because if you were you would've asked this question from your team.

  • @zheeshut5498
    @zheeshut5498 2 місяці тому

    The way he laughed at MongoDB😂

  • @keerthineeraj7937
    @keerthineeraj7937 2 місяці тому

    What is the name of the person speaking?

  • @phoneix24886
    @phoneix24886 2 місяці тому

    A little bit over provisioning when serving 2 million requests with an sla is better than being conservative.

  • @krishankanhaya_
    @krishankanhaya_ 2 місяці тому +2

    Caching is the answer to all of your questions in this talk 😂😂

    • @tanaygupta2009
      @tanaygupta2009 2 місяці тому

      Caching might be a very bad idea in case of Trading apps.

    • @krishankanhaya_
      @krishankanhaya_ 2 місяці тому

      @@tanaygupta2009 i may be agree but how

  • @chandranshpandey1929
    @chandranshpandey1929 3 місяці тому +2

    too much tuning these guys are doing that their app having lot of glitches every now and then

  • @rishiniranjan1746
    @rishiniranjan1746 3 місяці тому

    People say c++ is retarded/obsolete. I dont agree. How you can achieve super-performace, responsiveness, better synchronous result without using a natively driven code.

  • @battletremor
    @battletremor 2 місяці тому

    What does he mean by checkpoints of data backup? As in they dont take entire backup from the start to current? Just a fixed period of time like a month?

    • @bangalicoder863
      @bangalicoder863 2 місяці тому

      It means a delta load with a specific start point instead of a full load

  • @J0Y22
    @J0Y22 3 місяці тому +2

    damnn

  • @TeluguAbbi
    @TeluguAbbi 2 місяці тому

    31:19 Postgres Learnings

  • @Grizzler231
    @Grizzler231 2 місяці тому

    Bruh he laughed when he said mongo

  • @codingwithsam4992
    @codingwithsam4992 2 місяці тому

    I want to connect with you? What is your name?

  • @prahladb5019
    @prahladb5019 2 місяці тому

    now we understood why glitches are happening frequently in Zerodha..

  • @AyushKumar-ij2xd
    @AyushKumar-ij2xd 2 місяці тому

    overloading postgres is not helpful and dont do it specially when you have no concept of nodes . postgres servers are not free even. if you are not able to write code for sum/avg for close to same speed as postgres service then you need better engineering. Architectures become complicated when you have distribution/SOA . Either this is half knowledge served or this platform is running on hopes and dreams. And also S3 is not that fast

  • @AnanthM-y7f
    @AnanthM-y7f 2 місяці тому +1

    This is feels like a 3rd year B-tech class, not a techie presentation. The presented points can be found across multiple b-tech computer science books. May be he is not a tech person thats why he didnt gave the examples on tuning.

  • @saralk18
    @saralk18 2 місяці тому

    It works... until it doesn't

  • @ravikanth6178
    @ravikanth6178 3 місяці тому +1

    Just out of ignorance.. I think snow flake willl be a good choice? Can anyone comment

  • @harshpathak8029
    @harshpathak8029 3 місяці тому

    I think it is no longer the largest stock broker. Groww over took it since oct 2023

    • @theshashank11
      @theshashank11 3 місяці тому +4

      Groww is stupid, just because of marketing it is gaining market share

    • @yuganderkrishansingh3733
      @yuganderkrishansingh3733 3 місяці тому +1

      @@theshashank11 But that doesn't change the fact that they are the largest at present.

  • @randomvideos9541
    @randomvideos9541 3 місяці тому

    Ku6 bhi?? Pehle jo loss karwaye ho uske bare me video nikalo.

  • @TheHardikupadhyay87
    @TheHardikupadhyay87 2 місяці тому

    i watched this video in 1.5x still felt slow and boring.

  • @abhijithganesh2064
    @abhijithganesh2064 2 місяці тому

    So much talk yet no stable apps😂

  • @asif-ali
    @asif-ali 2 місяці тому

    Aaaaa.....aaaaaa.....aaaaaa......aaaaaaa..
    Amm emmm aaaaaa aaaaaa... What that.... Silly

  • @NabajyotiBorah-x7p
    @NabajyotiBorah-x7p Місяць тому

    -rm -rf the entire data >_

  • @synchronizelife1782
    @synchronizelife1782 27 днів тому

    wow, such an unconventional video & breaks a lot of myths, power to figure out stuff yourself and not do what everyone else is doing.
    but that being said, we will also have to understand that there have been outrages from Zerodha and people have lost money, i am not saying it could. be because of this very unconventional postgres setup but who knows, zerodah def doesn't have 99.99 uptime

  • @chetanesque158
    @chetanesque158 Місяць тому

    Did someone punch you in your chest before you spoke?!
    Awkward!

  • @premsaivittal2030
    @premsaivittal2030 2 місяці тому

    What's his name ?