Back to overview

Serverless - two sides of the coin

Reading time approx. 6 minutes

In the world of cloud computing, serverless technology is becoming increasingly popular 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. Developers can thus focus on writing code while the underlying infrastructure is automatically provisioned and managed by the cloud provider. Serverless technology has enabled innovation in the Developer Experience (DX), which facilitates the release of scalable products and speeds up the development process.

Other advantages of serverless include:

  • Pay-as-you-go payment model: With serverless, only the computing resources actually used are paid for, making the technology a cost-effective option, especially for sporadic or unpredictable loads.

  • Auto-scaling: Serverless platforms automatically scale their applications as needed, ensuring optimal performance without manual intervention. This makes it easier to manage fluctuating workloads and helps avoid over- or under-provisioning of resources.

  • Shorter time to market: By abstracting server management, developers can focus on writing application code, reducing the time and effort required to deploy new features and products. This leads to faster releases and a shorter time to market.

  • Increased security: Since the cloud provider manages the underlying infrastructure, it is responsible for the security of the platform and frees the developers from the burden of patching and maintaining the servers. This can lead to more secure applications and therefore 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 good DX innovations: PlanetScale as an example

In this section we will look at PlanetScale as an example of a serverless product that offers excellent DX. Of course, there are alternatives such as Neon or CockroachDB that are also worth a look. PlanetScale is a serverless database service that greatly simplifies the process of creating, deploying and managing databases in the cloud.

The outstanding features of PlanetScale include:

  • Schema management: PlanetScale allows developers to create branches with different schemas, test them independently and merge changes without downtime.
  • Connection pooling and load balancing: The platform efficiently manages the connections to the database, distributes the load evenly among the instances and ensures optimal performance.
  • Global scaling: PlanetScale supports horizontal sharding and global replication, allowing the database to scale across multiple regions and provide low-latency access worldwide.

The list goes on: Features such as high availability and data security ensure that developers can work with a reliable and secure platform. However, it is important to note that innovation sometimes comes with limitations. In the case of PlanetScale, foreign keys are not allowed due to the technology used (Vitess), which prioritises scalability and performance. Prohibiting foreign keys helps to avoid dependencies between shards and simplifies the sharding process, making it easier to scale the database horizontally. This approach may sound a little intimidating, but it is tried and tested at YouTube, GitHub, Slack and other large companies.

It is important to understand these limitations as they can affect the overall 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 misuse of resources, resulting in higher than expected costs.

Practical examples of cost risks

PlanetScale problem with missing index

One example of a cost risk associated with serverless technology is PlanetScale's missing foreign keys. As mentioned earlier, foreign keys are not allowed in PlanetScale, which means that the indexes that are normally automatically generated for foreign key columns are not present. In order to maintain query efficiency, developers have to 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, examining every row of the table 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 provides for billing based on the number of rows checked during queries. So, 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 checked.

A practical example of this problem is the experience of Brian Anglin, who was charged $1,000 per day for missing indexes in his PlanetScale database. Brian's story serves as a cautionary example for developers using serverless technology and highlights the importance of understanding the nuances and limitations of the platform. Details of Brian's experience can be read in his blog post.

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 DX, is used by developers ranging from hobbyists to professionals in companies like Facebook. Despite the simplicity of use, unexpected costs can arise if developers are not careful.

A hobbyist developer shared his experience with a high, unexpected Vercel bill in a developer discord when he tried tRPC (a type-safe remote procedure call framework for type-safe end-to-end APIs) in conjunction with Edge functions. Unfamiliar with the concept, he mistakenly used it in a Next.js project by calling tRPC from the server side to the server side instead of from the client to the server. This error triggered a timeout and retry loop of the Edge functions, which caused the Edge functions to fail repeatedly and try again.


The repetition of Edge functions resulted in a massive overrun charge of 9,000 GB hours for function execution, amounting to approximately US$3,000. This problem arose from experimenting with an unknown technology in a serverless environment without using the safety net of a hobbyist plan. While many serverless platforms, including Vercel and PlanetScale, offer hobbyist or free-tier plans that typically cease operations once allocated resources are exhausted, he was in the unfortunate position of having previously upgraded his account. The safety net of a hobby tariff also falls away if one uses the products for commercial purposes.

This example illustrates the importance of understanding 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

Bonus case for invested readers: Shopify fixes $1 million BigQuery bug.


In summary, while the potential for unexpected costs with serverless platforms may seem intimidating, it is important to remember that serverless technology brings many benefits and excellent innovations for developers. It is important to be aware of the risks involved, but this should not overshadow the benefits offered by serverless platforms. By staying informed, developers can adopt strategies to minimise these risks. This allows them to take full advantage of the power and flexibility of serverless solutions, while driving innovation and creating scalable, efficient applications.