Skip to content

Introduction

This section sets Bagisto up for production: its caches, search, and what changes on more than one server or a long-running PHP server. The pages under Digging Deeper explain how each mechanism works. The guides here configure it, each in the same order: when you need it, the setup steps, how to test it, and what to watch.

What Bagisto Does Out of the Box

LayerShipped defaultGuide
Full page cacheOn, for guest storefront pages, stored in the file cache storeConfigure Full Page Cache
Application and repository cacheThe database store; six core repositories cache their readsCache Strategy
Catalog API cacheGuest product and category API responses, for an hourCache Strategy
Product searchThe databaseConfigure Elasticsearch
Queuesync in .env.example: jobs run inside the requestQueues, Jobs and Scheduling
MediaThe local public diskFile Storage
Resized imagesResized on every request, sent with a 30-day Cache-Control headerCache Strategy

Tuning Checklist

  1. Move the queue off sync so mail, index updates and imports leave the request.
  2. Put the caches and sessions on Redis when the database is under load, and give the full page cache a store of its own.
  3. Use Elasticsearch when database search is too slow for the catalog, and give each environment its own index prefix.
  4. Serve media from Amazon S3 or Cloudflare R2, and put a CDN or reverse proxy in front of /cache/ so resized images aren't generated for every visitor.

Workers, the scheduler and framework caches are part of every deployment; see Deployment.

Pages in This Section

  • Configure Elasticsearch: connecting a cluster, building the product index, and troubleshooting the connection.
  • Configure Full Page Cache: the switch and lifetime, a store of its own, checking for cache hits, and clearing.
  • Configure Varnish: the separate bagisto/bagisto-varnish package, which replaces the built-in page cache; read its warning about signed-in pages first.
  • Configure Laravel Octane: running Bagisto on FrankenPHP, RoadRunner or Swoole, and the state that outlives a request.
  • Configure Load Balancing: what several web servers must share, deploying to them, and an example on AWS.

Test each change on a staging copy of the store with production-like data before rolling it out. Don't use a web server page cache such as Nginx's FastCGI cache; Configure Full Page Cache explains why.

Released under the MIT License.