Re:Scaling Datastores at Slack with Vitess
by vp8989 on Sunday December 06, 2020 @11:51AM
(#25324649)
It looks like Azure has now integrated Citus into it's Postgres offering, but Im curious why AWS hasn't integrated either Vitess or Citus at all?
It seems like a well executed combination of Vitess/Citus + read replicas pointing to decoupled page storage would result in a fully featured non-proprietary database that scales all the way down to your laptop and all the way up to the heaviest OLTP use cases. If that existed, only truly masochistic people would continue using things like DynamoDB.
Re:Scaling Datastores at Slack with Vitess
by carlineng on Sunday December 06, 2020 @04:42PM
(#25326934)
Citus was acquired by MSFT in 2019, hence the integration. Vitess is primarily a MySQL-based solution, and I imagine that AWS would rather have its customers on Postgres-flavored DBs, given that MySQL is currently owned by Oracle.
Re:Scaling Datastores at Slack with Vitess
by vp8989 on Monday December 07, 2020 @02:39PM
(#25336217)
The Citus extension is still open-source though, right? Although I think it was a solid strategic move by MSFT to acquihire the Citus devs (probably all these people were given substantial golden handcuffs) to block AWS from hiring experts to integrate this extension into their PG offering.
Re:Scaling Datastores at Slack with Vitess
by wiredfool on Sunday December 06, 2020 @11:35AM
(#25324536)
Sharding based on customer is an attractive way to get to shards, potentially with minimal interference in ops or data model, but truly sucks when your biggest customers don’t fit on one shard anymore.
Re:Scaling Datastores at Slack with Vitess
by sougou on Sunday December 06, 2020 @12:40PM
(#25325077)
The way to reason about this is: If a customer had a huge business, what key would they shard by? Then choose that as the sharding key for all customers.
Re:Scaling Datastores at Slack with Vitess
by continuations on Sunday December 06, 2020 @05:23PM
(#25327187)
How big is your largest customer though?
You can easily buy a machine with several TB of RAM, several hundreds of TB of SSDs in RAID giving you millions of IOPS, quad-socket 256 cores. How likely is it that a single machine cannot handle a single customer?
Re:Scaling Datastores at Slack with Vitess
by jjeaff on Sunday December 06, 2020 @07:31PM
(#25328071)
Ya, this is always what I think about when I see people spending lots of effort on "scalability".
You either need an enormous client base or are doing something very specialized that requires tons of memory or cpu per customer.
I would think 99% of all internet companies could likely handle everything on a single massive machine, or two, for redundancy. Assuming they were somewhat optimized.
Re:Scaling Datastores at Slack with Vitess
by derekperkins on Monday December 07, 2020 @01:14AM
(#25329782)
That introduces different problems. Applying MySQL replication logs is single threaded by default and generally doesn't scale as well as the master, so it becomes increasingly difficult to keep replicas from lagging.
As your database gets into tens or hundreds of TBs, now backups and restores take hours or days to complete. Any DR scenario becomes an existential threat.
For large tables, schema changes can take weeks. This often results in developers doing their own custom table sharding strategies, even though they might still be on a single machine.
I'm not saying that you can't architect around these problems, but operating a db at massive scale on a single machine isn't the obvious win that it seems to be.
Re:Scaling Datastores at Slack with Vitess
by atombender on Sunday December 06, 2020 @01:49PM
(#25325592)
I guess I was assuming a shard was more than one machine. If a customer can't be horizontally scaled across nodes, then of course there's an upper limit on how large a shard can be.
Re:Scaling Datastores at Slack with Vitess
by chevman on Sunday December 06, 2020 @04:38PM
(#25326909)
Yeah, seems like the key point here is be careful architecting your infrastructure around a somewhat arbitrary construct like 'customer'. The relevant entity to scale around for Slack is likely 'active users' or even 'messages'. Which may map loosely to 'customers', but that's almost incidental.
Re:Scaling Datastores at Slack with Vitess
by juancampa on Sunday December 06, 2020 @12:19PM
(#25324904)
The article addresses this particular point
> Each keyspace is a logical collection of data that roughly scales by the same factor — number of users, teams, and channels. Say goodbye to only sharding by team, and to team hot-spots!
Re:Scaling Datastores at Slack with Vitess
by yashap on Sunday December 06, 2020 @03:43PM
(#25326446)
> Today, we serve 2.3 million QPS at peak. 2M of those queries are reads and 300K are writes.
Damn, even for a service as popular as Slack, that’s significantly more than I expected. Slack has ~12-13 mil DAUs, right? I assume at peak time of day, maybe 2-3 million actively using the product at the same time? If that’s a fair assumption, that’s roughly 1 MySQL query per second, per active customer - seems like a fair bit? I wonder if they do polling (instead of websockets)?
At my work we have roughly 1 order of magnitude fewer DAUs, but roughly 2 orders of magnitude fewer QPS. And we also have chat areas of the product.
Re:Scaling Datastores at Slack with Vitess
by jhgg on Sunday December 06, 2020 @04:14PM
(#25326708)
It is a pretty high QPS. I work on a chat service that is quite popular (even more popular than Slack) and looked at our QPS to our persistent data stores. It is less than an order of magnitude compared to slack's when you normalize for DAU. Really wonder what they're doing over there.
Re:Scaling Datastores at Slack with Vitess
by derekperkins on Monday December 07, 2020 @01:18AM
(#25329798)
Whatever the service, it isn't the platform that Slack is. I would guess that a huge percentage of their db traffic is from apps and custom integrations.
Re:Scaling Datastores at Slack with Vitess
by karlding on Sunday December 06, 2020 @03:59PM
(#25326561)
> Slack has ~12-13 mil DAUs, right?
As of September 2019, Slack reported 12 million DAUs [0]. Of course, that is pre-pandemic, and the only figures that Slack has provided regarding demand in 2020 are these tweets [1] from Slack CEO Stewart Butterfield back in March. In those tweets, it mentions that Slack was serving 12.5M simultaneously connected users.
Re:Scaling Datastores at Slack with Vitess
by yashap on Monday December 07, 2020 @01:28AM
(#25329843)
May want to edit your post - I believe you meant 300K QPS, not 300 QPS :) But yeah, that’s very impressive to handle that much load without sharding! Though it is a cluster of 12 instances, each with 96 CPUs and 614 GB RAM - those are some seriously beefy machines.
Slack are getting 300K WRITES per second, though. Which does mean you have really no choice but to shard - read replicas are nice for scaling reads, but do nothing for writes, and that’s A LOT of writes.
Re:Scaling Datastores at Slack with Vitess
by merb on Sunday December 06, 2020 @07:11PM
(#25327948)
on k8s there is:
- crunchydata
- the thing crunchy is based on (well actually they are more based on the underlying things like patroni): zalando postgres operator https://github.com/zalando/postgres-operator, really really solid stuff
It seems like a well executed combination of Vitess/Citus + read replicas pointing to decoupled page storage would result in a fully featured non-proprietary database that scales all the way down to your laptop and all the way up to the heaviest OLTP use cases. If that existed, only truly masochistic people would continue using things like DynamoDB.
Which is probably why AWS doesn't support it, they make less money and have less lock in on their clients.
Hi Sugu!
I wouldn’t say that killed my first startup, but it certainly didn’t help.
You can easily buy a machine with several TB of RAM, several hundreds of TB of SSDs in RAID giving you millions of IOPS, quad-socket 256 cores. How likely is it that a single machine cannot handle a single customer?
You either need an enormous client base or are doing something very specialized that requires tons of memory or cpu per customer.
I would think 99% of all internet companies could likely handle everything on a single massive machine, or two, for redundancy. Assuming they were somewhat optimized.
As your database gets into tens or hundreds of TBs, now backups and restores take hours or days to complete. Any DR scenario becomes an existential threat.
For large tables, schema changes can take weeks. This often results in developers doing their own custom table sharding strategies, even though they might still be on a single machine.
I'm not saying that you can't architect around these problems, but operating a db at massive scale on a single machine isn't the obvious win that it seems to be.
Database like CockroachDB and TiDB help here.
> Each keyspace is a logical collection of data that roughly scales by the same factor — number of users, teams, and channels. Say goodbye to only sharding by team, and to team hot-spots!
Damn, even for a service as popular as Slack, that’s significantly more than I expected. Slack has ~12-13 mil DAUs, right? I assume at peak time of day, maybe 2-3 million actively using the product at the same time? If that’s a fair assumption, that’s roughly 1 MySQL query per second, per active customer - seems like a fair bit? I wonder if they do polling (instead of websockets)?
At my work we have roughly 1 order of magnitude fewer DAUs, but roughly 2 orders of magnitude fewer QPS. And we also have chat areas of the product.
As of September 2019, Slack reported 12 million DAUs [0]. Of course, that is pre-pandemic, and the only figures that Slack has provided regarding demand in 2020 are these tweets [1] from Slack CEO Stewart Butterfield back in March. In those tweets, it mentions that Slack was serving 12.5M simultaneously connected users.
[0] https://slack.com/blog/news/work-is-fueled-by-true-engagemen...
[1] https://twitter.com/stewart/status/1243000487365861376
While that's like 1/7th of Slack's traffic, it is served by a single PostgreSQL cluster.
That's the comment.
Slack are getting 300K WRITES per second, though. Which does mean you have really no choice but to shard - read replicas are nice for scaling reads, but do nothing for writes, and that’s A LOT of writes.
Right now the cluster is only 8 instances, and the write-only traffic on the master spikes to 70K QPS.
So I agree with you --pretty beefy hardware, and it'd probably require sharding before reaching Slack's scale, but still quite impressive.
Vitess plans to support PostgreSQL, but there is no work on that at this time.
- crunchydata - the thing crunchy is based on (well actually they are more based on the underlying things like patroni): zalando postgres operator https://github.com/zalando/postgres-operator, really really solid stuff
> stolon - PostgreSQL cloud native High Availability https://github.com/sorintlab/stolon
If all you want is HA and FO there are simpler solutions like pgpool and pgbouncer etc.