I am running magento 2 (using magento rest api services only) on aws t2 medium instance with ubuntu16.04, apache 2.4, php7, mysql 5.7.

When I use seige tool for load testing with 50 concurrent request to api. CPU goes up. And server get crash.

Not able to understand why this is happening.

Aws console shows higher mysql connections rate.

How I can handle this situation? Do I need to tune apache or magento2?

  • we dont know your database size, I/O load , and whats going on in mysql, you have very small instance to run full stack.
    – MagenX
    Nov 20, 2017 at 9:05
  • hello bro did you get any solution for that Jan 2, 2019 at 17:57

1 Answer 1


This is the normal behavior of Magento 2.

There are a couple of things you should do (if not already done) for running Magento in AWS. This answer only covers the infrastructure related issues. I expect that Magento 2 was set up correctly and optimized as described here.

To handle 50 or more users concurrently, you should set up the following resources:

  • Use an Autoscaling Group
  • Use at least an instance_type of m4.large for an "okay" performance
  • Use Varnish
  • Use Elasticache
  • Use a Loadbalancer

Magento itself recommends a Setup that contains 4 Webserver nodes and at least 1 node for the database (source: Magento 2 Whitepaper).

  • Will Reddis, varnish, elasticache work for rest api? As I am using magento only for api. My frontend is built on js framewrok. Nov 19, 2017 at 20:51
  • Yes, both should have an impact on your API. Magento put a lot of work into the varnish integration, including hole punching and stuff. Nov 19, 2017 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.