How to optimize Directus for K6 Testing?

Dear All,

Recently, I had tested my directus server using K6 testing. And the result quitely dissapointing. I only use simple scenario: POST to /items/k6_test using static token. No matter it was using operated directus or fresh installed directus, the results still looks like this.|

Even on directus clouds, i think it’s dissapointing result:
scenarios: (100.00%) 1 scenario, 100 max VUs, 1m0s max duration (incl. graceful stop):
* default: 100 looping VUs for 30s (gracefulStop: 30s)

█ THRESHOLDS

http_req_duration
✓ 'p(95)<30000' p(95)=1.77s

http_req_failed
✗ 'rate<0.1' rate=34.87%

█ TOTAL RESULTS

checks_total.......: 4324   139.539074/s
checks_succeeded...: 65.12% 2816 out of 4324
checks_failed......: 34.87% 1508 out of 4324

✗ POST k6_test successful
  ↳  65% — ✓ 1408 / ✗ 754
✗ POST k6_test returns created item
  ↳  65% — ✓ 1408 / ✗ 754

HTTP
http_req_duration..............: avg=409.1ms min=28.75ms med=117.87ms max=3.16s p(90)=1.17s p(95)=1.77s
  { expected_response:true }...: avg=580.2ms min=38.16ms med=361.71ms max=3.16s p(90)=1.51s p(95)=1.89s
http_req_failed................: 34.87% 754 out of 2162
http_reqs......................: 2162   69.769537/s

EXECUTION
iteration_duration.............: avg=1.41s   min=1.02s   med=1.11s    max=4.31s p(90)=2.18s p(95)=2.79s
iterations.....................: 2162   69.769537/s
vus............................: 2      min=2           max=100
vus_max........................: 100    min=100         max=100

NETWORK
data_received..................: 1.3 MB 43 kB/s
data_sent......................: 536 kB 17 kB/s

running (0m31.0s), 000/100 VUs, 2162 complete and 0 interrupted iterations
default ✓ [======================================] 100 VUs 30s
ERRO[0031] thresholds on metrics ‘http_req_failed’ have been crossed

Can we optimize directus for this load testing? Any suggestions?

This is result K6 testing on directus self-host (Azure):

This result from K6 testing on directus cloud:

This load testing is mostly dependent on the (virtual)hardware the instance you test is running on. You are likely running into either API rate limiting or resource limitations (cpu/memory) or both on that cloud instance.

I recommend contacting cloud support for more details/information about your instance. They can probably tell you what the options are to improve the results of these tests.