Shared Database Pattern in Microservices

Ғылым және технология

System Design for SDE-2 and above: arpitbhayani.me/masterclass
System Design for Beginners: arpitbhayani.me/sys-design
Redis Internals: arpitbhayani.me/redis
Build Your Own Redis / DNS / BitTorrent / SQLite - with CodeCrafters.
Sign up and get 40% off - app.codecrafters.io/join?via=...
In the video, I discussed the concept of microservices communicating through a shared database pattern. This approach simplifies communication by allowing services to directly access the database, eliminating the need for a middleman API server. While sharing a database offers advantages like quick development and better performance, it also presents challenges such as exposing internal details to external parties, potential data corruption, and shared business logic. Despite these challenges, using a shared database can be suitable for quick solutions in small and lean teams requiring speed and agility.
Recommended videos and playlists
If you liked this video, you will find the following videos and playlists helpful
System Design: • PostgreSQL connection ...
Designing Microservices: • Advantages of adopting...
Database Engineering: • How nested loop, hash,...
Concurrency In-depth: • How to write efficient...
Research paper dissections: • The Google File System...
Outage Dissections: • Dissecting GitHub Outa...
Hash Table Internals: • Internal Structure of ...
Bittorrent Internals: • Introduction to BitTor...
Things you will find amusing
Knowledge Base: arpitbhayani.me/knowledge-base
Bookshelf: arpitbhayani.me/bookshelf
Papershelf: arpitbhayani.me/papershelf
Other socials
I keep writing and sharing my practical experience and learnings every day, so if you resonate then follow along. I keep it no fluff.
LinkedIn: / arpitbhayani
Twitter: / arpit_bhayani
Weekly Newsletter: arpit.substack.com
Thank you for watching and supporting! it means a ton.
I am on a mission to bring out the best engineering stories from around the world and make you all fall in
love with engineering. If you resonate with this then follow along, I always keep it no-fluff.

