Skip to content

Sithabilea/k6-ecommerce-performance-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

🧪 k6 E-commerce Performance Testing Demo

📌 Executive Summary

This project evaluates the performance and scalability of an OpenCart-based e-commerce application under simulated user load using k6. The test modeled realistic user behavior, including product browsing, search, and cart interactions, with a peak load of 20 virtual users. Results indicate that while the application maintained 100% functional reliability with zero request failures, it did not meet the defined performance SLA, as the 95th percentile response time exceeded the 500ms threshold, reaching approximately 1.49 seconds. This suggests that although the system is stable under load, performance degradation occurs at higher traffic levels, highlighting the need for optimization in areas such as backend processing and database efficiency to ensure a consistent user experience at scale.

📌 Overview

This project demonstrates performance testing of an OpenCart-based e-commerce application using k6.
The goal is to model realistic user behavior and evaluate system performance under load.


🛠️ Tools & Technologies

  • k6 (performance testing)
  • JavaScript (test scripting)
  • OpenCart demo application (system under test)

🛒 Test Scenario

The test simulates a typical user journey:

  1. Browse product catalog
  2. Search for products
  3. View product details
  4. Add item to cart

⚙️ Load Profile

The test uses a staged load pattern:

  • Ramp-up: 0 → 20 users over 1 minute
  • Steady load: 20 users for 2.5 minutes
  • Ramp-down: 20 → 0 users over 1 minute

🎯 Performance Thresholds

  • 95% of requests must complete under 500ms
  • Error rate must be below 1%

🧠 Key Features

  • Realistic user journey simulation
  • Dynamic test data (random product selection)
  • Structured test groups for readability
  • Assertions using checks
  • Threshold-based validation

📊 Results Summary

Results Screenshot

The above results show a clear breach of the latency SLA despite zero request failures.

Findings & Analysis

🔍 Summary of Results

The performance test simulated user activity on the OpenCart demo application under a peak load of 20 virtual users.

✅ 0% error rate observed across all requests

❌ Latency threshold breached (p95 > 500ms)

📈 Average response time: ~822.63ms

📈 95th percentile response time: ~1.49s

⚡ Peak response time: ~2.98s

⚠️ Key Observations

  1. Latency Degradation Under Load

While the system remained stable with no failed requests, response times increased significantly under load:

The p95 latency reached ~1.49s, exceeding the defined threshold of 500ms

This indicates that 5% of users experienced noticeably slow responses

  1. High Variability in Response Times

Median response time: ~761ms

Max response time: ~2.98s

👉 This suggests inconsistent performance

  1. Stable Throughput with No Errors

Total requests: 2150

Error rate: 0%

👉 The system is functionally stable, but not performance-optimized

🧠 Interpretation

The application demonstrates:

✅ Good functional reliability (no failures under load)

⚠️ Poor performance scalability as user load increases

This indicates a system that can handle traffic without crashing, but not without degrading user experience

🔬 Request-Level Performance Insights

Additional request-level checks revealed that performance degradation is not uniform across the application:

  • Product search and product detail pages consistently exceeded the 500ms threshold
  • Cart and checkout-related operations also showed poor response times
  • The homepage performed relatively better but still showed variability under load

This indicates that performance bottlenecks are concentrated in core transactional flows rather than static or landing pages.

🚀 Recommendations

To improve performance:

Implement caching for frequently accessed data (e.g. product listings)

Optimize database queries for search and product endpoints

Introduce load balancing to distribute traffic

🏁 Conclusion

Although the application remained stable during the test, it did not meet performance SLAs for response times.

Further optimization is required to ensure a consistent and responsive user experience under load.


📈 Key Takeaway

The system demonstrates strong functional stability but lacks performance scalability, making it unsuitable for high-traffic scenarios without optimization.


🚀 How to Run

Prerequisites

Run Test

k6 run tests/ecommerce-flow.js

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors