Attend a Live Product Tour to see Sedai in action.

Register now
More
Close

Serverless Hands on Tutorial with AWS Retail Demo App & Sedai

Published on
Last updated on

March 28, 2024

Max 3 min
Serverless Hands on Tutorial with AWS Retail Demo App & Sedai

Introduction & Setting Up the Retail Demo App

Sedai, an AI-powered cloud optimization software, is a powerful tool any developer can easily use.

For this example, we are optimizing a sample e-commerce store that was originally built for ECS deployment, but we converted it to a serverless deployment using AWS Lambda functions in place of the microservices architecture. The link to the site deployment is provided here.

Step 1: Setting Up Sedai

The first step is to go to the Sedai website at sedai.io and begin by clicking the Start Free button as displayed below.

Once you click the button, you are prompted to a simple account creation page to input your basic information for a one-month free trial. After signing up, you will begin an introduction to the autonomous tools used. Here, you can easily specify your goals and resource type for your application (ECS, EKS, Lambda, and Kubernetes compatible). As we’re deploying a serverless application, we are going to select AWS Lambda as seen below.

The next step involves connecting to your cloud account through the AWS Identity and Access Management pins on your account. If you are slightly unfamiliar with this, simply click the “Launch CloudFormation” button to create a stack in your AWS account, which will prompt you to create a stack – press create.

After that, simply go to your stack and copy and paste the ARN in the outputs tab as shown below:

Congratulations – once you complete this step, you are ready to launch Sedai! Once you launch the UI, you will be prompted to a homepage with a directory bar on the left to specify the different tools and modes you can access, while the main page will simply display your activity on the application.

Once you are ready to begin your optimization process, click on the Topology tab and specify the cloud name.



Step 2: Generating Traffic

To effectively simulate the software for a variety of different-sized e-commerce stores, we simulated four different loads of traffic/engagement for the e-commerce site: new startup (low), growth company (medium), established (high), and market leader (very high). This was done through the Locust framework, where each traffic bot engaged with the website’s product and payment functionality. This, in turn, triggered Lambda functions that we converted. The GitHub repository for the traffic simulation is linked here.


Step 3: Optimizing with Sedai


When you have selected your desired cloud, cluster, application, etc., you will be able to see the optimization/availability actions. Once you are ready to optimize your resource (here, Serverless functions), simply click on the resource name and specify the nature of optimization as displayed below.

For serverless optimization, one also has to turn on autonomous concurrency to engage in full optimization. To do this, one should follow this article – we’ve gone through the CloudFormation deployment, which is recommended. Once this is done, go back to the topology and turn on autonomous concurrency.

After specifying your optimizations, you should be all set! Now, deploy your application to see the changes. Below, we will focus on a side-by-side comparison of Sedai optimization for an Elastic Container Service (ECS) deployment of the retail demo store.

Step 4: Reviewing Results

Sedai typically has a two-week learning period deployment, after which full results will be displayed with updated cost estimates. For now, we can see the differences in latency and error rate by reviewing the Locust results. The Locust results displayed below demonstrate the effects of optimization once it is turned on after 100 users are on the site consistently making requests.

As can be seen from the response times, Sedai optimization causes a drastic decrease. Initially, an average response time was approximately 400 milliseconds (disregarding anomalies). When Sedai was enabled and optimization began to take effect, response time dropped to an average of about 80 ms. This 5 fold decrease in response time exemplifies the extent to which Sedai optimizes in such a short period of time.

Now, if we are to look at errors (in red), we can also see a significant drop in the number of failures per second. The initial average of approximately 6 failures per second was relatively quickly decreased to 2 failures per second initially and eventually less than 1. The Sedai optimization gradually improves as more data is fed into it. The primary failures were resulting from server-side traffic problems, but Sedai managed to optimize quickly by analyzing traffic patterns.  

Conclusion

User behavior can have a significant impact on the performance and reliability of cloud applications. Even small changes in user behavior can lead to decreased failures and improved response time. For example, a study by Google found that a 1% decrease in page load time can lead to a 2% increase in conversions. Similarly, a study by Amazon found that a 100ms decrease in response time can lead to a 1% increase in customer satisfaction. A study by Microsoft found that a 10% decrease in latency can lead to a 5% increase in productivity. Sedai, an advanced optimization software, has proven highly effective in improving e-commerce website performance. By reducing response times and minimizing failures, Sedai enhances user experience, boosts customer satisfaction, and increases revenue potential. With optimized server-side processes, GET and PUT requests become faster and more efficient, enabling swift access to resources. The software's importance lies in its ability to provide a seamless and reliable online experience, enhancing customer trust and loyalty. Implementing Sedai is crucial for businesses aiming to gain a competitive edge and thrive in the fast-paced world of e-commerce.

Was this content helpful?

Thank you for submitting your feedback.
Oops! Something went wrong while submitting the form.