r/SQL • u/Wooden-News-962 • 2d ago
Discussion Why you shouldn't do application-level sharding
https://planetscale.com/blog/why-you-shouldnt-do-app-level-sharding
34
Upvotes
r/SQL • u/Wooden-News-962 • 2d ago
8
u/HobartTasmania 1d ago
Well given that most servers run SAS drives (both SSD's and HDD's) and use SAS cards with expanders then I have to ask this question. How big is the data before it can't easily fit on a single server? Are we talking multiple petabytes here?
9
u/Little_Kitty 1d ago
Reading through this I kept going WTF at the 'normally people try this' stuff
I'm shocked to learn that a customer may put two items in their cart and those might not be from the same seller... even more shocked to learn that the buyer and seller may not live on the same shard! The whole thing really smacks of a failure to design and trying to work around that with increasingly complex solutions. Some requirements, such as order_id > user_id could be in a source suited for worm fast lookups, if you're going to shard things, the considerations are can it scale more (duh) and what are the sources of inter-shard chatter.
The language here is technical enough that it's clearly targeting that audience, but the raw solutions proposed would have anyone that capable facepalming long before it ever reached production. If you find a company that acts like this it's more of a yes man problem than a technical one.
Also, if properly set up and with read loads only hitting replicas and a chunky server, the scale you'd have to be operating at to hit these problems is truly immense. A queuing system with batched writes and an id system which isn't crazy would solve most of the intermediate issues flagged here.
13
u/hot_sizzler 1d ago
I think any sharting in general is a risky move
1
u/sreekanth850 1d ago
Why do they doesn't think of tenant based shards? is it one of the easier part to implement with a router?
1
u/momsSpaghettiIsReady 1d ago
Why would anyone do this at the application level as the first option? Unless extremely time crunched, building a monolithic application in a way that modules can be sliced off into their own application/database seems like the more reasonable approach. Then you can pick what ever datastore makes sense for the access patterns.
Realistically if applications are scaling this quickly you probably have a good sized team of devs and will run into issues scaling work at the same time, so split off some microservices.