Is it reasonable here to use redis?

The script takes from DB batch jobs of the user and processes it. On the run from the account of the user should be charged. Each task is very cheap, such as 0.1 penny, of course, can be all sorts of contingencies, so the manipulation of account and data on the latest completed job to fix immediately in processing.
Does it make sense to record the progress of work in redis that would not refresh mysql many times per second?
July 9th 19 at 10:39
2 answers
July 9th 19 at 10:41
Solution
On the run from the account of the user should be charged.


Keep the user's account as the transaction log:

| user_id | amount | 
| 1 | 1000 |
| 1 | -150 |
| 1 | -240 |


and then the performance impact it does not (sequential write really fast.

and data you will never lose. And the balance on user's account can always be calculated as SUM(amount).

As to your question - it will be easier to use rabbitmq, but first you have performance issues or are you just having fun?
On great idea at all. Another thing is that if the operation is 1 penny for store 1000 rubles to the account user must have the log of 100 thousand records, that seems to me a little irrational... - alva8 commented on July 9th 19 at 10:44
or are you just having fun?

I'm just having fun, want to learn redis and select the task to which its use would be justified, googling led to the fact that all there stored session, but I have nothing stored... - alva8 commented on July 9th 19 at 10:47
: can squisiti recording, say once a day. The main thing that would last at least a couple of minutes, the data remained as it is.

in General, the disk space those 100K records take a lot of will not. - Allene_Crona78 commented on July 9th 19 at 10:50
: the radishes are doing quite a good turn (when too lazy to put rabbitmq for example). Your task in the queue is also a good idea to work - the main work with scitem user to reduce to the usual sequence to kill the opportunity of racing on the vine. - Allene_Crona78 commented on July 9th 19 at 10:53
: I have a problem in that the user gives the task - the script is running, but if 10 users at the same time give jobs, or at least 3 but large copies of scripts will start to compete for resources of the server and everything will slow down or even fall. Architectural more correctly probably be done by one processor and all tasks put in one place, but then you have to give the processing result to the user directly, and ask to wait... But if there he in line for just 1 request? And he will wait for the user for which now is handled by 10 thousand... - alva8 commented on July 9th 19 at 10:56
you still need the queue, radish is good for that. - Allene_Crona78 commented on July 9th 19 at 10:59
July 9th 19 at 10:43
Solution
Any operations connected with the money necessary to fix in the form of transactions, in the relational database.
Data storage is concerned about the process of execution of tasks in Redis, why not.

Find more questions by tags PHP