Upgrade to Pro — share decks privately, control downloads, hide ads and more …

High Performance Laravel

High Performance Laravel

Use Laravel to build high-performance web application.

Nuruzzaman Milon

November 18, 2017

More Decks by Nuruzzaman Milon

Other Decks in Technology


  1. Sharing My There is no golden rule, you might have

    different opinion. Let me learn from you.
  2. Minimize plugins usage × Don’t use unnecessary plugins. × Don’t

    import the whole library just for using a single functionality.
  3. Use Eager loading × Try to avoid N+1 problem ×

    Don’t load the whole collection, if you just need the count. × Use `select()` rather than `all()`
  4. Trim your response × Don’t try to render all the

    elements at a time, use pagination or lazy loading. × Don’t return, what you don’t need. × Use transformer. (Fractal, Resource etc.)
  5. Optimize Autoloader × Optimize your autoload file × Use either

    `composer dump-autoload -- optimize` Or `composer dump-autoload --classmap-authoritative`
  6. Cache routes and configs × Cache your routes file- `php

    artisan route:cache` × Cache your config file- `php artisan config:cache` × Don’t use `env()` function
  7. Use Faster Drivers × Use redis driver for session. ×

    Use memcached/redis driver for cache. × Use Redis, where you can.
  8. Profile your query × Inspect your query. × Use a

    good profiler. (Blackfire) × Use a debugbar while developing. × Cache your query.
  9. Use queue for expensive task × Use queue for long

    running task. × Use queue for CPU or memory intensive tasks. × Return early, if it’s possible. × Use a good monitoring tool. (Horizon)
  10. Inspect Exceptions and Log × Use a good error reporting

    tool like Bugsnag, Sentry etc. × Log every possible failed scenario. × Use `logrotate` to manage log files. × Use benchmarking tool. (ab, wrk etc.)
  11. Consider lumen × Consider micro services. × Don’t built just

    another monolithic application. × Decide wisely. (or cautiously?) × Avoid NANO services.
  12. THANKS! Any questions? You can find me at - @to_milon

    [email protected] https://speakerdeck.com/milon/high-performance-laravel ??