GraphQL vs. REST: A Performance and Cost Investigation for Serverless Applications
Serverless computing simplifies application deployment by removing the need for infrastructure management, with RESTful APIs being the common interface. However, REST can lead to inefficiencies such as data over-fetching and under-fetching, which impact performance and cost. This paper investigates GraphQL as an alternative to REST for serverless functions using a serverless image processing pipeline. We evaluate roundtrip time (RTT), scalability, and cost, while also examining managed (AWS AppSync) and unmanaged (Apollo Server) GraphQL hosting solutions. Our results show that GraphQL generally outperforms REST with respect to pipeline RTT, especially when there is high network latency, offering a potentially better fit for optimizing data transfer in serverless applications.