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.
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.
- k6 (performance testing)
- JavaScript (test scripting)
- OpenCart demo application (system under test)
The test simulates a typical user journey:
- Browse product catalog
- Search for products
- View product details
- Add item to cart
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
- 95% of requests must complete under 500ms
- Error rate must be below 1%
- Realistic user journey simulation
- Dynamic test data (random product selection)
- Structured test groups for readability
- Assertions using checks
- Threshold-based validation
The above results show a clear breach of the latency SLA despite zero request failures.
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
- 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
- High Variability in Response Times
Median response time: ~761ms
Max response time: ~2.98s
👉 This suggests inconsistent performance
- 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)
This indicates a system that can handle traffic without crashing, but not without degrading user experience
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.
The system demonstrates strong functional stability but lacks performance scalability, making it unsuitable for high-traffic scenarios without optimization.
- Install k6: https://k6.io/docs/get-started/installation/
k6 run tests/ecommerce-flow.js