Пікірлер: 42

  • @kalpeshmali8498
    @kalpeshmali84985 ай бұрын

    One thing which is very very underrated sir is that u explain every thing with ur handwritten notes and for that i appreciate you alot thank you arpit sir :)

  • @AsliEngineering

    @AsliEngineering

    5 ай бұрын

    Thank you for noticing. I do that because my college professor used to say that when you read from handwritten notes (books, slides, etc) our brains are more likely to retain. He taught us artificial neural network and he has a deep understanding of how the brain works.

  • @utsavanand5558
    @utsavanand5558 Жыл бұрын

    Great content, helped in taking decisions. Thank you.

  • @adamrizk6735
    @adamrizk6735 Жыл бұрын

    Awesome video, thank you

  • @kushalkamra3803
    @kushalkamra3803 Жыл бұрын

    Thanks Arpit 🙏

  • @school_of_life
    @school_of_life2 жыл бұрын

    well explained.

  • @subee128
    @subee12814 күн бұрын

    Thanks

  • @d4devotion
    @d4devotion2 жыл бұрын

    You earned my subscription because of this video.

  • @AsliEngineering

    @AsliEngineering

    2 жыл бұрын

    Thank you so much 😃

  • @richuthomas8530
    @richuthomas85302 жыл бұрын

    Hi Arpit Great Content Can you make video on how to communicate between different services and the protocol to use like grpc/protocol buffers when to use what ?

  • @AsliEngineering

    @AsliEngineering

    2 жыл бұрын

    Soon 😃

  • @matrixtoogood5601
    @matrixtoogood56012 жыл бұрын

    I love your videos!

  • @AsliEngineering

    @AsliEngineering

    2 жыл бұрын

    Thanks a ton 🙌

  • @EvolvingCoder
    @EvolvingCoder19 күн бұрын

    Is it possible to get your handwritten quotes used in every video? Will save a lot of time for all of us because learners most probably would be writing it again as we used to do it in colleges?

  • @microtech2448
    @microtech2448 Жыл бұрын

    There are always pros and cons of everything. It all depends on what is cost efficient and what development team is comfortable with?

  • @akashshirale1927
    @akashshirale19272 жыл бұрын

    Nice video. Can you make a video to explain load balancer in detail

  • @AsliEngineering

    @AsliEngineering

    2 жыл бұрын

    That is part of my course so cannot put it imon KZread. Sorry

  • @jivanmainali1742
    @jivanmainali17422 жыл бұрын

    So in case of sharing database do services still communicate with each other ?

  • @AsliEngineering

    @AsliEngineering

    2 жыл бұрын

    When services share a database does not mean they might not synchronously communicate. Two services may choose to share a db while talking HTTP for some complex logic.

  • @jivanmainali1742

    @jivanmainali1742

    2 жыл бұрын

    @@AsliEngineering Thanks for reply but got so many question on microservice . When seperate database is assigned to each service then to get account for let say for order table userId,do we need to make network call to account service for this ?And does each service have sinlge table only ?

  • @vatsalhirpara8631
    @vatsalhirpara86312 жыл бұрын

    Hey Arpit Could you please share notes shown on videos as pdf and also put link in the description. Great channel btw!

  • @AsliEngineering

    @AsliEngineering

    2 жыл бұрын

    There on my website arpitbhayani.me

  • @vatsalhirpara8631

    @vatsalhirpara8631

    2 жыл бұрын

    @@AsliEngineering Thanks! Found it.

  • @vasavigajarla654

    @vasavigajarla654

    5 ай бұрын

    hey @@vatsalhirpara8631 , could you please share a link? I couldn't find the notes on the website.

  • @anupamkumar2232
    @anupamkumar2232 Жыл бұрын

    Rather than giving direct access to db, we can write a dao layer on top of it and share that across multiple micro services as a library. That way if underlying schema is getting changed or whole db itself is getting changed, change needs to be done at the library which'll still provide the same contract and consumers can just upgrade the version.

  • @theSDE2
    @theSDE22 жыл бұрын

    Aprit sir please share notes as well.

  • @AsliEngineering

    @AsliEngineering

    2 жыл бұрын

    They are shared on LinkedIn and Twitter. Yet to automate it on the video. Give me some time to streamline it.

  • @savi_sandbox
    @savi_sandbox5 ай бұрын

    Can you please share the all the notes you used in microservices playlist in pdf format please.

  • @AsliEngineering

    @AsliEngineering

    5 ай бұрын

    I lost all those notes. There was no backup.

  • @savi_sandbox

    @savi_sandbox

    5 ай бұрын

    @@AsliEngineering Okay :(

  • @vaibhavkumargautam
    @vaibhavkumargautam Жыл бұрын

    Will any FAANG company call me for interview if i do your program?

  • @AsliEngineering

    @AsliEngineering

    Жыл бұрын

    There is no placement support. I am here to teach real engineering and help you become better engineer.

  • @vaibhavkumargautam

    @vaibhavkumargautam

    Жыл бұрын

    @@AsliEngineering ok. That I understand. Let me rephrase my questions. You are a staff engineer. Do you shortlist based on courses(yours or similar) a candidate did? Or will I get more opportunities to work with good companies? Upscaling your skills and getting a good opportunity is different. If I am willing to spend money and I also want to know how I can show these skills in my resume. And how can I prove to myself I am better than others? I hope, I get insight from your side and some guidance before buying this course.

  • @AsliEngineering

    @AsliEngineering

    Жыл бұрын

    @@vaibhavkumargautam course will hep you become better engineer and companies will test your skills during interviews. Just because you did a course does not mean you’ll get a certain set of opportunities.

  • @vaibhavkumargautam

    @vaibhavkumargautam

    Жыл бұрын

    ​@@AsliEngineering I believe getting interview call is big task even for experienced. In short, there is guaranteed that even if I choose your over others it hardly give me benefits in terms of opportunity(Interview calls). Hope I am correct. Thanks for your reply.

  • @shuaibpantnagar
    @shuaibpantnagar2 жыл бұрын

    All things can be true if database is shared within domain, not outside of domain.Assume I work in client domain of an application and try to update database of schedule domain of same application. It will be fairly wrong. You need to first read about Domain Driven Design first.

  • @AsliEngineering

    @AsliEngineering

    2 жыл бұрын

    Not true in real world. You might want to share the database across domains as well. There are cases where sharing a database is a wiser option vs communicating via API.

  • @shuaibpantnagar

    @shuaibpantnagar

    2 жыл бұрын

    I commented from my real time and micro service architecture experience. It is best practice followed by industry. DDD concept does exist henceforth.

  • @AsliEngineering

    @AsliEngineering

    2 жыл бұрын

    Never denied the existence of DDD but there are situations where you need to share databases for performance. Example: iterating through millions of followers to broadcast notification. Doing this via API is too slow and hence the notification service will have to directly query the database holding the followers information.

  • @shuaibpantnagar

    @shuaibpantnagar

    2 жыл бұрын

    ​@@AsliEngineering If you iterate over database to get clients'(in million) info, you will have very very high latency in the system. Notification service should have info passed from caller and notification service has to publish the message. Otherwise there will strong coupling. Any way, it is your choice to listen. , can not argue further.

  • @f135ta
    @f135ta10 ай бұрын

    DO NOT SHARE DATABASES in microservices. This is horrendous advice

  • @JudgeFredd
    @JudgeFredd10 ай бұрын

    I don't understand your speech