I have a web app using centos, php 5.6, laravel 4.2, mariadb and redis. I have a model that with one-to-one and one-to-many relationships touches 12 tables. I have a UI that when a user changes a value, I send the change to the server to do calculations that can affect numerous tables. While the user is editing the object, I keep the model in redis so I'm not touching the database with each calculation. To make sure I persist my object in the database, I have a scheduler that checks redis for changed objects, then updates the database.
User begins edit of object in UI, load from database and put into redis.
User makes changes (on lost focus event), changes sent to server, load object from redis, update + calculations, update redis, return object to UI.
On the server, in the background using a scheduler, check for changed objects, pull from redis, update database.
1. Is there a better way of persisting data from redis to mariadb that the user does not have to wait for.
- Is there a good way to monitor the scheduler? If my scheduler stops, I won't notice in a timely manner. My biggest concern is that the scheduler will stop and I risk losing user edits.
1. My calculations must be done on the server. This can't be changed.
2. I can't load from mariadb and write to db with each changes, its just too slow.