9 ms·
How Modern SQL Databases Are Changing Web Development: Part 1
- toyg 3y agoThis repurposing of "edge" to mean "browser" continues to confuse me.
- deleted 3y ago[deleted]
- mvandermeulen 3y agoI’m fairness his browser could be called edge too
- Ensorceled 3y agoYeah, “edge environment” threw me.
- jasode 3y ago>This repurposing of "edge" to mean "browser" continues to confuse me. I did Ctrl+F search for "edge" in this thread's article and all 23 instances of it seems to be talking about computing on an edge node such as a CDN. Example sentence: "Edge-Ready Drivers -- Regarding supporting connections from the edge, [...] Things have been changing fast. PlanetScale announced its “Fetch API-compatible” database driver a few months ago, making it fully useable from Vercel Edge Runtime and Cloudflare Workers." Can you point to where you think he used "edge" to be synonymous with Chrome/Firefox?
- deleted 3y ago[deleted]
- Spooky23 3y agoIt’s funny as servers locally or regionally, co-located close to users, was this stupid legacy thing a couple of years ago. I remember being at a conference and everyone being amazed that Chick-Fil-A dared the impossible - putting K8S clusters at each store to run operations. Lol. This business always makes me laugh.
- midiguy 3y agoI kind of hate how this article did not once clearly explain what it meant by the nebulous term 'edge'.
- ggregoire 3y agoYea same. I was confused when the article said "edge environments can't connect to a database via TCP".
- nailer 3y ago> Serverless databases are not a new thing. AWS launched Aurora back in 2017 App Engine (which was the first popular serverless platform, before the term was coined) included a datastore about 7 years prior.
- unscaled 3y ago[tl;dr: Serverless provisioning for data is far from a new concept, but it wasn't called "serverless" before serverless compute (functions) appeared. OP probably meant that Aurora was the first serverless SQL database, but even that statement is debatable.] It probably avoids recognition because it was tied to App Engine, which wasn't serverless by itself, and predated the popularization of the term serverless. I can identify a few other serverless NoSQL databases that predated the serverless hype: Azure Storage Tables and CosmosDB (known as DocumentDB back when it was released in 2014) for one. I haven't used DynamoDB back then, but it seems like it was also serverless from day one[1]. I think the author really wanted to say "Serverless SQL databases are not a new thing. AWS launched Aurora back in 2017 [...]". That might check out if you don't count Cloud Spanner as "true" SQL[2], but I'm wouldn't be surprised if you'd find someone who has implemented a niche SQL database service that wasn't provisioned and kinda supported scaling up as needed. [1] "Amazon DynamoDB lets you specify the request throughput you want your table to be able to achieve (your table’s “throughput capacity”). Behind the scenes, the service handles the provisioning of resources to achieve the requested throughput rate. Rather than asking you to think about instances, hardware, memory, and other factors that could affect your throughput rate, we simply ask you to provision the throughput level you want to achieve and we handle the rest." [2] Amazon only launched Aurora on 2018, even though they announced it in late 2018. Cloud Spanner was released a full year before, and Spanner was running internally on Google datacenters, possibly with serverless provisioning, since 2012.
- nailer 3y ago> it was tied to App Engine, which wasn't serverless by itself Yes it was. I’m not sure how long you’ve been doing serverless for but App Engine’s entire concept was stateless functions.
- bob1029 3y agoThe "serverless" angle is super compelling for us. We don't have a lot of time to think about this kind of thing. Being able to go from 0 to 100TB with compute/storage scaling automagically is simply bananas value. I don't really care what it costs anymore. I know the herd will mostly protect us with regard to pricing (our utilization is paltry compared to advertised use cases). I totally get the HTAP argument now. I have absolutely zero anxiety about some rogue select causing trouble in a reporting context because of how trivial everything became. Things like adding read replicas for one-off reporting needs is a non-event now.
- lagniappe 3y agoAh, so this is web-scale, at long last
- endisneigh 3y agoThough serverless is compelling, the few cases where I've actually seen someone need the sudden increase in compute with both Firestore and DynamoDB, it failed to deliver performantly. That being said this was in the 2010s, I'm sure things have improved by now.
- edgyquant 3y agoServerless is a footgun. The limit on response size means people who don’t build things with them in mind suddenly can’t scale when they get actual customers.
- endisneigh 3y agoThe development of things saddens me. (re: this whole thing about serverless and edge). It should be that it's becoming easier to have a robust database (or job queue, or full text search, etc) on your premises, not have more and more go to the cloud. Though it is true that managing your own infrastructure can be challenging, it is not inherently so. One can easily imagine self healing and self managing infrastructure, physical hardware deterioration and replacement aside. EDIT: I want to clarify that I'm not denouncing the cloud. My point is simply that it should be easier to also manage your own fleet if you so choose. This could mean using VMs, bare metal or what have you. Even managing a fleet of VMs is nightmareish today.
- throwaway98158 3y agoCan you explain how can physical hardware concerns be handwaved away? It's not just about the hardware itself, that's the easiest part. It's about building and maintaining the electrical/cooling/network infrastructure the servers require. It's about having multiple locations of that in case your building's power or network goes down/there's a flood/somebody steals all your stuff/whatever else. Or you rent a rack in a colo (or five)... But that's just a step away from going full cloud, you just do a lot of work yourself and get no guarantees and no flexibility. At that point, why not just go full cloud?
- endisneigh 3y agoThis is not the 90s - monitoring and alerting are far more robust, and supply chains far more just in time. There’s no reason a modern fleet couldn’t detect failures in hardware and automatically order replacement from Amazon or whatever. This is not to say you won’t need personnel, but you would be surprised how much of the fleet management at AWS and GCP at least are brute forced (as opposed to being completely automatic). To their defense they have a far more complicated and diverse fleet than what I’m describing, which is sort of my point. 99% of customers just need a highly available setup for their stateful boxes (DBs) and some for their stateless services. And the great thing about this setup is you can extend the stateless bit (with the cost of latency) to the cloud more or less infinitely. As far as the rest of your point about cooling and network - it's a good point, but for a workload that isn't a datacenter, in my experience the majority of outages aren't due to that - it's due to misconfiguration. Take a personal house. How often does someone break into the average person's home? Pretty unlikely in a low crime area. Take internet. There are some areas in the United States where there are multiple 1Gbs or even 10Gbs internet providers, you could redundantly network. In any case it's not that the cloud shouldn't be used, it's just interesting the direction things are going. Of course, if money isn't an issue by all means people should use serverless and cloud spanner and be done with it.
- danesparza 3y agoNone of these things are new. Connection pooling (in particular) has been around for decades. Perhaps the author just recently discovered it?
- seedless-sensat 3y agoThe author also mentions Neon is the first "pioneer" to do disaggregated storage. It is mentioned in the 2006 Bigtable paper, and probably earlier than that too.
- butlerm 3y agoDatabases like Oracle Parallel Server were doing disaggregated storage more than a decade before that.
- smallerfish 3y ago> separation of “Compute” and “Storage”. Yes, I’m explicitly talking about Neon here since it was the first to pioneer the concept Aurora certainly did that earlier, and there were probably other earlier examples also (funny, because author mentioned Aurora upthread). > in edge environments because, for every incoming request, a new runtime is spawned to serve it Said that way, it's hard not to think "CGI-bin on a server nearest the user (because webscale)". Coming soon: "the all new Persistent Edge, a runtime that actually stays up between requests, on a server nearest the user (because webscale) optimizing away startup costs!"
- jeeyoungk 3y agoBig Data systems (Spark / Hadoop over S3) really pioneered this, as the original MapReduce paradigm had fairly tight coupling between compute and data.
- worksonmine 3y agoIn other words, you should cache and shard your data. I hate this industry.
- Joeri 3y agoI keep rejecting this definition of "serverless" in my head. There's just as much server, it's just that someone else owns and operates the server, and holds your data or application hostage when they want to. This thing currently called "serverless" is more like "server as a service", and creates more lock-in than what came before. True serverless would mean a return to dumb interchangeable servers: static progressive web applications hosted by dumb static http servers (e.g. github pages), connecting to interchangeable data storage (e.g. W3C solid pods), with client-side peer to peer synchronization of data using CRDT algorithms (e.g. Automerge, YJS, ...). When I think of the word "serverless", that's what comes to mind.
- falcor84 3y agoHear hear. I'd be really interested in an open standard that would expose something like IndexedDB on the client-side while enabling sync and basic business logic. Maybe inspired by the firebase API.
- gelatocar 3y agoNot sure if you're thinking more of an official standard but PouchDB is open source and sounds similar to what you're talking about: https://pouchdb.com/ https://pouchdb.com/
- endisneigh 3y agoA strange take. If you’re going to be pedantic you might as well be correct - server less would mean literally that, no server required, e.g. Apple Notes or Microsoft Word 2010 and more similar to the end of your comment (a solid pod isn't serverless either btw) and CRDT is totally irrelevant here - you could use CRDTs and still not have an offline application. A GitHub page is in no way serverless. It’s totally inaccessible without internet and requires literally a remote server to function. Ironically GitHub page is more similar to the marketing definition of serverless.
- Joeri 3y agoIf we’re going to be pedantic, let me point out that for a pwa a connection to the server is only required for initial install and successive data synchronization, so the operation of the web app I described is indeed literally serverless outside of those edge cases.
- _ben_ 3y agoAt PolyScale [1] we tackle many of the same challenges. Some of this article feels a little dated to me but the data distribution, connectivity and scaling challenges are valid. We use caching to store data and run SQL compute at the edge. It is wire protocol compatible with various databases (Postgres, MySQL, MS SQL, MariaDB) and it dramatically reduces query execution times and lower latency. It also has a JS driver for SQL over HTTP, as well as connection pooling for both TCP and HTTP. https://www.polyscale.ai/ https://www.polyscale.ai/
- avinassh 3y agoThis is interesting! How does polyscale works, especially this part: > PolyScale automatically and intelligently caches or invalidates data close to where it is being requested.
- skybrian 3y agoThis pitch is rather opaque to me. How does cache invalidation actually work? I don't see how cache invalidation happens at all unless all changes go through PolyScale. What about making a change to the database directly?
- _ben_ 3y agoThanks for the questions. At a very high level, the AI uses statistical models that learn in real-time and estimate how frequently the data on the database is changing. The TTL's get set accordingly and are set per SQL query. The model looks at many inputs such as the payload sizes being returned from the database as well as arrival rates. If PolyScale can see mutation queries (inserts, updates, deletes) it will automatically invalidate, just the effected data from the cache, globally. If you make changes directly to the database out of band to PolyScale, you have a few options depending on the use case. Firstly, the AI, statistical based models will invalidate. Secondly, you can purge - for example after a scheduled import etc. Thirdly, you can plug in CDC streams to power the invalidations. Feel free to ping me if you would like to dig in deeper (ben at) and this document provides more detail on the caching protocol: https://docs.polyscale.ai/how-does-it-work#caching-protocol https://docs.polyscale.ai/how-does-it-work#caching-protocol This blog also goes in to detail on how invalidation works: https://www.polyscale.ai/blog/approaching-cache-invalidation/ https://www.polyscale.ai/blog/approaching-cache-invalidation...
- ppeetteerr 3y agoIt took me a while to get some context here but the article makes sense. Maybe more outside the topic but related: why would you put business logic closer to the user when that's rarely the performance bottleneck? You could cache computed data closer to the user (on the edge) to avoid the longer round trip to your host, but putting your Node backed closer to the user just makes the trip from backend to the DB longer? Is the latency from edge to DB really that much better? Maybe what you're optimizing for is something like serving cached data behind auth which does require some business logic (hence the caching of part of the DB at the edge as well)? Seems cool but back to the article which claims that it changes modern web development. Modern web development sounds for the most part the same. Maybe the article can be called "How Modern SQL Databases Are Enabling Distributed Web Development"?
- satyrnein 3y agoIf your server is just fetching data, then it doesn't seem like much benefit to have the server close to the user unless the data is also close to the user at least some of the time (caching, distributed db, etc). However, if your server is doing other work, it might be useful to be close to users even if the data isn't. This is why fly.io sponsors stuff like Phoenix Liveview or Laravel Livewire.
- ppeetteerr 3y agoTotally agree that function locality is important, especially if latency reduction is your biggest opportunity. Edge compute feels like a niche problem for most businesses, and it comes with high overhead costs in setup and maintenance. You mentioned Liveview and Livewire. Both are great and they would work equally well in any context, not exclusively a server less front-end. I would propose that switching to a more efficient programming language (i.e. not using Elixir or PHP) and investing in better data structure optimization would result in equal if not better performance improvements than investing the same amount of time wrangling data replication issues and infrastructure maintenance caused by edge compute. To the point of the original article, modern web development remains the same: start with a single server, server-side render your content, and expand when the need arises. What we're talking about in the comments is performance web development for geographically distributed audiences (for instance, if you're building a global social network).
- daveaiello 3y agoI have used both SQL and NoSQL databases in the cloud. My sense of the situation at the moment is that some NoSQL databases have begun to focus on AI and LLM applications, apparently in order to provide scalable storage to these applications, which can be used for things like the persistence of state across many interactions. However, there are always going to be legions of use cases for traditional database use, and the question continues to be, should everything that could need to scale massively use a NoSQL backend, or can some applications get by with something that looks like a traditional SQL architecture in 99+% of cases? I think that many applications could be constructed with a NoSQL database as the backend for applications that are primarily reading content, while the applications that require the greatest access to CRUD functionality could interact with a SQL database using connection pooling to minimize resource utilization or latency at scale. With this in mind, I could see applications where editing the backend is done in a SQL-based version of the database, while rendering content from the backend is done against a NoSQL version of the same database. There would probably be some momentary differences between the two, but the interface between the SQL and NoSQL version of the database could be a pipeline and therefore, could be optimized.
- say_it_as_it_is 3y agoModern implies progress. Serverless isn't progress. It's not the rising tide that lifts all boats.
- deleted 3y ago[deleted]
- holoduke 3y agoIn the meantime i am learning my 12 year old one how to install a debian server. Install postgresql and some scripting languages. Then we proceed to make a simple website with a simple backend. There is so much more joy into learning stuff from this level.
- panarky 3y agoIf I'd tried to start my kids on how to install software on an operating system, and how to write bash and SQL, they would have lost interest instantaneously. I found the gateway drug was a robot that could do simple things, then modifying the code to make it do different things.
- whispersnow 3y agoYour kid is way too advanced! I am sticking with Code.org
- ppeetteerr 3y agoThis is the way. Too many engineers are disconnected from the metal.
- 3y ago
- Transpire7487 3y agoand I’m still using regular postgres just fine for over a decade and no plans to stop any time soon serverless has mostly been hype and snake oil for me Nothing beats a beefy box of metal
- riku_iki 3y agowhat is your story for fault tolerance and replication (hopefully cross geo zone). Do you set and run everything yourself? How much effort(including learning curve) and expertise does it require? Why wouldn't you use some cloud offering where you can get many of these for cheap if your data is not large?
- NorwegianDude 3y agoWhat makes you think cloud is cheap, or reliable? AWS lambda does not provide any guarantees other than compensation if the uptime is less than 99.95 %. That is ~22 minutes/month. It's terrible. If it was reliable they would provide better guarantees. How long since a major outage? A couple of months. Few people run everything themselves. Most use existing datacenters or rent the hardware. Then its basically the same as using a VPS from a cloud provider when it comes to difficulty and expertise.
- riku_iki 3y ago> What makes you think cloud is cheap, or reliable? "cheap" is relative, if your data is not large (gigabytes) then cost will likely be much smaller compared to expenses on engineer supporting custom solution. > if the uptime is less than 99.95 % It doesn't mean their services experience this downtime. They have their reputation supporting revenue on the line. Customers will go somewhere else if experience frequent downtime. But the point is that with custom pgsql installation it is nontrivial to setup and support any kind of fault tolerance, plus you have a chance of all other kind of outages: network, your hosting provider, etc. Buying cloud offering with one click looks like no brainer base line.
- hot_gril 3y ago
- unscaled 3y agoConnection pooling is one area where NoSQL databases shine. Classic SQL is extremely stateful. It was designed was designed in a very different age when it was expected to mostly be used directly by programmers and non-technical users and be as friendly as possible. The SQL standard defines some state that must be stored along with each session, such as temporary tables, current schema, current timezone etc. This means that sessions have a pretty significant memory overhead and generally require a thread on the server side (and probably the client-side too). NoSQL databases got rid of many useful things when they replaced SQL with JSON query languages and simplified SQL dialect, but I think they got a net positive when they did away with statefulness and replaced that with a simple request/response APIs. With this small you can easily multiplex many in-flight requests on a TCP single connection, and let both the server and the client handle requests on-demand, without having to allocate any memory and threads that serve most of their time idling away. The client (and supposedly the server, if it's using io_uring) can run all I/O asynchronously and increase available concurrency even more. In short, you can get more concurrency and better scaling predictability for the same hardware since you don't have to optimize the way your connection pools are balanced across different clients. It's really one of these few things which is pure fun and joy and unicorns and rainbows when I'm designing a service with a NoSQL DB.
- winrid 3y agoMongo, one of the largest NoSQL databases, uses a thread on the server per connection, and is known for using around 1mb per one of those connections.
- unscaled 3y agoFrankly speaking, Mongo is probably the worst NoSQL database out there, and it has given bad rep for other NoSQL database which do have their use cases, such Cassandra, DynamoDB, Couchbase and Redis (yes, let's not forget that Redis is also a NoSQL database, without the hype). Redis is well-known (and sometimes criticized) for being single-threaded, but managing a connection pool on the client side is still necessary, so my statement is obviously not true for ALL NoSQL databases. But it is at least true for Cassandra and as far as I understand for DynamoDB and Couchbase to some degree.
- FpUser 3y ago>"I hope you find the advances of these serverless and edge-ready databases as exciting as I do." No I don't. They just have you pay 10 times the regular price while providing 10% of regular performance
- ggregoire 3y agoSomeone migrated from RDS to Neon (or similar service)? Did you notice significant improvements in terms of perf, features and pricing? Not being able to reduce the storage size on RDS is a major pain point for us.
- nikita 3y agoPlease email nikita@neon.tech we will share examples and help you out
- dagss 3y agoI wish SQL DBs had some focus on implementing stateless protocols. Is there any reason the "connection pool" could not be built into the same service as the SQL database, and start a move to an RPC protocol instead of stateful protocol? So instead of "set xact_abort on" being a command setting one of a hundred possible 100 stateful connection flags, such flags would be part of every network roundtrip (as it is with HTTP). Of course long lived DB transactions, temporary connection scoped tables, etc would need to be adjusted a bit in approach. But a shift towards SQL over RPC is certainly not impossible. And long lived, client managed database transactions are worse performance wise than doing the transaction in one roundtrip; SQL is powerful enough that stored procedure-style transactions with parameter tables can do anything -- and for cases they cannot, optimistic concurrency control should usually be chosen instead anyway. The cases where a long lived/client managed SQL transaction is NEEDED is rather seldom.
- ttfkam 3y agoFirst off, a long-lived transaction is separate from a long-lived socket connection. They may correlate, but that's conflating two very different issues. One could always use MySQL like HTTP; make a connection, authenticate, request a query, get the response, and close connection. On Postgres this is harder due to per-connection process overhead, but solutions like pgbouncer were made exactly for this. But here's the fundamental difference: HTTP expects large numbers of disparate clients from literally anywhere with varying network quality/speed, and connection overhead would totally swamp your servers if they were stateful. Memory and file descriptors would quickly get in short supply. Database access is inherently different. You shouldn't have random clients; you have a small, fixed set of client services and developers/admins connecting over a datacenter backplane, querying over and over and over again. The overhead of establishing/tearing down the sockets and re-authenticating becomes a performance bottleneck. Folks don't create database connection pools because they're bored; they solve a very real and measurable architectural concern, just like HTTP pipelining did years ago and what HTTP/2 addresses through multiplexing: connection build up and tear down overhead. HTTP/3 goes further by avoiding TCP altogether in favor of custom connection handling over UDP. But HTTP/3 just handles web assets. We regularly expect errors where we need to hit the reload button. SQL usage is markedly different. There is more of an emphasis on reliability at every step. Hitting a lock and retrying is very rare by comparison in the database world relative to the HTTP space. It happens (and it's a PITA), but it's nowhere near the norm. As for transactions, you appear to regard them as a "sometimes" thing when if fact they're an "every time" thing. Every SELECT, INSERT, UPDATE, or DELETE, no matter how trivial involves a database transaction. They have to in order to enforce ACID. I've written a few basic HTTP 1.x servers over the years in a few different languages. Fun exercise. I highly recommend it to get a better understanding of how the protocol works and common design tradeoffs. ACID databases are different. Very different. Mind bogglingly different. Orders of magnitude more complex even among the simplest. Compare the smallest, most lightweight web server you can find to SQLite or H2.
- ymc9 3y agoAuthor of the article here. I'd like to clarify that the article is meant to be about SQL databases only, although I enjoy reading the comments comparing SQL/NoSQL. Also, "edge" means edge deployment environment/runtime like CloudFlare workers, Vercel Edge Runtime, etc. Not sensors, etc.