Yes. My experience: "Oh interesting title". "Oh god... slop galore. Disappointment, sadness, dejection, a feeling of being dismissed and not taken seriously, alienation from the world", "OK close the link".
Happy to still be here among my fellow humans. Hackernews the last bastion it feels like.
Can we somehow filter out slop from the front page? That would be great :).
some kinda system running the linked page through pangram and then putting the result in a small font next to the submission time would be perfect I think. A small font to keep the idea that such things may potentially hold value while satisfying those who aren't interested. Nobody has to argue about it themselves then because it's unambiguous, and everyone can filter them out if you choose.
I'm generally very pro-AI, including for writing, as long as the "producer" (I wouldn't want to call the human responsible the author) has vetted it and will judge based on whether something reads well rather than on whether it feels AI-written.
But using detectors to label so people can choose seems entirely reasonable to me even with a risk of false positives, and I think a lot of people who are generally pro-AI would feel that's fine.
Honestly the network-attached storage only ever made sense with HDDs, it's ridiculous to have to pay 10x penalty for both iops and latency just for some "operational flexibility". You get way simpler and much more robust architecture if you just stick to local NVMe and replication -- not that you can forgo one in the (also replicated) network block storage solution anyway...
Mostly agree, but then you have to take care of replication, failover, and backup. By using a replicated block storage, you can mostly externalize that problem.
Agreed. This is probably the trickiest part of building managed Postgres on local NVMe. Postgres already gives you a lot of the building blocks: physical streaming replication, synchronous replication, WAL archiving/PITR with backup toold, etc. The hard part is making failovers, recovery, and node replacements seamless.
We’ve spent a fair bit of time on this at ClickHouse through our operational expertise huilding Postgres managed services multiple times. We’re fortunate to have deep internal and partner Postgres expertise, folks who originally built WAL-G back in the Citus Data days and are active contributors now and solid partnership with Ubicloud.
It’s definitely more engineering work, but the performance/scalability gains make it worth it. Relaying this based on 100s of customers who migrated to ClickHouse Managed Postgres - new, powerful world surpassing previous expectations.
NAS/SAN still make sense when you need to share storage between multiple DBs for cost efficiency: most application DBs are tiny compared to the size of an SSD.
SSD NAS still a lot faster than HDD NAS. And having network-attached storage allows for a lot of cool things. Like you can bind it to kubernetes, so your database instance can easily migrate between nodes while data is kept intact just remounting between nodes. In fact it makes things a lot easier whenever you need to manage persistence. But you're paying big price for it, yeah. Sometimes simplicity worth it. Sometimes you can't afford to lose performance.
Too many times I see people making the same avoidable mistakes time and time again.
They get stuck in the dream of "portable" schemas and don't use their brain to design a database-specific schema.
They have no clue how to write SQL queries (or again, have stupid dreams of "portable" queries). As a result performance suffers.
Then they come to your desk complaining the databse is slow, and insisting that they absolutely MUST have a Redis caching layer.
I'm sick and tired of people using databases as blackbox dumping grounds. If slow storage was always the problem, my life would be far less stressful. Since the prescription would be easier for the doctor to write. ;)
Yeah, a lot of people can't figure out how to structure databases or what indices to add to them, but no, that is not the only problem just because it's the one you deal with.
> that is not the only problem just because it's the one you deal with
Sure. But to be clear: I am not denying storage is a genuine problem for some people.
I am just saying in the majority of cases it's probably not "the storage". For most people "the storage" will be quite far down the list of likely causes of a "slow" database.
Throw all the Enterprise SSDs or other storage solutions you like at a shitty schema and it will still struggle under load (or sometimes just struggle full stop).
You can spend a week crafting the most optimal query possible, making sure the plans are perfect and all the best index types are used
And then you push it to production and get completely different results
Statistics change everything. Queries which produced beautiful plans in local and staging environments breakdown when given production statistics, some users get the same plans you did, others get nasty nested loops, indexes don't get used, and debugging and fixing it requires poking around in prod statistics which is never a good place to be. Don't even get me started on how RLS impacts query optimisation
Postgres is great but the authors refusal to add plan hints is a decision that comes to bite me at least a few times a year
Mostly agree although you should probably spend a bit more time testing on a more realistic setup.
At least run some plans on the real database with real sized data and real statistics.
Similar to how mocks/stubs are great until they aren't.
That won't magic away statistics problems, but it's still good practice to acknowledge the lower app environments tend to not reflect performance of the production one.
Postgres (and similar DBs) are a byproduct of a pre-2023 era. Give me one reason why I shouldn't get my agents to write a use-case specific DB that is almost certainly going to be faster than a general-purpose DB?
try it and see :) check out that Goose language. you’ll quickly realize your agents are idiots and need reams of PDFs that YOU don’t know how to select and filter down to even have good ideas, and then will drift forever failing to “seam” the contracts between the storage, query planning, and compilation layers.
Opportunity cost. If getting rid of Postgres is going to make you more money, go right ahead. More likely though, you have other problems to be dealing with that are more directly in line with your work.
1. You don’t have those speed requirements, and if you do, you already know the answer to your question.
2. Data tends to be somewhat important to a lot of companies. A vibe-coded database increases your risk of losing that data.
3. Your database might have clients using different languages. Now, your vibe-coded drivers become another layer of potential problems.
4. People has been doing this since way before 2023 btw, most probably agree Postgres would be the sane choice.
You just don't write some class of software unless that is the product itself. DBs are one of them. Another one is operating systems. It takes a huge level of domain knowledge, real life use and time.
SQLite + NVMe feels like cheating sometimes. If my #1 requirement is lowest possible latency, I can't imagine picking anything else.
Kestrel (AspNetCore) + SQLite + NVMe all on the same machine is where things start to get really spicy in my experience. Imagine handling an entire form submission that mutates database state in tens to low-hundreds of microseconds. Total wall clock time required to service any HTTP request can be well under a single millisecond. If your average cpu time per request is 30uS, you could approach half a million per second on a 16-32 core machine.
We tested this out extensively. DuckDB + Nvme kicks ass, but if you ingesting and analytzing near real-time quotes/trades, DuckDB doesn't handle well because DuckDB can only support one reader and one writer in read-write mode.
Ok so you have multiple writers in write-only mode and then you switch to read-mode if you need to read? How would that work e.g in an IoT ingest system with lots of telemetry coming in.
It doesn't. That's the issue. DuckDB for us is a pure read-only service pipe. We need other tools to ingest and write to parquet, which has its own limitation.
SQLite does a great job to support single writer and multiple readers. That's what we use for aggregation right now. DuckDB is purely post analytics.
Same experience here, from a multiplayer game server. Go, one SQLite file per game world, one process owns each file, all on a local SSD.
In a load test with 512 players all active on one world, command acks were 4-6 ms at the median and under 50 ms at p95, on a single Ryzen 9 3900X box. And most of that time is game logic and fanning out updates over websockets, not the database.
The part people worry about is durability, because SSDs have limited write cycles. So I took care to have backups of the state, recovery in short time etc.
I stream the WAL to object storage with Litestream, with one gotcha: I had to turn off SQLite’s own auto-checkpoint and let only Litestream checkpoint, or the two step on each other.
But why was EBS chosen instead of NVMe, which is faster? Since I only know how to use cloud programming and don’t understand the internal implementation, I don’t really get why it works out this way.
Is it because of ease of backup? Or data movement?
When the host dies with local storage, the VM is dead. With EBS it's not, since it simply can be booted up on another host. EBS is also replicated accross multiple hosts.
Thank you for your kind answer. I understand EBS as, in other words, virtualized storage, so then somewhere the logical block addresses have to be connected to actual physical storage devices, right? Then where and how is that mapping implemented? If you just give me the keywords, I’ll search for them myself.
Since I’m a freelance programmer, I mainly work on small-to-medium-sized projects, so I don’t know much about this kind of infrastructure programming.
Look up “SAN” or “storage area network.” EBS looks like a regular, local block device, another disk in /dev, but is actually served over the network. The implementation is transparent.
> Look up “SAN” or “storage area network.” EBS looks like a regular, local block device, another disk in /dev, but is actually served over the network.
When I think of "SAN" I think of Fibre Channel, which can be quite fast. EBS sounds more like iSCSI.
The ability to scale up the DB disk size and select the right performance level... Especially when starting out, you may have no idea how much space or performance you need. EBS volumes help make that decision easier and more cost efficient.
Cloud is insanely expensive and inefficient. Too many engineers don't understand how slow I/O back and forth is on network storage, or VMs with chatty neighbors are compared to bare metal...
Do you want to spend thousands of dollar upfront for that DB server with sweet sweet NVME SSDs, of which your application might not even use 1% before the app get scraped?
You need that RAID card which is not available anywhere around you.
You need to visit your Data Center, but you suddenly have issues with security and you need to arrange all that stuff.
You need to buy DDR stick but you need to wait a month for delivery.
The guy who knows how to insert a stick took a vacation week ago, and everyone else is too afraid to touch big iron box.
With cloud, you either don't notice that, because they have scale and they have spare parts and they have personnel 24/7. Or worst case you order identical server and deploy your app, hopefully in a few hours restoring from backup.
And for some people it might never broke. But it's all the uncertainty and fear that leads people to cloud solutions. You don't plan for average outcome, you plan for worst outcome.
Yes, you will need to keep a spare running. And have written (and tested!) procedures around how to switch to the spare when members of your team are away.
That exact line of thinking is how our costs increased 8x over 2 years.
And you're not immune from those issues in AWS. What happens when you run out of EBS IOPS or have to change instance type and it won't boot? What happens when your instance fails? What happens if you hit a quota limit in the middle of a failover?
AWS support is fucking awful unless you pay $5k a month or 10% of your total spend (whatever is greater) and then it's only mediocre.
> You need that RAID card which is not available anywhere around you.
If you're small enough to not be able to justify spares, then rent servers instead. It's still cheaper than the big cloud providers.
> You need to visit your Data Center, but you suddenly have issues with security and you need to arrange all that stuff.
You rarely do. Anywhere beyond the cheapest third-rate colo provider provides "remote hands" services.
Even when managing several racks worth of hardware, I'd go into the colo facilities a couple of times a year at most.
> and they have spare parts and they have personnel 24/7
Even tiny colo-providers still have personnel 24/7, and you can buy fractional devops services for small retainers from any number of providers (like me).
Single boxes now are also insanely powerful compared to what we had back in the day too. Unless you are genuinely running the next Google, you might not even need to scale beyond one. You might get a second box purely as a hot spare of course.
I used to run a webmail service that we had ~2 million user accounts on. It took several racks of equipment. The combined capacity (RAM, IO capacity, disk storage, CPU) was all below the 250 GBP mini PC under my desk...
if you do the same type of governance, cloud is still cheap too (everything on one server)
Where the money gets wasted, is doing a different server per project, putting everything in different resource groups, and then overprovisioning those servers many times over. So much wasted capacity because of simple project structure preferences.
And then there is also the fact some features are locked behind more expensive models, which is also rarely cost efficient.
All I am saying is, if you simply create 1 database server on the cloud, with a database per app, and different schema's, isolated users, ... it can stay super cheap. But good look getting through an enterprise cybersecurity audit or ISO27000+SOC2 certification.
You can rent bare metal server for that. The real advantage of cloud solution is a cohesive offer, ease of scalability, and many other things which boils down to "we take care of things for you". It can be worth the $, i can also be a huge waste of $.
Far lower than 0.01x. Batching can get like a 30x boost, and horizontal scaling makes that impossible, so your upper limit is basically 0.03x. Then you throw it on a volume with 1/1000 the IOPS of a basic consumer drive. So more like 0.00001x, and you can pay through the nose to bring it up to 0.01x maybe.
People have zero concept of how incredibly absurdly fast even a slow computer is. Storage is literally 1000x faster than it was 15 years ago.
You also fail to realize that even managing a physical DB server is much easier now with AI, enabling people to more easily understand what their infrastructure needs are, what maintenance is needed, how things can be automated.
True. We do have to remember that this is only possible in the last few months. The costs to manage more and more infrastructure is steadily going down.
And yet we do multi year purchase commitment contracts with cloud providers that break that "flexibility" premise.
With the multi million dollars A MONTH purchase commitment contracts I've seen in my previous employers, you could use a single month budget to buy hardware that could serve our applications for years.
Renting (either just the hardware or a dedicated box at a hosting provider), leasing, lease to own, or just plain regular payment plans are all options that tend to work out at a fraction of the big cloud providers.
In 30 years of hosting on-prem or in colo facilities, I've never once bought hardware up front for corporate accounts.
The math has drastically changed over the last few years. For example, the on-prem database server we bought 4 years ago for $14K is now pricing out at $96K.
> Cloud providers have to buy new hardware too to grow and to replace failing/obsolete units.
They can negotiate better prices based on their scale, and even on their ability to internally source key components if needed.
E.g. if AWS/Microsoft/Google/Apple buy 80% of Micron's entire output it's probably at a much better price than the rest of us competing over the other 20% are going to get.
Even just going to second tier cloud providers will tend to let you rent similar capacity much cheaper.
AWS and the other big cloud providers only gets close to cost efficient when you're big enough to negotiate prices that are nowhere near their public list prices.
> They can negotiate better prices based on their scale, and even on their ability to internally source key components if needed.
A global supply chain storage is a global supply chain shortage.
Most famous recent example being Apple who were absorbing the rapidly increasing cost of supply until even they had to put up the prices to reflect procurement and manufacturing reality.
And this is Apple. The company that even buys its manufacturers plant equipment in return for it being dedicated to Apple.
Yes the big boys get volume discount. But that doesn't magically entitle them to last decades's pricing.
> Yes the big boys get volume discount. But that doesn't magically entitle them to last decades's pricing.
You’re trying to refute an argument I did not make.
They do not have to be cheaper than 2016. They have to be cheaper than what your business could otherwise string together paying current market prices. And they will be.
It’s probably cheaper per unit when they buy at massive scale, but that was also true before the hardware inflation of the past couple of years. So I’m sure they are still paying much higher prices than in previous years. Many cloud services have increased prices and I suspect that will continue for at least a few more years.
Four years ago, I needed 256gb of ram, and it was costing about $1-2k a month in the cloud, which I replaced with a server on ebay with 1,5tb of ram for about €2k- which I was pricing against equivalent to what I was renting for about $6k or so on newegg. And I think the dumbest IT procurement manager in the planet could've gotten it from Lenovo or HPE or something for $10k providing the easiest 20% savings if they move on-prem.
Depends on your metrics. Say you're an early startup - short on man-hours and bare-metal skills, with backers who think that "cloud" sounds fast, cool, and scalable.
Or your a VP at some big company - with C-suite mandate to deliver Cool Solutions ASAP, whatever the cost...but a byzantine mess of middle managers between you and the actual engineers. Deciding "we'll use CloudCo" can rob your steaming heap of PHB's of a lot of opportunities to make bad decisions and drag things out.
The very thought of a single storage request hitting the network unnecessarily boils my blood.
Certain latency increase must be traded for scalability. But atleast we get the required utility in return.
But without that utility, one is just hiking up the cost. Any competitor who can deliver at reduced cost holds a potent weapon that you simply cannot survive.
Cost is a weapon. One of the most fundamental weapon in almost all domains.
Latency can also be traded for availability. EBS storage provides replication and can trivially be removed/attached to new instances if the database server for some reason needs to be taken down. Any database with built-in replication/consensus (Kafka, Spanner, Dynamo, Cockroach, etc.) is making this same tradeoff and is effectively hitting the network on every storage request.
Considering that the topic is an article is comparing raw NVMe vs EBS performance for postgres storage and GP saying that cloud is unnecessarily inefficient, I misinterpreted your comment as implying that networked storage is always an unnecessary cost. In many cases the cost of replication and availability is lower than the cost of data loss and downtime.
> Any database with built-in replication/consensus (Kafka, Spanner, Dynamo, Cockroach, etc.) is making this same tradeoff and is effectively hitting the network on every storage request.
I don't think this is true. I am not sure about those you described, but say you have PG replicas, you can run query on replica node without hitting some network attached storage. This is obviously true for reads but not for writes.
Yeah, you are correct. I was thinking about writes but not reads. Even the databases I mentioned typically have optimizations such that when there is a stable leader, reads don't require any network.
RAM is insanely expensive and inefficient. Try to keep important info in L3 cache. Every additional hop from the CPU transistors adds exponential overhead.
Everywhere we look we see people making the best choice for them. Big apps using Electron vs native. Ports of 250MB games like Starcraft now taking 5GB of "compatibility" libraries to run on modern PCs.
I completely agree that people need to be aware of Latency Numbers Every Programmer Should Know (https://gist.github.com/jboner/2841832), but in reality we don't all have the budget, time, or personal to do things the right way when it's the company ordering us around vs our own projects where we can do things "the right way".
Honestly, I'm glad companies are wasteful. If large companies were super conservative and agile then our economy would be in really, really bad shape. It's thanks to these inefficiencies that small startups can jump in and capitalize in ways bureaucracies of PM's can't.
The issue is that on prem suffers from too many edge failure cases. It's cheaper to pay S3 to deal with the problem than to have a full team dealing with bit rot from RAID issues. It's one thing to have an home office/home lab server, it's another thing entirely when you have terabytes of content that can't tolerate any data loss and you don't have engineers on call at 3am.
I am no fan of the idea of reinventing everything to run on cloud primitives but you can't deny reliability of online software is a lot higher now than the pre HTML5 era. Back then, having more than two nines of uptime for random backend heavy web apps was hardly common while now it's table stakes.
No to mention, the great thing about the cloud is that you can get away with availability problems because it usually means everyone else is down, too.
I recently interviewed for a company (for the purpose of not making this an advertisement, I will not name it) that uses FPGAs to speed up SQL queries. They claimed at least two orders of magnitude speedups for joins!
They also told me that they've started as a h/w shop and that they have competitors who are building ASICs rather than programming FPGAs to do the same (with, potentially, even more performance gains).
This completely changed the perspective for me. Before, I had this idea that if I need to optimize database performance, I'd first look at indices. Then, at how much memory is available to the database for various tasks. Only after that, I'd look at I/O performance, but, mostly, because of fsync configuration.
It wouldn't even appear to me as a possibility that the compute can become the culprit of optimization. But, apparently, it's a new hot thing.
* * *
From my experience with storage testing, which also included quite a bit of pg-bench exposure... My impression was this: the sort of query that is used for performance benchmark matters the most. It will define the optimization direction. Blindly trying to add or speed-up one resource or another is not going to be an efficient strategy. In the database world, there's this idea of an "ideal" benchmark. Without too much detail, it imagines an "ideal" business accounting back-end, the sort of queries it would have to execute. It defines an "ideal" unit that roughly encompasses one "sale", and then it measures how many such "sales" a business can perform per unit of time. This will translate into some ratio of selects / inserts / deletes / updates with some index hits and some linear searches etc. But it's all extremely vague and it's very hard to adapt this benchmark to the actual business needs of the database being tested.
There's also a question what to optimize for: the resource usage? the response speed? the concurrency? In some scenarios, I can see how storage would factor in, but there are also certainly scenarios where using a faster, in some sense, storage will not result in any meaningful gains.
Was my question too. Now, I have not tested the technology, so, I can't vouch for the veracity of the claim, but the answer I was given made sense. This is what it was: in the same way how a dedicated switch is a lot more efficient when dealing with IP packets than a general-purpose CPU is. In particular, comparison takes a lot less time because it is able to dramatically reduce the number of load operations. I found this paper: https://www.sfu.ca/~zhenman/files/C31-FCCM2023-SQL2FPGA.pdf (there's also a Github repo with some experimental code for Spark: https://github.com/SFU-HiAccel/SQL2FPGA) that does something similar.
There was a whole bunch of work on GPUs for databases before GPUs became hard to get, which slowed it down a bit. A lot of the columnar database performance gain is from vectorization. Now which direct pcie DMA to GPU from NVMe this is even more attractive. FPGA seems much more work than GPU.
My understanding is that FPGAs are targeted not because they are ideal for the task, but because they are commercially available. As in: the customers may rent a VM from a major cloud vendor with FPGAs attached.
Trying to grow a business that relies on bespoke hardware in the age of cloud monopoly is an uphill battle.
Yeah, I remember seeing those. It felt really promising. I have no idea why they didn't continue in this direction.
The company I talked to explained the use of FPGA by saying that FPGAs are offered by major cloud vendor, and so are a commercially viable direction. While making their own dedicated chips is not only a lot more expensive, but also doesn't have a lot of customers (people don't want to maintain their own h/w, especially of a bespoke variety). The bespoke part might be why Samsung didn't pursue the idea. Essentially, if eg. AWS doesn't buy this from you and makes it an offering that customers may reasonably rely on, it's too hard to sell.
I'm an incorrigible contrarian so this seems like a good opportunity to shill for Oracle, where I currently have a part time gig doing research in the database group and am thus highly financially conflicted; read what follows with that in mind.
Well written databases are frequently I/O bottlenecked and getting a good storage/network setup can thus grant massive performance gains. But this is hard, operationally. The difficulty of developing the right opinions about hardware design, acquiring it, properly wiring it up, tuning it and ensuring really excellent performance across the stack was recognized by Oracle decades ago, which led to the creation of ExaData.
ExaData is a bit like Oxide, if you've encountered them. It's basically a cloud database in a pre-manufactured rack. You buy an ExaData rack and it turns up at your on-prem colo facility, you plug it in, and now you have a fast database. Internally it has a dedicated high speed InfiniBand or RoCE RDMA capable backplane network and handles replicated between storage devices itself. There's an alerting system and repl-like tool that guides you through swapping out failed storage devices, you can expand it by adding more racks, and there are various cloud hosted versions of all of this if your budget doesn't stretch to your own full system.
The software stack on top of that provides fast multi-master synchronous writes by using RAM as a shared disk cache. If a node needs to read a block off disk it will prefer to read it directly out of the RAM of another node using RDMA across the dedicated backplane than go to storage, so if you buy the high capacity variant then you have a three tier storage system: HDDs for cold data, flash as a cache and DRAM as another cache on top of that, all kept in sync using cache coherency protocols.
There are lots of optimizations on top of that which a Postgres-on-EBS architecture can't match, for example, the storage nodes that handle the disks and serve blocks can have some of the query computations pushed down to them to reduce IO across the backplane and accelerate query execution. A final 'optimization' is that Oracle uses a different MVCC algorithm that doesn't require vacuuming and can be more IO efficient in general (doesn't copy whole rows); there are patch sets that switch Postgres to an Oracle-style MVCC engine but none of them were ever merged.
The whole thing acts as a single coherent database, so e.g. rolling upgrades across the rack's cluster don't cause downtime because transactions can be handed off across nodes. Clients can discover the IP addresses of the individual servers automatically and shift their traffic across nodes in response to load balancing requests from the system, etc.
I'm not sure it's a good idea to run a Postgres cluster like the one described in the article unless you have a lot of appetite for manual operations. If you can tolerate downtime or if you're renting bare metal where you can configure a proper RAID setup, then OK, but if you care a lot about query performance to begin with then a commercial database will win in a lot of ways (doesn't have to be Oracle, commercial RDBMS in general is a much more competitive space than open source).
Obligatory disclaimer: opinions above are not corporate approved.
But then again, only the transaction log has to be physically on the drive to guarantee durability, and modern drives are very good at sequential writes. Writing to tables/indexes can be delayed (to a "checkpoint", as it is known in most database systems).
"Back in the day", we used to have to carefully plan the underlying storage array to eek out every ounce of performance from the database server.
I think there's a generation of devs that just takes big memory pools and SSDs for granted; there's a mental disconnect to the fact databases map the underlying storage.
It becomes obvious once I bring it up with them in discussion and I can almost see the bulb go off (happened while discussing partitioning and sharding), but they never make the connection that a query is mapping to some artifacts sitting on storage.
Had a recent conversation with someone about something similar…
In our case the primary index on a table was a something like a sequential ID but the table stored data from multiple tenants so each page had data from multiple tenants
Took a while to convince people that the DB was always going to read 16KB chunks so we could reduce IO by changing the primary index so it was based around an ID that was unique to the tenant
> Took a while to convince people that the DB was always going to read 16KB chunks so we could reduce IO by changing the primary index so it was based around an ID that was unique to the tenant
Yikes. I'm mostly frontend and even to me this seems pretty clear.
I was using postgres for embarrassingly long time before I've learned the difference between "index scans" and "index only scans".
Including relevant columns in the index can massively improve the performance, because postgres does not need to read the randomly sorted tuple in the original table.
Just be wary that if your app is a high-write-throughput or high-update-frequency system, this is not a free lunch!
The indices will bloat in size (postgres does not vacuum them in the way a table is vacuumed), and begin to bottleneck primary writer latency.
You should repack the indices every once in a while (you can set up monitors on index bloat) with something like pg_repack, and make sure that your indices are minimally-sized (i.e. omit rows that are never scanned, use pg_stat to verify which indices are actually used by the primary or read-replicas).
CloudNativePG supports Kubernetes Local Storage as one of main features [0]
Persistent volume management, including:
Support for Local Persistent Volumes with PVC templates.
Reuse of Persistent Volumes storage in Pods.
Separate volumes for WAL files and tablespaces.
Chapter Temporary PostgreSQL Cluster Degradation [1] describes how to set it up and start with this
While the standard approach ensures service reliability and leverages Kubernetes' self-healing capabilities, there are scenarios where operating with a temporarily degraded cluster may be acceptable. This is particularly relevant for PostgreSQL clusters relying on node-local storage, where the storage is local to the Kubernetes worker node running the PostgreSQL database. Node-local storage, or simply local storage, is employed to enhance performance.
io2 has lower latency than gp3, and better durability. We switched workloads off gp3, didn’t even need to provision crazy iops. It had a cascading effect of calming down.
This is the fundamental issue with networked storage: all apps on top assume small io is fast an local, so network latency doesn't amortize.
With application-level replication, you can amortize it to a few steps (e.g. on commit, do 2PC).
Obviously there's nuance, esp if you have to read from another node, but it's why moving replication as far up the stack as possible generally performs better with DBs -- the DB knows when to touch the network better than the disk.
141 comments
[ 0.20 ms ] story [ 20.0 ms ] threadHappy to still be here among my fellow humans. Hackernews the last bastion it feels like.
Can we somehow filter out slop from the front page? That would be great :).
But using detectors to label so people can choose seems entirely reasonable to me even with a risk of false positives, and I think a lot of people who are generally pro-AI would feel that's fine.
We’ve spent a fair bit of time on this at ClickHouse through our operational expertise huilding Postgres managed services multiple times. We’re fortunate to have deep internal and partner Postgres expertise, folks who originally built WAL-G back in the Citus Data days and are active contributors now and solid partnership with Ubicloud.
It’s definitely more engineering work, but the performance/scalability gains make it worth it. Relaying this based on 100s of customers who migrated to ClickHouse Managed Postgres - new, powerful world surpassing previous expectations.
There. Fixed it for you.
Too many times I see people making the same avoidable mistakes time and time again.
They get stuck in the dream of "portable" schemas and don't use their brain to design a database-specific schema.
They have no clue how to write SQL queries (or again, have stupid dreams of "portable" queries). As a result performance suffers.
Then they come to your desk complaining the databse is slow, and insisting that they absolutely MUST have a Redis caching layer.
I'm sick and tired of people using databases as blackbox dumping grounds. If slow storage was always the problem, my life would be far less stressful. Since the prescription would be easier for the doctor to write. ;)
Sure. But to be clear: I am not denying storage is a genuine problem for some people.
I am just saying in the majority of cases it's probably not "the storage". For most people "the storage" will be quite far down the list of likely causes of a "slow" database.
Throw all the Enterprise SSDs or other storage solutions you like at a shitty schema and it will still struggle under load (or sometimes just struggle full stop).
And then you push it to production and get completely different results
Statistics change everything. Queries which produced beautiful plans in local and staging environments breakdown when given production statistics, some users get the same plans you did, others get nasty nested loops, indexes don't get used, and debugging and fixing it requires poking around in prod statistics which is never a good place to be. Don't even get me started on how RLS impacts query optimisation
Postgres is great but the authors refusal to add plan hints is a decision that comes to bite me at least a few times a year
At least run some plans on the real database with real sized data and real statistics.
Similar to how mocks/stubs are great until they aren't.
That won't magic away statistics problems, but it's still good practice to acknowledge the lower app environments tend to not reflect performance of the production one.
Kestrel (AspNetCore) + SQLite + NVMe all on the same machine is where things start to get really spicy in my experience. Imagine handling an entire form submission that mutates database state in tens to low-hundreds of microseconds. Total wall clock time required to service any HTTP request can be well under a single millisecond. If your average cpu time per request is 30uS, you could approach half a million per second on a 16-32 core machine.
SQLite does a great job to support single writer and multiple readers. That's what we use for aggregation right now. DuckDB is purely post analytics.
In a load test with 512 players all active on one world, command acks were 4-6 ms at the median and under 50 ms at p95, on a single Ryzen 9 3900X box. And most of that time is game logic and fanning out updates over websockets, not the database.
The part people worry about is durability, because SSDs have limited write cycles. So I took care to have backups of the state, recovery in short time etc.
I stream the WAL to object storage with Litestream, with one gotcha: I had to turn off SQLite’s own auto-checkpoint and let only Litestream checkpoint, or the two step on each other.
Since I’m a freelance programmer, I mainly work on small-to-medium-sized projects, so I don’t know much about this kind of infrastructure programming.
When I think of "SAN" I think of Fibre Channel, which can be quite fast. EBS sounds more like iSCSI.
sell a lie, blame the victim?
Do you want to spend thousands of dollar upfront for that DB server with sweet sweet NVME SSDs, of which your application might not even use 1% before the app get scraped?
If you can’t afford to throw down enough money on a single box to bring a business up then you’re fucked anyway.
I know whole businesses that make a lot of money and never needed more than that box. (And a hot spare)
The day it broke, it's a PITA.
You need that RAID card which is not available anywhere around you.
You need to visit your Data Center, but you suddenly have issues with security and you need to arrange all that stuff.
You need to buy DDR stick but you need to wait a month for delivery.
The guy who knows how to insert a stick took a vacation week ago, and everyone else is too afraid to touch big iron box.
With cloud, you either don't notice that, because they have scale and they have spare parts and they have personnel 24/7. Or worst case you order identical server and deploy your app, hopefully in a few hours restoring from backup.
And for some people it might never broke. But it's all the uncertainty and fear that leads people to cloud solutions. You don't plan for average outcome, you plan for worst outcome.
And you're not immune from those issues in AWS. What happens when you run out of EBS IOPS or have to change instance type and it won't boot? What happens when your instance fails? What happens if you hit a quota limit in the middle of a failover?
AWS support is fucking awful unless you pay $5k a month or 10% of your total spend (whatever is greater) and then it's only mediocre.
If you're small enough to not be able to justify spares, then rent servers instead. It's still cheaper than the big cloud providers.
> You need to visit your Data Center, but you suddenly have issues with security and you need to arrange all that stuff.
You rarely do. Anywhere beyond the cheapest third-rate colo provider provides "remote hands" services.
Even when managing several racks worth of hardware, I'd go into the colo facilities a couple of times a year at most.
> and they have spare parts and they have personnel 24/7
Even tiny colo-providers still have personnel 24/7, and you can buy fractional devops services for small retainers from any number of providers (like me).
Where the money gets wasted, is doing a different server per project, putting everything in different resource groups, and then overprovisioning those servers many times over. So much wasted capacity because of simple project structure preferences.
And then there is also the fact some features are locked behind more expensive models, which is also rarely cost efficient.
All I am saying is, if you simply create 1 database server on the cloud, with a database per app, and different schema's, isolated users, ... it can stay super cheap. But good look getting through an enterprise cybersecurity audit or ISO27000+SOC2 certification.
It's absolutely fine. Everyone has just gone stupid recently.
People have zero concept of how incredibly absurdly fast even a slow computer is. Storage is literally 1000x faster than it was 15 years ago.
With the multi million dollars A MONTH purchase commitment contracts I've seen in my previous employers, you could use a single month budget to buy hardware that could serve our applications for years.
totally different words
In 30 years of hosting on-prem or in colo facilities, I've never once bought hardware up front for corporate accounts.
No thanks.
The math has drastically changed over the last few years. For example, the on-prem database server we bought 4 years ago for $14K is now pricing out at $96K.
They can negotiate better prices based on their scale, and even on their ability to internally source key components if needed.
E.g. if AWS/Microsoft/Google/Apple buy 80% of Micron's entire output it's probably at a much better price than the rest of us competing over the other 20% are going to get.
Even just going to second tier cloud providers will tend to let you rent similar capacity much cheaper.
AWS and the other big cloud providers only gets close to cost efficient when you're big enough to negotiate prices that are nowhere near their public list prices.
And by which time you are spending an ungodly amount of money per month !
Which is why second tier providers are the way to go.
You get better prices. Much clearer price models. Better customer service....
... And all without having to commit to spending more than the GDP of a small country every month on your cloud bill.
A global supply chain storage is a global supply chain shortage.
Most famous recent example being Apple who were absorbing the rapidly increasing cost of supply until even they had to put up the prices to reflect procurement and manufacturing reality.
And this is Apple. The company that even buys its manufacturers plant equipment in return for it being dedicated to Apple.
Yes the big boys get volume discount. But that doesn't magically entitle them to last decades's pricing.
You’re trying to refute an argument I did not make.
They do not have to be cheaper than 2016. They have to be cheaper than what your business could otherwise string together paying current market prices. And they will be.
Four years ago, I needed 256gb of ram, and it was costing about $1-2k a month in the cloud, which I replaced with a server on ebay with 1,5tb of ram for about €2k- which I was pricing against equivalent to what I was renting for about $6k or so on newegg. And I think the dumbest IT procurement manager in the planet could've gotten it from Lenovo or HPE or something for $10k providing the easiest 20% savings if they move on-prem.
How much is your $96k server on AWS?
Depends on your metrics. Say you're an early startup - short on man-hours and bare-metal skills, with backers who think that "cloud" sounds fast, cool, and scalable.
Or your a VP at some big company - with C-suite mandate to deliver Cool Solutions ASAP, whatever the cost...but a byzantine mess of middle managers between you and the actual engineers. Deciding "we'll use CloudCo" can rob your steaming heap of PHB's of a lot of opportunities to make bad decisions and drag things out.
Certain latency increase must be traded for scalability. But atleast we get the required utility in return.
But without that utility, one is just hiking up the cost. Any competitor who can deliver at reduced cost holds a potent weapon that you simply cannot survive.
Cost is a weapon. One of the most fundamental weapon in almost all domains.
The argument of cost is fundamental and no amount of Kafka, etc. can override it.
Considering that the topic is an article is comparing raw NVMe vs EBS performance for postgres storage and GP saying that cloud is unnecessarily inefficient, I misinterpreted your comment as implying that networked storage is always an unnecessary cost. In many cases the cost of replication and availability is lower than the cost of data loss and downtime.
I don't think this is true. I am not sure about those you described, but say you have PG replicas, you can run query on replica node without hitting some network attached storage. This is obviously true for reads but not for writes.
Everywhere we look we see people making the best choice for them. Big apps using Electron vs native. Ports of 250MB games like Starcraft now taking 5GB of "compatibility" libraries to run on modern PCs.
I completely agree that people need to be aware of Latency Numbers Every Programmer Should Know (https://gist.github.com/jboner/2841832), but in reality we don't all have the budget, time, or personal to do things the right way when it's the company ordering us around vs our own projects where we can do things "the right way".
Honestly, I'm glad companies are wasteful. If large companies were super conservative and agile then our economy would be in really, really bad shape. It's thanks to these inefficiencies that small startups can jump in and capitalize in ways bureaucracies of PM's can't.
I am no fan of the idea of reinventing everything to run on cloud primitives but you can't deny reliability of online software is a lot higher now than the pre HTML5 era. Back then, having more than two nines of uptime for random backend heavy web apps was hardly common while now it's table stakes.
They also told me that they've started as a h/w shop and that they have competitors who are building ASICs rather than programming FPGAs to do the same (with, potentially, even more performance gains).
This completely changed the perspective for me. Before, I had this idea that if I need to optimize database performance, I'd first look at indices. Then, at how much memory is available to the database for various tasks. Only after that, I'd look at I/O performance, but, mostly, because of fsync configuration.
It wouldn't even appear to me as a possibility that the compute can become the culprit of optimization. But, apparently, it's a new hot thing.
* * *
From my experience with storage testing, which also included quite a bit of pg-bench exposure... My impression was this: the sort of query that is used for performance benchmark matters the most. It will define the optimization direction. Blindly trying to add or speed-up one resource or another is not going to be an efficient strategy. In the database world, there's this idea of an "ideal" benchmark. Without too much detail, it imagines an "ideal" business accounting back-end, the sort of queries it would have to execute. It defines an "ideal" unit that roughly encompasses one "sale", and then it measures how many such "sales" a business can perform per unit of time. This will translate into some ratio of selects / inserts / deletes / updates with some index hits and some linear searches etc. But it's all extremely vague and it's very hard to adapt this benchmark to the actual business needs of the database being tested.
There's also a question what to optimize for: the resource usage? the response speed? the concurrency? In some scenarios, I can see how storage would factor in, but there are also certainly scenarios where using a faster, in some sense, storage will not result in any meaningful gains.
Trying to grow a business that relies on bespoke hardware in the age of cloud monopoly is an uphill battle.
Though it looks like they didn't follow up on these and can't find them for sale
The company I talked to explained the use of FPGA by saying that FPGAs are offered by major cloud vendor, and so are a commercially viable direction. While making their own dedicated chips is not only a lot more expensive, but also doesn't have a lot of customers (people don't want to maintain their own h/w, especially of a bespoke variety). The bespoke part might be why Samsung didn't pursue the idea. Essentially, if eg. AWS doesn't buy this from you and makes it an offering that customers may reasonably rely on, it's too hard to sell.
Well written databases are frequently I/O bottlenecked and getting a good storage/network setup can thus grant massive performance gains. But this is hard, operationally. The difficulty of developing the right opinions about hardware design, acquiring it, properly wiring it up, tuning it and ensuring really excellent performance across the stack was recognized by Oracle decades ago, which led to the creation of ExaData.
ExaData is a bit like Oxide, if you've encountered them. It's basically a cloud database in a pre-manufactured rack. You buy an ExaData rack and it turns up at your on-prem colo facility, you plug it in, and now you have a fast database. Internally it has a dedicated high speed InfiniBand or RoCE RDMA capable backplane network and handles replicated between storage devices itself. There's an alerting system and repl-like tool that guides you through swapping out failed storage devices, you can expand it by adding more racks, and there are various cloud hosted versions of all of this if your budget doesn't stretch to your own full system.
The software stack on top of that provides fast multi-master synchronous writes by using RAM as a shared disk cache. If a node needs to read a block off disk it will prefer to read it directly out of the RAM of another node using RDMA across the dedicated backplane than go to storage, so if you buy the high capacity variant then you have a three tier storage system: HDDs for cold data, flash as a cache and DRAM as another cache on top of that, all kept in sync using cache coherency protocols.
There are lots of optimizations on top of that which a Postgres-on-EBS architecture can't match, for example, the storage nodes that handle the disks and serve blocks can have some of the query computations pushed down to them to reduce IO across the backplane and accelerate query execution. A final 'optimization' is that Oracle uses a different MVCC algorithm that doesn't require vacuuming and can be more IO efficient in general (doesn't copy whole rows); there are patch sets that switch Postgres to an Oracle-style MVCC engine but none of them were ever merged.
The whole thing acts as a single coherent database, so e.g. rolling upgrades across the rack's cluster don't cause downtime because transactions can be handed off across nodes. Clients can discover the IP addresses of the individual servers automatically and shift their traffic across nodes in response to load balancing requests from the system, etc.
I'm not sure it's a good idea to run a Postgres cluster like the one described in the article unless you have a lot of appetite for manual operations. If you can tolerate downtime or if you're renting bare metal where you can configure a proper RAID setup, then OK, but if you care a lot about query performance to begin with then a commercial database will win in a lot of ways (doesn't have to be Oracle, commercial RDBMS in general is a much more competitive space than open source).
Obligatory disclaimer: opinions above are not corporate approved.
I think there's a generation of devs that just takes big memory pools and SSDs for granted; there's a mental disconnect to the fact databases map the underlying storage.
It becomes obvious once I bring it up with them in discussion and I can almost see the bulb go off (happened while discussing partitioning and sharding), but they never make the connection that a query is mapping to some artifacts sitting on storage.
In our case the primary index on a table was a something like a sequential ID but the table stored data from multiple tenants so each page had data from multiple tenants
Took a while to convince people that the DB was always going to read 16KB chunks so we could reduce IO by changing the primary index so it was based around an ID that was unique to the tenant
Yikes. I'm mostly frontend and even to me this seems pretty clear.
Including relevant columns in the index can massively improve the performance, because postgres does not need to read the randomly sorted tuple in the original table.
The indices will bloat in size (postgres does not vacuum them in the way a table is vacuumed), and begin to bottleneck primary writer latency.
You should repack the indices every once in a while (you can set up monitors on index bloat) with something like pg_repack, and make sure that your indices are minimally-sized (i.e. omit rows that are never scanned, use pg_stat to verify which indices are actually used by the primary or read-replicas).
While the standard approach ensures service reliability and leverages Kubernetes' self-healing capabilities, there are scenarios where operating with a temporarily degraded cluster may be acceptable. This is particularly relevant for PostgreSQL clusters relying on node-local storage, where the storage is local to the Kubernetes worker node running the PostgreSQL database. Node-local storage, or simply local storage, is employed to enhance performance.
[0] main features https://cloudnative-pg.io/docs/devel/#main-features [1] https://cloudnative-pg.io/docs/devel/kubernetes_upgrade/#tem...
With application-level replication, you can amortize it to a few steps (e.g. on commit, do 2PC).
Obviously there's nuance, esp if you have to read from another node, but it's why moving replication as far up the stack as possible generally performs better with DBs -- the DB knows when to touch the network better than the disk.