Cost comparison of running web applications in the cloud using monolithic, microservice, and AWS Lambda architectures

Status:: 🟩
Links:: Microservices vs. Monolith

Metadata

Authors:: Villamizar, Mario; Garcés, Oscar; Ochoa, Lina; Castro, Harold; Salamanca, Lorena; Verano, Mauricio; Casallas, Rubby; Gil, Santiago; Valencia, Carlos; Zambrano, Angee; Lang, Mery
Title:: Cost comparison of running web applications in the cloud using monolithic, microservice, and AWS Lambda architectures
Publication Title:: "Service Oriented Computing and Applications"
Date:: 2017
URL:: https://doi.org/10.1007/s11761-017-0208-y
DOI:: 10.1007/s11761-017-0208-y

Notes & Annotations

Color-coded highlighting system used for annotations

📑 Annotations (imported on 2024-03-24#10:33:11)

villamizar.etal.2017.costcomparisonrunning (pg. 9)

To execute the stress tests of each architecture, we configured JMeter [28] 2.13 in an AWS c4.large EC2 instance, and we defined the maximum response time of S1 and S2 in 20.000 and 3.000 ms, respectively (their typical response times are 3.000 and 300 ms, respectively). In addition, JMeter was configured to execute a predefined number of requests per minute, with services S1 and S2 simulating a constant workload, depending on the scenario tested throughout 10 min.

villamizar.etal.2017.costcomparisonrunning (pg. 9)

The stress tests were executed with the goal of identifying the maximum number of requests supported by the monolithic architecture in Play and Jax-RS. This number was calculated by increasing the number of requests for each scenario until the application began to generate errors or the response time defined for S1 and S2 was not met.

villamizar.etal.2017.costcomparisonrunning (pg. 9)

Based on the number of requests per minute supported by the monolithic architecture, we executed performance tests for the microservice architecture operated by the cloud customer, in order to identify the minimum infrastructure needed for supporting the same number of requests.

villamizar.etal.2017.costcomparisonrunning (image) (pg. 10)

Fig. 9 Performance results of the monolithic architecture in Play and Jax-RS on AWS

villamizar.etal.2017.costcomparisonrunning (pg. 10)

The results of the performance tests for the microservice architecture are illustrated in Fig. 10. These results show that, in our case study, microservices can provide an even better performance than Jax-RS does in the monolithic architecture, at a lower cost. The monthly cost of the microservice architecture was $390.96 USD in contrast to the $403.20 USD of the monolithic architecture; furthermore, the former supported more requests per minute in the three defined scenarios.

villamizar.etal.2017.costcomparisonrunning (image) (pg. 10)

Fig. 10 Performance results of the microservice architecture in Play on AWS

villamizar.etal.2017.costcomparisonrunning (pg. 10)

The costs involved during the performance tests in AWS Lambda to support the same number of requests per minute as the microservice architecture are summarized in Table 3. These results show that AWS Lambda supports the same number of requests per minute as the microservice architecture, at a lower cost in the three defined scenarios, and involves monthly costs of $193.81, $173.26, and $168.08 respectively, while the monthly cost in microservices is $390.96.

villamizar.etal.2017.costcomparisonrunning (pg. 11)

To identify how each architecture affects the response time to requests during peak periods, we measured the average response time (ART) during the performance tests. The ART for S1 and S2 are shown in Figs. 12 and 13, respectively. The ART for S1 and S2 in the monolithic architectures with Play and Jax-RS are similar; however, when considering the microservice architecture, the ART for both services increases because each request must pass between the gateway and each microservice. For the microservice architecture operated by AWS Lambda, the ART remains very similar for both services in the three scenarios, even though it varied between scenarios for the other architectures. This result was obtained because each function/request in AWS Lambda is executed in an isolated computing environment dedicated to a single request, while each web server executes several concurrent requests in the other architectures.

villamizar.etal.2017.costcomparisonrunning (image) (pg. 12)

Fig. 12 Average response time for S1 during peak periods

villamizar.etal.2017.costcomparisonrunning (image) (pg. 12)

Fig. 13 Average response time for S2 during peak periods

villamizar.etal.2017.costcomparisonrunning (pg. 14)

Based on the performance tests executed for a monolithic architecture, a microservice architecture operated by the cloud customer, and a microservice architecture operated by AWS Lambda, we can conclude that the use of emerging cloud services such as AWS Lambda, exclusively designed to deploy microservices at a more granular level (per HTTP request/function), allows companies to reduce their infrastructure costs in up to 77.08%.

villamizar.etal.2017.costcomparisonrunning (pg. 14)

Furthermore, the case study allows us to conclude that for applications with a small number of users (hundreds or thousands of users), the monolithic approach may be a more practical and faster way to start.