In the world of cloud computing, serverless technology is growing in popularity due to its potential for cost savings, flexibility, and scalability. The term „serverless“ refers to the concept of creating and running applications without the need to manage servers. This allows developers to focus on writing code, while the underlying infrastructure is automatically provisioned and managed by the cloud provider. Serverless technology has enabled innovations in the developer experience (DX) that make it easier to release scalable products and accelerate the development process.
Other benefits of serverless computing include:
- Pay-as-you-go pricing model: With serverless computing, you only pay for the computing resources you actually use, making this technology a cost-effective option, especially for sporadic or unpredictable workloads.
- Automatic scaling: Serverless platforms automatically scale their applications as needed, ensuring optimal performance without manual intervention. This makes it easier to handle fluctuating workloads and helps prevent resource over- or undersupply.
- Shorter time to market: By abstracting server administration, developers can focus on writing application code, which reduces the time and effort required to deploy new features and products. This leads to faster releases and a shorter time to market.
- Enhanced Security: Since the cloud provider manages the underlying infrastructure, it is responsible for the platform’s security and relieves developers of the burden of patching and maintaining servers. This can lead to more secure applications and, consequently, lower security risks.
By leveraging these advantages, serverless technology plays a key role in driving DX innovation and enables the development of scalable, high-performance applications.
Serverless Products with Strong DX Innovations: PlanetScale as an Example
In this section, we'll look at PlanetScale as an example of a serverless product that offers an excellent developer experience (DX). Of course, there are alternatives like Neon or CockroachDB that are also worth checking out. PlanetScale is a serverless database service that significantly simplifies the process of creating, deploying, and managing databases in the cloud.
Some of PlanetScale's standout features include:
- Schema Management: PlanetScale enables developers to create branches with different schemas, test them independently, and merge changes without downtime.
- Connection Pooling and Load Balancing: The platform efficiently manages connections to the database, distributes the load evenly across instances, and ensures optimal performance.
- Global Scaling: PlanetScale supports horizontal sharding and global replication, enabling the database to scale across multiple regions and providing low-latency access worldwide.
The list goes on: Features such as high availability and data security ensure that developers can work on a reliable and secure platform. However, it’s important to note that innovations can sometimes come with limitations. In the case of PlanetScale, foreign keys are not allowed due to the technology used (Vitess), which prioritizes scalability and performance. The prohibition on foreign keys helps prevent dependencies between shards and simplifies the sharding process, thereby facilitating the horizontal scaling of the database. While this approach may sound a little daunting, it has been tried and tested at YouTube, GitHub, Slack, and other large companies.
It is important to understand these limitations, as they can affect the total cost of using a serverless platform such as PlanetScale. A lack of understanding of serverless platforms and their limitations can lead to inefficient configurations or the misuse of resources, resulting in higher costs than expected.
Specific Examples of Cost Risks
PlanetScale Issue with Missing Index
One example of a cost risk associated with serverless technology is the lack of foreign keys in PlanetScale. As mentioned earlier, foreign keys are not allowed in PlanetScale, which means that the indexes normally generated automatically for foreign key columns are not present. To maintain query efficiency, developers must add these indexes manually.
A missing index can be problematic, especially when querying large amounts of data. Without an index, the database must perform a full table scan, in which every row of the table is examined to find the relevant data. This process is extremely inefficient and can lead to longer response times and increased resource consumption.
PlanetScale's pricing model is based on the number of rows examined during queries. Therefore, if a missing index results in a full table scan, the cost of using the service can increase significantly due to the higher number of rows examined.
A practical example of this problem is the experience of Brian Anglin, who was charged $1,000 per day because of missing indexes in his PlanetScale database. Brian’s story serves as a cautionary tale for developers using serverless technology and highlights the importance of understanding the nuances and limitations of the platform. Details about Brian’s experience can be found in his Blog Post can be looked up.
Vercel Edge Function Timeout and Retry Loop
Even in smaller projects and web hosting scenarios, cost risks can arise from improper implementation or misunderstandings. Vercel, a popular serverless hosting platform known for its excellent developer experience (DX), is used by developers ranging from hobbyists to professionals at companies like Facebook. Despite its ease of use, unexpected costs can arise if developers aren’t careful.
A hobbyist developer shared his experience with a high, unexpected Vercel bill in a developer Discord channel after experimenting with tRPC (a type-safe remote procedure call framework for type-safe end-to-end APIs) in conjunction with Edge Functions. Since he was unfamiliar with the concept, he mistakenly used it in a Next.js project by calling tRPC from server to server instead of from client to server. This error triggered a timeout and retry loop in the Edge Functions, causing them to repeatedly fail and be retried.

The repeated calls to the Edge functions resulted in a massive overage charge of 9,000 GB-hours for function execution, totaling approximately $3,000. This problem arose from experimenting with an unfamiliar technology in a serverless environment without utilizing the safety net of a hobbyist plan. While many serverless platforms, including Vercel and PlanetScale, offer hobbyist or free-tier plans where operations typically stop once allocated resources are exhausted, he found himself in the unfortunate situation of having previously upgraded his account. The safety net provided by a hobby plan also disappears if you use the products for commercial purposes.
This example illustrates how important it is to understand the nuances of serverless platforms and the tools used in conjunction with them, even for smaller projects and web hosting scenarios.
Shopify's BigQuery Case
A bonus for dedicated readers: Shopify Fixes a $1 Million BigQuery Error.
Conclusion
In summary, while the potential for unexpected costs with serverless platforms may seem daunting, it’s important to remember that serverless technology offers numerous benefits and outstanding innovations for developers. It’s important to be aware of the associated risks, but this shouldn’t overshadow the benefits that serverless platforms offer. By staying informed, developers can implement strategies to minimize these risks. This allows them to fully leverage the power and flexibility of serverless solutions while driving innovation and building scalable, efficient applications.