9 ms·
Why would you run your own Postgres instance on EC2 within AWS? That kind of defeats the purpose of paying for AWS. Why not use Postgres RDS or Aurora? It mak
by scarface74 8y ago
Why would you run your own Postgres instance on EC2 within AWS? That kind of defeats the purpose of paying for AWS. Why not use Postgres RDS or Aurora?
It makes some sense with Sql Server and Oracle in a few cases because of licensing but hosting your own Postgres instance on AWS is the worse of both worlds -- you're paying more than with a cheaper VPS and you have to do all of the maintenance yourself and not taking advantage of all of things that AWS provides -- point in time restores, easy cross region read replicas, faster disk io (Aurora), etc.
- hamandcheese 8y agoWell, if your business requires running databases really well it might be preferable to run your own. If they were using RDS they would not have been able to get this level of insight into their infra. Maybe RDS is already configured correctly. Maybe not. But at a certain scale not having your hands tied becomes more valuable than having everything taken care of for you.
- arciini 8y agoGiven that they're an analytics company, they probably have 2 problems with using Aurora/RDS. Note that these are educated guesses from their statement: "Heap’s data is stored in a Postgres cluster running on i3 instances in EC2. These are machines with large amounts of NVMe storage—they’re rated at up to 3 million IOPS, perfect for high transaction volume database use cases" 1. Aurora charges per-request ($0.20/million). Given that analytics comes with tons of events and that they wanted servers that have up to 3 million IOPS, it can get pricey fast. 2. RDS has database instances that have SSDs that provide "up to 40,000 IOPS" per instance in their provisioned case, which is probably not enough.
- nil_pointer 8y agoIf you compare the hourly cost for any instance on EC2 vs RDS, it's significantly more expensive for the managed solution (75%+ more), which is to be expected. I know people who roll their own for cost savings.
- plopz 8y agoIf you're going for cost savings I wouldn't think you would be on AWS in the first place.
- zepolen 8y agoSome people think AWS is cheaper than DIY.
- scarface74 8y agoAs an AWS certified true believer, I can attest to the fact that if you’re using an on prem mindset with a bunch of EC2 instances, AWS is always more expensive. The cost savings comes in taking advantage of AWS features in terms of mostly people. If you are architecting everything on AWS trying to avoid “lock-in” you’re going to move slower and pay more - the worse of both worlds.
- mmt 8y agoThose people are both correct and incorrect. Neither costs a fixed, single amount. Both are ranges that depend on the competence of the practitioner. For example, it's cheaper to use a reserved EC2 instance for 1 year than just on demand. Similarly, the default cost for DIY is much higher than the lower bound of the range. If DIY includes "enterprise" hardware, software, and/or support contracts (which arguably contradicts the "Y" in DIY), then the top end of that cost range is easily above the top end of the AWS cost range. In this way, those people are correct. However, if we limit it to truly doing it yourself [1] and with commodity hardware, software, and methods, that's no longer true. More importantly, as the GP mentioned, "If you're going for cost savings", it's the bottom end of the cost ranges that are key, and, even at modest scale, AWS is way above DIY. In this way, those people are incorrect. [1] There's a limit, of course. For me, that limit is commodity versus custom. It's safe to outsource server manufacturing (all the way up through assembly, initial burn-in, and even rack/stack), since, it's easy enough to replace with a different vendor. It's not safe to outsource specifying what goes into those servers or final "smoke" testing. Sometimes, even for something that's safe to outsource, like remote-hands replacement of failed parts, it may not be worth the price.
- aidos 8y agoIn my experience you get much better performance outside of RDS and you can inspect and tune it better. Maybe I’m missing something and no doubt I could put more work into it but we’ve actually talked about moving our RDS dbs back to EC2 because there are plenty of queries we do that are embarrassingly slow on RDS when they shouldn’t be. Also, you can’t replicate out of RDS. I like to know where my data is and how to bring it back online during a disaster.
- mrep 8y agoWhat do you mean by replicate because my old teammate was able to set up a slave from a RDS master to a non-RDS database.
- chc 8y agoI've worked on a project that migrated from MySQL on EC2 to MySQL on RDS and then back to EC2 because the performance was massively worse — a process that took a few hours before now took days. We contacted Amazon support to try and resolve whatever was going wrong with the RDS instance, and their response was basically "Yeah, we don't guarantee performance on RDS. If you want to maximize performance, you should run your own DB on EC2."
- nodesocket 8y agoIt makes sense because of the dependency on EBS, but what instance type were you using on RDS? Using provisioned IOPS RDS disk?
- chc 8y agoWe tried a few very large instance types to see if that made any difference, and provisioned IOPS did help, but everything was still slower than the EC2 DB and it cost a lot more on top of that.
- scarface74 8y agoPostgres RDS or Postgres Aurora? What’s more likely. That your one data center has a disaster or a globally redundant AWS infrastructure.
- wahern 8y agoSometimes you're forced to use AWS for a very specific reason, technical or non-technical, subject to change in the future. (For example, literally being given a large 7 figure "credit" as occurred at a previous job.) Letting the application become completely and irreversibly dependent on [expensive] AWS services may not be desirable. But who are we kidding... it's impossible to resist and its why AWS rakes in cash. That said, not being able to use vDSOs for time querying APIs isn't just a problem for databases, it's potentially a significant problem for asynchronous software, like Node.js, that do userspace event scheduling bookkeeping. Typically every iteration of the event loop performs at least one time query, but depending on how the software is coded often there might be one or more time queries per event processed per event loop iteration.
- cyberpunk0 8y agoIt's very possible to resist
- Crosseye_Jack 8y agoYes and no. I will say its depends on what else you are running on AWS. As long as you don't code yourself into a corner so it could be a right ball ache switching providers moving away from AWS shouldn't be too much of a problem. Remember (not you but the people who made your comment dead) AWS aswell as every other provider want to lock you in. I say this as someone who uses AWS. But their are things that still tick me off with the platform. As an example They don't make it easy to RDNS a light sail instance verses an EC2 instance so you want to RDNS to help with that outgoing email server you want to set up its easier to pay for a micro ec2 then use lightsail for the same purpose (which comes with included bandwidth and its an outgoing email server so its not like CPU is a major issue) or use SNS, but its more beneficial to AWS for you to use ec2 or sns even if its not to you because of your end of month bill. Anyways my point is its possible to resist the AWS lock in with a bit of forward thinking as long as you code for the possibility that you might want to swap providers.
- wahern 8y agoIt's one thing for an engineer to resist (or resist in principle). It's another thing entirely for an organization to resist. One team taking the expedient route can wed the organization to AWS forever. It's how the mainframe and Windows ecosystems worked. Kudos to AWS for figuring out how to capture the exploding market for Linux- and OSS-dependent stacks.
- kornish 8y agoI believe Heap is using a compressed filesystem and also highly dependent on a Postgres plugin that RDS doesn't currently support.
- sb8244 8y agoHeap uses Citus DB which is not RDS compatible https://www.citusdata.com/customers/heap https://www.citusdata.com/customers/heap Citus has been a huge part of our scaling story from RDS (maxed out instances and did a ton of tuning) to Citus Cloud. I can only imagine that Heap has a ton more problems than we've experienced.
- kornish 8y agoHeap’s usage of Citus predates the rollout of Citus Cloud so definitely hats off to them for their operational know-how. I wonder if they’ve considered switching — my guess is that the compressed filesystem probably results in material savings for them so that’s likely a reason to keep operating their own cluster.
- sb8244 8y agoIt does probably make sense for heap to manage it themselves given it is a core competency of theirs, based on their indexing talks
- whalesalad 8y agoDefeats the purpose? There’s a lot that you cannot do with hosted software that you can do with your own custom setup. When you outgrow the hosted version the natural progression is to do it yourself.
- dylrich 8y agoPostgres RDS is missing libprotobuf-c, which is a dependency for cutting MapBox Vector Tiles if you use PostGIS/Postgres that way. A small, legitimate exception to your statement. https://forums.aws.amazon.com/thread.jspa?threadID=277371 https://forums.aws.amazon.com/thread.jspa?threadID=277371
- dbetteridge 8y agoI can't believe this still hasn't been fixed :/ we ended up having to roll our own mapnik geojson->MVT querying layer to work around it
- nasalgoat 8y agoIt's cheaper and much more tuneable.
- scarface74 8y agoAs far as cheaper, are you including the man hours to manage servers?
- nasalgoat 8y agoHundreds of dollars a month cheaper. Well worth it.
- cpburns2009 8y agoWell for one it makes it a lot easier to have a duplicate local environment (i.e., not on AWS) to test on before pushing changes into your production environment (on AWS). It also helps prevent vendor lock-in. I'll stick to managing my own database instances.
- scarface74 8y agoIt’s Postgres. You use the same drivers, same commands, etc. Their is nothing special you do to support Postgres RDS.
- sueders101 8y agoPostgres RDS limits you to only the extensions they make available to you. That alone can be enough to turn off some people. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.FeatureSupport.Extensions.101x https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_...
- outworlder 8y agoOur case: AWS is not the only environment we support. We deploy the same PG version, same config files and scripts across all major clouds, openstack and even baremetal.
- manigandham 8y agoHeap is an analytics company that stores all (json) events automatically and then provides real-time queries. Their business sustainability is directly tied to how effectively they store and query this data. They solve it with a large cluster of Postgres server running fast disks with partitioning handled by the Citus extension, along with several low-level tweaks. RDS does not support these scales or any clustering. Aurora does not have parallel processing. Redshift would be fast but is very expensive and does not have the same level of Postgres features. There is Citus Cloud so you can get close to Heap's setup with Citus maintaining it all, but that gets pricey too.
- appwiz 8y agoAurora announced support for parallel queries[1] for MySQL, with Postgres coming soon. (I work at AWS but not RDS/Aurora) [1] https://aws.amazon.com/blogs/aws/new-parallel-query-for-amazon-aurora/
- scarface74 8y agoIt looks like as of the 20th it is official.
- misframer 8y agoRDS doesn't support extensions like TimescaleDB or (as someone else mentioned) Citus.
- foolfoolz 8y agobecause RDS and Aurora do not have a good story around schema migrations. and there’s “maintenance periods”
- kalmar 8y agoHi post author here! First off, we actually do use RDS for other databases. As you point out, having a lot of the operational stuff taken care of for you is great. The post is specifically about our Citus cluster, which stores the analytics data for all our customers. Most of the reasons we do this have been given by other folks in the replies: * RDS doesn't support the Citus extension * data is stored on ZFS for filesystem compression * we get significantly higher disk performance from these instances' NVMe attached storage, which isn't available for RDS
- ricw 8y agoA couple of reasons, in this case for a Postgres instance that has 2TB of data. 1) price: you’ll easily spend $$$$$$ on RDS. If you host it on something equivalent with native SSD you’re looking at $800 a month with better performance 2) performance. It’s way faster and you can tune your indices, create views and make it fast and efficient in a predictable way. 3) if you want to, you can easily migrate to a different service. We did just that two months ago, from google cloud to AWS. It gives us vendor independence.
- plicense 8y agoCurious - why did you move from google to aws? How has it been after the move?
- ricw 8y agoGoogle has the way better interface and configurability. They’re also cheaper. Reasons for moving: 1) Google had a mean bug that dropped long standing connections within their own network, and they blamed us despite following all the guides (linger timeouts etc). So had to move anyways. 2) The biggest reason was that we were given free credits by AWS.
- PopeDotNinja 8y agoTurning on Postgres features not exposed by the cloud version(s).
- adrr 8y agoBecause I can get extremely high IOPs on EC2 without paying a fortune. EBS is slow compared to MME SSD drives. Stripe 4 MME drives together and you can have over 1 million IOPs.
- malisper 8y agoHi. I'm one of the database engineers at Heap. This is a good question. There are several reasons why we use EC2. First of all, I will say I love RDS as a product. We actually do use RDS for a number of our services. We use Postgres on EC2 only for our primary data store. As for reasons why we use EC2: Cost - Our primary data store has >1 Petabyte of raw data stored across dozens of Postgres instances. The amount of data we store is at the point where RDS is too expensive for us. The cost of an instance on RDS is more than twice the cost on EC2. For example, an on-demand r4.8xl on EC2 instance costs $2.13 an hour, while an RDS r4.8xl costs $4.80 an hour. Performance - The only kind of disk available on RDS is EBS. EBS is slow compared to the NVMe the i3s provide. We used to use r3s with EBS and got a major speedup when we switched to i3s. As a side note, the cost of an i3 is also less than the cost of an r3 with an equivalent amount of EBS. Configuration - By using EC2 we can configure our machines in ways we wouldn't be able to if we used RDS. For example, we run ZFS on our EC2 instances which compresses our data by 2x. By compressing our data, we get a major cost saving and a major performance boost at the same time! There isn't an easy way to compress your data if you use RDS. Introspection - There are times where we've needed to debug performance problems with Postgres and EXPLAIN ANALYZE won't suffice. A good example is we used flame graphs to see what Postgres was using CPU for. We made a small change that resulted in a 10x improvement to ingestion throughput. If you are curious, I wrote a blog post on this investigation: https://heapanalytics.com/blog/engineering/basic-performance-analysis-saved-us-millions https://heapanalytics.com/blog/engineering/basic-performance...
- deleted 8y ago[deleted]
- _msw_ 8y agoHi, I'm one of the engineers at Amazon working on EC2. You can also run get bare metal I3 instances by launching the "i3.metal" instance type. You don't need to wait for the Nitro hypervisor, you can go with no hypervisor at all.
- kalmar 8y agoAnd you get 4 extra cores and 24 gigs of ram "for free" vs i3.16xl (which is what we use). I think we looked into switching but it wasn't clear if the reservations could be switched over.
- chillydawg 8y agoYou don't get super user access to postgres via RDS. You can't use logical replication. Plenty of other plugins don't work. For complex use cases, RDS is often a no go.
- flurdy 8y ago* Cost Running costs: Plain EC2 DB is cheaper than RDS. RDS is instance costs plus RDS tax. Configuration and maintenance cost: RDS obviously cheaper * Performance As other replies have detailed plain EC2 with NVMe etc could be significantly faster. * Convenience RDS wins most of the time. * Risk RDS wins unless heavy investment So it depends on your requirement. If high performance with massive DBs is important, then the costs of managing your own DBs may make sense. If a low throughput, less risky DB then your own DB may make sense. If a normal business use DB, outsourcing the maintenance and risk to RDS may make sense.
- scarface74 8y agoThat’s a great explanation. I’m stealing that for my next life as an AWS consultant.
- gigatexal 8y agoBecause RDS is expensive and I want to control my databases.