TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How we built a serverless SQL database

265 pointsby TheresaBraccioover 3 years ago

13 comments

phoboslabover 3 years ago
&gt; If you’ve created a database before, you probably had to estimate how many servers to use based on the expected traffic.<p>The answer is &quot;one&quot;. If you have less than 10k req&#x2F;s you shouldn&#x27;t even start to think about multiple DB servers or migrating from bog-standard MySQL&#x2F;MariaDB or Postgres.<p>I will never understand this obsession with &quot;scaling&quot;. Modern web dev seriously over-complicates so many things, it&#x27;s not even funny anymore.
评论 #29006223 未加载
评论 #29007321 未加载
评论 #29013241 未加载
评论 #29008788 未加载
评论 #29006689 未加载
评论 #29007478 未加载
评论 #29006566 未加载
评论 #29009759 未加载
评论 #29009536 未加载
评论 #29009433 未加载
评论 #29007415 未加载
评论 #29006420 未加载
评论 #29006176 未加载
评论 #29008551 未加载
评论 #29008229 未加载
andydbover 3 years ago
To any who might see this, I&#x27;m the author of the blog post, and led the engineering team that built CockroachDB Serverless. I&#x27;ll be monitoring this thread in case there are any questions you&#x27;d like to ask me about it.
评论 #29004169 未加载
评论 #29009298 未加载
评论 #29004026 未加载
评论 #29004122 未加载
评论 #29008852 未加载
评论 #29005302 未加载
评论 #29009419 未加载
评论 #29010398 未加载
评论 #29009825 未加载
评论 #29008616 未加载
评论 #29008304 未加载
评论 #29008629 未加载
ed25519FUUUover 3 years ago
&gt; <i>And you’ll never be surprised by a bill, because you can set a guaranteed monthly spend limit.</i><p>It’s amazing that this a killer and not standard feature, but here we are!
rabautover 3 years ago
Does CockroachDB Serverless expose an HTTP api? This sounds like a great fit for use with Cloudflare Workers, but that requires an http api.
评论 #29004278 未加载
评论 #29006852 未加载
评论 #29008424 未加载
评论 #29004817 未加载
评论 #29005812 未加载
WatchDogover 3 years ago
This offering seems a lot more compelling than the serverless databases offered by AWS directly.<p>At least if cost and scaling to zero is important to you. Dynamodb addresses the cost issue, but it&#x27;s so painful to use, and is unsuitable for a lot of use-cases. Aurora Serverless takes 30 seconds to cold-start, so it&#x27;s also usually a non-starter, other than for batch type workloads.<p>So great work, but I have a couple of questions:<p>Any plans to support AWS privatelink? I played around with this a bit, and it seems you need to connect to it over the internet which isn&#x27;t always ideal.<p>Will there be a limit on how many free databases you can create? I think there are some valid use-cases where one might want to create a bunch of them, but I would be scared to do this at the risk of being kicked off your platform for abuse.
评论 #29008406 未加载
pachicoover 3 years ago
I really see the greatness of the serverless option. Congratulations!<p>What I can&#x27;t really understand is why would someone use the dedicated cluster in AWS at that price.
评论 #29005157 未加载
评论 #29005120 未加载
mdasenover 3 years ago
I think some of the value of Cockroach Serverless may depend on what the RUs (request units) map to. Looking at some competitors...<p>Google says that Cloud Spanner should get you around 7,000 read queries per second and 1,800 write queries per second for $650&#x2F;mo. If a simple indexed read is 1 RU, $650 on Cockroach Serverless would get you around 2,500 reads&#x2F;second. Of course, I think it&#x27;s completely reasonable for a Serverless option to cost a bit more given that you&#x27;d need to over-provision Cloud Spanner (even if you smartly increased&#x2F;decreased the amount of compute allocated based on demand).<p>Planet Scale charges $15 per 100M rows read and $15 per 10M rows written. If an RU is a row read, then Cockroach Serverless would be $10 per 100M rows read. If a write takes 10 RUs, Cockroach would cost $10 per 10M rows written. Both of those would be less than Planet Scale&#x27;s cost - but it&#x27;s possible that a row read will cost more than 1 RU. Let&#x27;s say that an indexed lookup of a row costs 5 RUs. Then Cockroach Serverless starts costing 3.3x more than Planet Scale.<p>AWS DynamoDB charges $1.25 per million write request units and $0.25 per million read request units. If I can get 10M reads from Cockroach Serverless for $1 and 4M reads from DynamoDB for $1, Cockroach&#x27;s pricing looks pretty good. Of course, if I need 5 RUs to do an indexed read, the pricing doesn&#x27;t look as good anymore.<p>I do respect Cockroach Labs somewhat ambiguous description here. Planet Scale&#x27;s $15 per 10M rows written feels like something that could become bad. What if I define hundreds of indexes on the table? What if I&#x27;m inserting very large blob&#x2F;text columns that are 50MB in size? Likewise, what if I index no columns and end up forcing a full table scan, but only 10 rows are returned? Do they consider that I &quot;read&quot; 10 rows or &quot;read&quot; all the rows in the table? If it&#x27;s the former, I&#x27;m putting a lot of strain on their system without paying for it. If it&#x27;s the latter, I&#x27;m going to just define indexes that might not be worth it if I were paying for the IO needed to do all that writing.<p>Still, it would be nice if Cockroach Labs offered some indication of what could be accomplished with 1 RU. &quot;An indexed read of 1 row or an indexed read of a few rows in sequence; for example, &#x27;SELECT * FROM people WHERE age &gt; 18 ORDER BY age, name LIMIT 10&#x27; where there exists an index on (age, name).&quot; That would let me know what to expect. &quot;A write of a row under 4KB in size with no secondary indexes will cost 3 RUs; expect secondary indexes to increase the cost by 1 RU each&quot; would give me an idea of what&#x27;s going on.<p>I think there are definitely cases that one can&#x27;t easily enumerate. For example, &quot;UPDATE people SET age = 18 WHERE EXISTS (SELECT * FROM legacy_info WHERE people.id = legacy_info.people_id AND legacy_info.is_adult = true)&quot;. That&#x27;s potentially going to require lots of stuff that&#x27;s harder to predict. However, at this point I don&#x27;t know if an indexed read of a row costs 1 RU or 10 RU. If an indexed read of a single row costs 1 RU, if I read 10 rows sequentially will that mean 10 RUs or will 1 RU have enough IO to cover that since they&#x27;re sequential (or will the billing just over-charge since there&#x27;s tangibly more rows and that&#x27;s easy to explain)?<p>I think a decent amount of the value depends on the pricing and it&#x27;s hard to judge that right now.<p>One thing I will note is that the storage seems expensive. It&#x27;s slightly cheaper than Planet Scale, but a lot more than the $0.30&#x2F;GB of Cloud Spanner or the $0.23&#x2F;GB of FaunaDB or $0.25&#x2F;GB of DynamoDB. I&#x27;ve been wondering a bit about the storage pricing of Planet Scale since $1.25&#x2F;GB seems expensive. Cockroach Serverless is coming in at $1&#x2F;GB which also seems expensive compared compared to alternatives. If Cloud Spanner is basically offering a third the price, is the &quot;Serverless&quot; flexibility worth it given that Spanner can be scaled up&#x2F;down pretty easily in very granular increments.<p>Actually, one thing that could be useful might be noting how many request units per month one of the dedicated instances would have. A 2 vCPU CockroachDB instance costs $350-400. Would that be 4 billion request units per month (assuming you were fully utilizing the box)? Would it be more like 15 billion request units per month since you&#x27;re presumably paying a premium for the Serverless flexibility?
babelfishover 3 years ago
Really great post, thanks for sharing. I spent a lot of time a couple months ago researching &#x27;DBaaS&#x27; offerings (for fun, not business) and found it difficult to find any posts outlining the architecture of a DBaaS. Really cool to see CRDB putting this out in the open.
评论 #29006785 未加载
estambarover 3 years ago
One of the first apps to migrate from CockroachDB Dedicated to Serverless is live now if someone wants to try it out. <a href="https:&#x2F;&#x2F;web.flightchop.com&#x2F;dashboard" rel="nofollow">https:&#x2F;&#x2F;web.flightchop.com&#x2F;dashboard</a> - posting for a friend.
timwisover 3 years ago
This sounds great! I’ve wanted to create an open data portal for a while that lets you spin up a (ephemeral, read-only) Postgres database of a dataset and run queries on it, maybe with a notebook. Sounds like this might be perfect!
评论 #29005127 未加载
评论 #29004532 未加载
kendruover 3 years ago
The lack of a serverless option was the only reason that I did not use Cockroach on a recent project. I am excited to see the serverless offering now, and the architectural details in the post are awesome. Nice work!
boynamedsueover 3 years ago
Any plans to expand the region availability for AWS beyond us-west-2 in the US? I am interested in us-east-2.
评论 #29007482 未加载
geoduck14over 3 years ago
How does this compare to Snowflake?
评论 #29007172 未加载