Reputation: 7
I have a situation with a lottery system with a very high level of processing transactions at a time, let me put you in context:
There are 10 different s draws.
Each draw has many games and each game many numbers.
Each number has a limit, if the number have reached the limit , I can not accept more bets in this number.
Aprox. the total numbers bet in a single day is 68,000, that is 68,000 rows that I have on a view.
I have this relation on MySQL View, example : result from a join of 2 tables that has the transactions:
Draw Game Number accumulated limit
01 16 10 70,000 75,000
02 17 0102 65,000 60,000
03 18 123 20,000 25,000
... .. ... .... ......
... .. ... .... ......
Total rows = 68,000
My problem is that I have to check for every incoming new number the accumulated from this view in order to avoid exceed the limit.
I have done many approaches but still the system is very slow:
The server is very powerful, but I need a new approach to improve this process. Thanks in advance.
Upvotes: -1
Views: 121
Reputation: 1
Consider using redis for peak shaving. Use the set method of redis to atomically increment each request to ensure that the data to the database does not exceed the limit.
Upvotes: -1