Thanks for the excellent content. I've summarized this for my own understanding. Before you Shard, try the following first 0. Understand what your actual problem is before optimizing(too slow reads vs too slow writes) Analyze your slowest queriers and see why its slow: kzbin.info/www/bejne/Y6KxhIuBbNhqldk Create indexes on appropriate columns and tune your data schema. 1. Horizontal Partitioning - Have partition key(mostly on primary key) and split database into different ranges. This will create smaller B-trees on the indexes. 2. Vertical Partitioning - When you have columns that you rarely access, and you cut a column out of the main database. This will make reads faster for frequent queries and slower for not frequent queries and make your B-trees smaller(less space in memory also) Partitioning Video: kzbin.info/www/bejne/h3KVZpaDjNVsis0 ----
@siddhantdeshmukh71203 жыл бұрын
Thanks : )
@大盗江南3 жыл бұрын
Thanks man!
@1o11o113 жыл бұрын
thanks! saved to notes
@fakrul74833 жыл бұрын
Thanks dude
@arsenalism2 жыл бұрын
Appreciated it
@gregt0m3 жыл бұрын
Hussein, you have a great style of presentation with proper tone, cadence, painting pictures without use of displays, and humor thrown in the right places. All this with no sense of arrogance exuded. Love your videos.
@dipunjgupta80823 жыл бұрын
Most underrated channel on youtube. Sometimes I get bored from work and I come here to learn something interesting. You don't even know how much your videos mean to me. Thanks a lot Hussein! I am gonna use social distancing analogy a lot from now on 😂
@abdelrahmanshehata79422 жыл бұрын
You are such a genius !!! You started by answering the question very early in the video, I like it. Then you started explaining everything very nicely !!! Perfect !!! Go on maaaaaaan
@hnasr2 жыл бұрын
Im Glad to you liked it! بالتوفيق
@zorsen1173 жыл бұрын
16:11 do you really want to do this with you life? I don't know man, I should have been a cook or something.
@dejangegic3 жыл бұрын
@Jamison Grotzinger I will kindly ask you to fuck off
@varatharajandhamotharan15113 жыл бұрын
I would say under rated channel. He is not teaching but he is discussing in a very informative way
@mramakrushnaYT3 жыл бұрын
That's wonderfull Hussein, Understanding the Why before going for a specific tech..
@hnasr3 жыл бұрын
Thanks Rama!
@adityajoardar5783 жыл бұрын
This channel is addictive
@tahoemph2 жыл бұрын
One thing you don't mention which is important to understand is that read replicas cause some load on your primary for replication. Much like anything else, as you said, it isn't free. But it is fairly cheap. One use case you missed for sharding is data sovereignty. Sometimes data can be split into groups by location (e.g. zip country code) which not only can help with performance but can meet legal requirements for where data lives.
@ganeshkhirwadkar41273 жыл бұрын
Being a non-backend developer I still think atleast while watching your videos that I am a one of them !!! Superb and Easy Explaination
@hnasr3 жыл бұрын
❤️ thanks Ganesh!
@rodrigocaballerohurtado53673 жыл бұрын
Hussein: You cannot longer perform transactions with sharding Me: thanks captain, that's it for me on the subject
@banxt7 ай бұрын
“Predictably Irrational” is a very good book! :-p
@section99994 жыл бұрын
Wow a whole ton of good stuff here. Props to you good sir!
@hnasr4 жыл бұрын
DataSurgeon 369 😊🙏 enjoy thanks for your comment
@karthikeyansrinivasan524 жыл бұрын
Another fantastic video from this great guy to start an another beautiful day!!!
@punerealestatebuilder2 жыл бұрын
I saw many videos but the way you explained horizontal/ vertical partitioning in just 30 sec is going to be with me foreever
@sundeepdharma4 жыл бұрын
Sharding is not really needed as you mentioned we can go for partitioning and local indexes within the partitions itself. What if writes are more there are various options in enterprise products, I worked long back with Oracle RAC setup with vplex managing the data storage for different nodes. Avoid writing component logging or audit trail logging to RDBMS instead write to nosql. I personally think only business data (OLTP) should be there in RDBMS all others can go log database (nosql) or splunk or datadog etc...
@ahsaanali45122 жыл бұрын
I really love to watch your videos even though those topics are not the part of the my job but I watch it because I know I'll definitely learn something new. So keep updating us and keep uploading, appreciable.
@vnaveenkumar9823 жыл бұрын
The best content on the internet with a crazy presentation skills. it was wonderful Hussein.
@natem8893 жыл бұрын
Loved the way you explained. After a long time, I listened to some video for the whole duration.
@pradeepgupta46478 ай бұрын
My search ends here, to clear my doubt thank you.
@libranpal3 жыл бұрын
Just to be clear, you don't sacrifice the transactional capability per se; you can't do it across shards but if the sharding is designed to keep every shard with no client depedency on the other shards, the transactional capability isn't lost. You may want to think of it for any cloud company where the database sharding is done per tenant and every tenant has private data. Says shards are created on a range of tenant names (say a-c for shard1, d-e for shard2 etc) , you aren't going to loose any capabilities here.
@101kawsar2 жыл бұрын
My man often mentions Django, I love it :)
@АйбарЖоламанов Жыл бұрын
Great video! I respect that you mentioned go
@nadertarek48222 жыл бұрын
When I find this DENSE content really enjoyable just like I'm watching Netflix, that does mean one thing you are really GREAT!!!, Thank you so much Hussein
@abhileo1726 күн бұрын
made it so easy! awesome
@hrayrpetrosyan53302 жыл бұрын
Thank you so much, Hussein! You're doing such a good job.
@cloud58874 жыл бұрын
Lol I love the way you explain stuff. Subscribed!
@sanjaybhatikar2 жыл бұрын
THOU SHALT NOT over-engineer too early. I am definitely putting that up on my wall :)
@kapilrbagul4 жыл бұрын
Excellent one... just wanted to know your approach to be on top of latest technology. Which resources do you use? Which technology podcast do you listen? Can you make video on this topic? 😊
@abhay626Ай бұрын
Amazing, thanks Hussein!
@robertkozik48453 жыл бұрын
Just pointing this out: You can overwhelm a MySQL server's IO capacity very quickly with php-fpm at scale. Because each request spins up its own database connection, so unless you're throwing their write requests into a message queue then bulk inserting it's contents via some stateful service each connection = at least 1 IO event. And if you're co-locating odds are you don't want to set your io_capacity parameter above 2000 IOPS because of SSD burnout, and for php-fpm's concurrency model(or lack thereof) it's not hard to hit that threshold at even a small scale. Typically php-fpm sites of scale you'll see 30-50k IOPS, so even a cloud-based solution would be cost prohibitive. Not trying to be a jerk or anything because this requires a lot of specific knowledge of a particular programming language's execution model. But having said that, it's totally possible to overwhelm IO without a few million daily page views. Since you gotta keep in mind 80% of the traffic hits in 20% of the day. That's also basically the mark when Web 2.0 companies of yesteryear started sharding their LAMP apps.
@ethanj15332 жыл бұрын
So just don’t use fpm?
@WeiLiuhaha2 жыл бұрын
It's such a pleasure to watch! Fun and knowledgeable!
@ssksarraju3 жыл бұрын
Great video. Love the way you explain the things. I wish you had elaborated little more or probably make a new video on why transactions are tough with sharding.
@hnasr3 жыл бұрын
Correct that would require another video because its a deep topic , thanks for your comment ❤️
@stephennjuguna37933 жыл бұрын
Just Wow! Learning so much from you Hussein
@Wherrimy3 жыл бұрын
Thanks, Ill stick with sharting
@bashashaikabdul2 жыл бұрын
Great explanation
@EzequielRegaldo3 жыл бұрын
Thats why i love mongo db, sharding Is a breeze but can be better with relations, i want it, i need ir. Mongo router rocks
@RAYGUNWOD4 жыл бұрын
Fantastic video - thank you so much Hussein!
@krisna443 жыл бұрын
Your presentation is excellent
@judylee94523 жыл бұрын
You are amazing . You are so wise. Thank u.
@ReyAlexam3 жыл бұрын
I learned a lot by this. Thank you
@AubrieKarvis6 күн бұрын
Thanks for the breakdown! 🤔 I have a quick question: 🤷♂️ I have a set of words 🤷♂️. (behave today finger ski upon boy assault summer exhaust beauty stereo over). Can someone explain what this is? 😅
@tarekali70644 жыл бұрын
Great videos! Thank you for making them!
@hnasr4 жыл бұрын
Thanks Tarik!
@abhishekt8002 жыл бұрын
loved it..thanks for the explanation
@sanjaybhatikar2 жыл бұрын
Beautiful, thank you :)
@donlywaybv3 жыл бұрын
I'm your subscriber :D
@Euquila3 жыл бұрын
sharding is like sharting, unpleasant but sometimes necessary
@mustafaalmulla3 жыл бұрын
FYI, MongoDB have ACID transaction support with sharding
@thulasipb1233 жыл бұрын
Excellent video. Thank you
@coding34383 жыл бұрын
It’s difficult to focus when the only thing I can’t take my eyes off is the silver ps2
@omose142 жыл бұрын
Awesome bro!
@pavelkravchenko28103 жыл бұрын
Why logic on client? You can make service that deals with this requests from client and send them to the right dB server? Or I don't understand something?
@crabjuice473 жыл бұрын
Bro you are fucking brilliant and that you are willing to teach others what you know in such a good engaging way I love it. God Bless you even if you don't believe in God or not. :)
@desiaclementslewis83183 жыл бұрын
thank you
@sahersalamh90323 жыл бұрын
Amazing video, please make an arabic channel, we are missing this content here dude.
@shaheerzaman6204 жыл бұрын
Great video Hussein. Can you please make a video on indexing and Acid transactions? That would be great! Thanks.
@hnasr4 жыл бұрын
shaheer zaman thanks Shaheer! Check out my ACID video here Relational Database ACID Transactions (Explained by Example) kzbin.info/www/bejne/pqDQqX2Fe7uWh9U .. i am still need to work on the indexing video coming soon :)
@KuriaNdungu3 жыл бұрын
Excellent content bro
@nitreall2 жыл бұрын
When exactly though? Share some numbers
@elmeroranchero3 жыл бұрын
is there any risk of outdated data if the slaves do not sync on time? how do we deal with this?
@ackrman Жыл бұрын
@14:00 is it still the case? I read that mysql supports transaction on sharding xa transactions or distributed transactions. And mysql nda cluster support acid.
@SyedHaris0073 жыл бұрын
Please make a video on Elastic search
@peop.9658 Жыл бұрын
Can you name the youtube's podcast you referred to?
@Faz13able3 жыл бұрын
Hello I have log server. There is not transaction. Its straight write and read. No update or delete will be performed. And no rollback is necessary. Problem is minimum log size is 400 GB plus which consists of raw text data only. DB size increases 40 GB per day min. So you understand there is a a lot of write in the database . Problem is there is too much write in one instance that I can not read the database. Its a MongoDB database and I searched and found I can do sharding to distribute the read write. And Mongo shard comes with tool like mongos which will distribute my query from client based on lets say timestamp. So should I proceed with this plan or should I do partition first? And also the pipeline is at development stage so if u recommend I can still change DB to postgres or other DB technology. Thanks.
@momardiouf91414 жыл бұрын
Greate content Hussen and thanks for sharing we learn a lot with you I just comme back to a previous question asked by another person in comments, he sais : "just wanted to know your approach to be on top of latest technology. Which resources do you use? Which technology podcast do you listen? Can you make video on this topic? " Can you answer to this please ? It will help us agains Thanks again for this greate content
@hnasr4 жыл бұрын
Momar Diouf thank you Momar! Appreciate you 🙏 I learn by listening to podcast, watching videos , reading and implementing the thing . I always ask why a tech exists before I ask what. I made few videos on the topic of learning check them out When Learning Backend Engineering Ask Why, not What (Minute Engineering) kzbin.info/www/bejne/bGinmJ-CrNN1irc My Preferred Method of Learning Backend Engineering Technologies kzbin.info/www/bejne/an_WiKGKlJJ5pac Learning at Home, Consistent Hashing, Empathy with Engineers and More - Software Chat kzbin.info/www/bejne/bIHVg2mJjJmEfa8 Advice for Junior backend engineers who just started their new jobs in software companies kzbin.info/www/bejne/jGSmYYmsg9d5kJo
@momardiouf91414 жыл бұрын
@@hnasr Thanks for the reply. I will check the links Thanks
@serhiihorun62983 жыл бұрын
Cool thank you!
@uwemnkereuwem62722 жыл бұрын
How about multi-master replication or bi-directional replication?
@nykid302 жыл бұрын
So this is mostly focused on SQL right?
@MohamedZiada4 жыл бұрын
always great video Hussein, thank you. Journal, logging all the traffic for website/ application, could be Database heavy write , right?
@hnasr4 жыл бұрын
Thanks Mohd! and Correct, logging is a database write heavy operation so you would choose an LSM based DB such as RocksDB or myRocks.. Check out my database engines video for more details on this topic
@zaheerkhan80972 жыл бұрын
One question I had does databases like Postgres provide facility for automatic sharding . If yes what process do they follow while doing the same
@asdfasdfasdfasdf2193 жыл бұрын
I didn't get the difference between scaling writes by region vs sharding. Is it the same but the first one is sharding by region?
@nikolakolarov14164 жыл бұрын
Great video! Are you planning to make a separated video about Vitess?
@hnasr4 жыл бұрын
Nikola Kolarov thank you! Yes I am planning to make a video on Vitess
@nikolakolarov14164 жыл бұрын
Hussein Nasser Awesome
@shivashankar_19983 жыл бұрын
Can we use timescale DB extension with postgres for faster writes ?
@DipanjalMaitra2 жыл бұрын
You are awesome. I have learned a lot from you. Thank you for being there. But I have got a little confusion at 10:41. I agree the db requestes from clients will pass through the reverse proxy but the proxy should be SQL Aware like ProxySQL but can Nginx or HAProxy be configured as SQL Aware LB?
@lionelarucy47353 жыл бұрын
Love your videos, what do you think of the 'New' SQL Databases such as CockroachDB and using them instead of complicating your life with sharding?
@hnasr3 жыл бұрын
I need to do my research of them but I do this there are use cases for them. I still don’t know what is new about them so can’t really comment
@lionelarucy47353 жыл бұрын
@@hnasr Cool, I look forward to hearing your take on them, they're what I opt for in situations where I think I'd have to shard because sharding isn't fun. I've also tried others like Citus which are pretty great but a bit more work to get the most out of.
@AbleToLiveHere4 жыл бұрын
Your videos are great. Thank you
@hnasr4 жыл бұрын
THANK you so much! appreciate it
@user9851-q9n2 жыл бұрын
why no one do with practical
@sayanchakraborty95813 жыл бұрын
Just a quick question, how is 'scale writes by region' (using multiple master nodes in multiple regions and directing requests to nodes based on some key) different from sharding?
@charan88202 жыл бұрын
As he mentioned, While sharding ACID properties will not be applicable. Now in case of keeping data in regional database you still have ACID properties and you can sync the data later.
@ayushjindal49812 жыл бұрын
Hi Nasser, For a system like Uber Eats , I believe we can split our Users, Orders, Restaurant, Dishes tables based on location. Now the question is shall we choose sql or nosql here? We generally go for noSQL because it avoid joins which can be costly in sharded DB, but if we maintain our tables on basis of location then there wont be any such case where we will join from table in another DB. So, which one shall we use???
@OfferoC3 жыл бұрын
Why do you prefer relational?
@hnasr3 жыл бұрын
I personally didn’t run into a problem it couldn’t solve.
@venkateshkadali11373 жыл бұрын
Can we add a reverse proxy in between all our application servers and Sharded databases which handles all the routing logic? In this way, we can also avoid duplicate code in multiple application servers.
@hnasr3 жыл бұрын
Yup! You are describing how Vitess was built and how many other apps before it. Good thinking 👍
@ajaynair33664 жыл бұрын
Do you have numbers that denote when a database is ready for partitioning, sharding etc?
@user-bk5xo1gj7k10 ай бұрын
there are no numbers i'm afraid. you have to know your system well enough to realize the problem and analyze what solution suits you best. for example, if you are working with sensitive data, that you are legally bound to keep in certain locations, then you need sharding for that if you wanna expand to different regions. one of the reasons numbers do not work is the nature of data itself. a table with 2 columns and 50 columns are going to have different query times. then it depends on the query itself. Also the technology you are working on etc. so there are simply too many variables to have a standard. I can tell you from experience, there was one system i was working on where we had around 200 mill rows in a single table. we didnt need any sort of partitions there. On the other hand, i had a separate system, a little bit older tech as well, but data was vastly different. things came to a point where we needed partitions at 30 mill rows. index didnt cut it anymore. the point is, it has to be determined for each system. we can have some guesses, but it wont be concrete. I hope this makes sense :)
@mohamedmamdouh21222 жыл бұрын
All your Research a Round How to Build Something Big and Free , I Don't Imagine If Some One Like You Try To Build Some Thing Like That How It Will Look Like , And I wonder Did You Build It Yet , And If Some One Did What Should Do If He Don't Have A Financial Back Up
@GoddamnAxl3 жыл бұрын
...Or use new-sql databases like cockroach from the start
@evans82454 жыл бұрын
has anyone's database shard its pants, nope ? well ok just me then..
@hnasr4 жыл бұрын
DELT 😂😂
@r3jk83 жыл бұрын
answer is never! :) First, you login to GCP console. Second, activate cloud spanner. Third, delete the word shard from your brain.
@fxstreamer2383 жыл бұрын
let me be honest the reason you dont get much views is your face its so awkward to watch your close face for 20 minutes what is this i cant even watch this rant which is boring af even with speed X2
@UnaliverOfChildren6 ай бұрын
Remember, when you are confused and you dont know why its slow, always start with distributed caching
@minhthinhhuynhle91032 жыл бұрын
is Replication increase reading capacity via Load balancing mechanism ??? Since I stackoverflow all months and cannot found any appropriate article about this. Even MongoDB Legacy Docs did not mention reading load balancing 😢
@andreigatej67044 жыл бұрын
Great content! Thank you! Do you have any particular resources for learning BE concepts? (except for a job :D)
@viraj_singh Жыл бұрын
so my takeaway is sharding is for scaling write queries (which is rare) partition is for scaling read queries
@kapssul4 жыл бұрын
Could you make a video about the 5G impact on (Cross-Shard Queries) knowing that 5G Latency is below 1 milliseconds.. 1 - Could that bring sharding and cloud computing to the next level ? 2 - What will happen to data centers infrastructure, and also to database query languages in the future ? 3 - Will that reduce the data management cost for business owners ?
@hnasr4 жыл бұрын
What amazing thoughts provoking questions Kapssul! Love them. That is going to take some time to research and answer because I have no idea. 5G is indeed a revolutionary tech and it will spin up the software engineering tech on its head.. thanks!!
@kapssul4 жыл бұрын
@@hnasr I am on the way, you are already there.. you could grab the information quickly and more accurately, and share with us bit by bit your thoughts.. keep posting.. thanks for that quality content.. we learn a lot..
@harshitbajpai49423 жыл бұрын
The content is excellent for learning, really clears lots of stuff. But if anyone watching this video has an interview lined up(which is most probably true), don't explain in this fashion the strategy you choose to justify the problem you would be solving.
@dotcore1150 Жыл бұрын
Plz do something practical 🎉
@neeravarora5304 жыл бұрын
Awesome video Hussein , everytime i learn something new from your videos . Thanks for sharing your knowledge.
@hnasr4 жыл бұрын
I am glad you are! Thanks for your comment
@aashishgoyal14364 жыл бұрын
Thanks a lot Hussein. Really nice and engaging video with awesome explaination You deserve more views Gonna share it with my peers.cheers
@hnasr4 жыл бұрын
Aashish Goyal thank you 🙏
@uchennanwanyanwu27774 жыл бұрын
0:21 ...complicating your life with sharding...very funny.
@yashverma70842 жыл бұрын
next time please make a presentation it is better that way.
@devendranarayan97483 жыл бұрын
Sometimes you sound like Gru 😂 Great content.
@MarcMcRae4 жыл бұрын
Very good background knowledge leading into the sharding explanation. Nicely explained. Thank you!