Skip to content

how can we increase performance of bulk product save in magento 2 api

when we test performance of bulk product create api request using Apache 2 Benchmark, it takes to much time for return response of request.

I tested bulk api requests with 200 total number of requests & 25 concurrency level

Live Server Data

This is Apache Benchmark Result

$ ab -n 200 -c 25 -s 800 <api_url>
This is ApacheBench, Version 2.3 <$Revision: 1901567 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking <api_url> (be patient)
Completed 100 requests
Completed 200 requests
Finished 200 requests


Server Software:        Apache
Server Hostname:        <api_url>

Concurrency Level:      25
Time taken for tests:   1825.329 seconds
Complete requests:      200
Failed requests:        0
Requests per second:    0.11 [#/sec] (mean)
Time per request:       228166.105 [ms] (mean)
Time per request:       9126.644 [ms] (mean, across all concurrent requests)
Transfer rate:          313.50 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        4  259 760.3     87    3458
Processing: 11530 224407 17776.1 227501  242597
Waiting:    11501 223702 17661.3 226799  241997
Total:      11536 224666 17877.9 227903  242602

Percentage of the requests served within a certain time (ms)
  50%  227903
  66%  229995
  75%  231201
  80%  232007
  90%  235161
  95%  236600
  98%  239193
  99%  241998
 100%  242602 (longest request)

Live Server Apache & Php.ini Configuration

Intel(R) Xeon(R) CPU E5-2697 v3 @ 2.60GHz
core 56

Total Memory = 193068 MiB


Maximum Spare Servers = 10
    Server Limit = 256
    Max Request Workers = 150
    Max Connections per child = 10000
    Keep-Alive = On
    Keep-Alive Timeout = 5
    Max Keep-Alive Requests = 100
    Timeout = 300

    max_execution_time = 30
    memory_limit = 2G (*Magento's Min. recommended)
    opcache.enable = On
    gzip compression = enabled

Local Development System Data

This is Apache Benchmark Result

$ ab -n 200 -c 25 -s 800 <api_url>
This is ApacheBench, Version 2.3 <$Revision: 1879490 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking <api_url> (be patient)
Completed 100 requests
Completed 200 requests
Finished 200 requests


Server Software:        Apache/2.4.52
Server Hostname:        <api_url>

Concurrency Level:      25
Time taken for tests:   13.566 seconds
Complete requests:      200
Failed requests:        0
Requests per second:    14.74 [#/sec] (mean)
Time per request:       1695.800 [ms] (mean)
Time per request:       67.832 [ms] (mean, across all concurrent requests)
Transfer rate:          271.61 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       0
Processing:   243 1628 472.0   1657    2864
Waiting:      238 1618 468.9   1641    2832
Total:        243 1628 472.0   1657    2864

Percentage of the requests served within a certain time (ms)
  50%   1657
  66%   1799
  75%   1891
  80%   1944
  90%   2142
  95%   2512
  98%   2631
  99%   2846
 100%   2864 (longest request)

Local Server & Php.ini Configuration

Intel(R) Core(TM) i3-9100 CPU @ 3.60GHz
core 4
Total Memory = 11862.5 MiB

Max Requests :- Per Child: 0 - Keep Alive: on - Max Per Connection: 100
Timeouts :- Connection: 300 - Keep-Alive: 5
memory_limit = 756M
opcache.enable = On
gzip compression = enabled

**Issue :- ** when we send multiple requests at the same time, than why magento 2 takes to much time to respond to us.

what want wrong for me? please help me.

please guide me to improve performance of Magento 2.