Why Is Memcache/redis Needed When Having An "onOneServer" Schedule?

- 1 answer

When faced with an architecture that involves several webservers running the same laravel application, the problem of availability arises.

When two servers are involved, only one of them should run a scheduled job. In that scenario, you would obviously use the onOneServer attribute.

For details, see the laravel documentation on that matter.

Now here's the actual question: the documentation says

{note} To utilize this feature, your application must be using the memcached or redis cache driver as your application's default cache driver. In addition, all servers must be communicating with the same central cache server.

I just don't get why this should not be possible using the database backend. I'd appreciate any hint you can provide.

Cheers, Thomas



When Taylor introduced the onOneServer() feature, he explained it in this way:

Note: When using this feature, you will need to use the Redis or Memcached cache drivers. These drivers provide the atomicity needed to secure the locks that power this feature.

You can read more about distributed locking in redis. I am aware that some of the database drivers, such as MySQL also provides lock-features, so I would assume this feature would potentially also work on those. However, as of right now, they aren't implemented.