Skip to content
Momchil Petrov edited this page Jun 17, 2023 · 13 revisions

This project focuses on optimizing the performance and enabling elastic scalability for the SockShop application based on different workload scenarios. The primary objective is to identify performance bottlenecks, refactor the application to improve performance, and establish mechanisms for dynamic workload management.

Architecture overview

SockShop is a sample e-commerce application that serves as a reference implementation for microservices architecture and cloud-native development. It provides an interactive platform for users to browse and purchase various types of socks. SockShop showcases best practices for building scalable, resilient, and containerized applications while demonstrating the use of different technologies and frameworks.

Here is an overview of how the application is bill and how different microservices interact with each other:

image

Deployment (k8s)

Navigate to the microservices-demo/deploy/kubernetes folder from the terminal and run

kubectl apply -f complete-demo.yaml

This will start all of the services.

Monitoring

WeaveScope

To set up WeaveScope with Kubernetes, follow this guide. Don't forget to set the correct port-forwarding, so that WeaveScope is available at https://localhost:4040.

This is what the WeaveScope interface looks like. It shows the interactions between the services and can also measure CPU and memory usage.

WhatsApp Image 2023-06-09 at 16 49 16

Prometheus and Grafana

As you can see, there is also a Prometheus node, which is connected to all services and scrapes metrics. These are then transferred to Grafana.

For the deployment of Prometheus and Grafana with Kubernetes, refer to this documentation.

Once Grafana is set up and the command kubectl apply -f 23-grafana-import-dash-batch.yaml is executed, 4 dashboards are imported in Grafana. This is what one of them looks like:

WhatsApp Image 2023-06-16 at 17 54 55

Load test

For running the load test with Locust, take a look at this guide. The command simply needs to be run from the cnae-sockshop/load-test folder. This is what the output looks like:

WhatsApp Image 2023-06-14 at 13 41 53

Troubleshooting

One of the errors we encountered said Error: POST /orders: HTTPError(406 Client Error: Not Acceptable for url: /orders).

This refers to an error that occurs, when trying to place the order to the /orders endpoint. We encountered the error, while repetitively running the load test with the standard SockShop credentials, meaning from one account. This kept adding items to the cart. SockShop has a built in max limit of the order's value and that is $100. So make sure you clear your cart of all the items, before running the test again. However, the current version of the load test creates a new user each run, so you shouldn't encounter this error.

Clone this wiki locally