hossamGamal
hossamGamal

Reputation: 171

Optimize laravel rest api for stress testing

i have a restful project when make stress test with maximum 500 users the route return status:error i tried to optimize laravel query and decrease the amount of data which received at every request but the result of performance not shown

so the question how to optimize my proeject and what are helpfull tools i can use to make best performance as possible

Upvotes: 0

Views: 928

Answers (2)

Subhan Shamsoddini
Subhan Shamsoddini

Reputation: 51

barryvdh/laravel-debugbar is a great package for tracking execution time of each single query, memory usage and other information.

Upvotes: 0

EchoAro
EchoAro

Reputation: 838

There are a few critical parts that you should deeply check and do

  1. User SQL profiler to check which part of SQL script is slow, etc.
  2. Check and remove duplicate SQL queries.
  3. Use caching with Redis everywhere where it is necessary
  4. Cache the config, routes, etc. you can call the php artisan optimize command
  5. Remove unused services from the config
  6. Optimize the composer composer install --prefer-dist --no-dev -o
  7. Cache the results of non-often uneatable queries, e.g. if you have a categories you can cache them, and update the cache when categories are updated.
  8. Use CDN for static files, like images, JS, CSS files, etc.
  9. Big jobs move to the queue and use a queueing system where it is possible
  10. Use laravel Octane for increase performance

I can't suggest more without looking at the code, so I wrote only general things

Upvotes: 2

Related Questions