I have to INSERT around 1000 rows each second to MySQL database, since for each visitor i have to add the IP, Browser and Country to a specific Table for a statistics need.
Inserting the visits row by row take many performances from the server and many timeout encountered, in order to minimize this problem and get better performances, i want to combine REDIS + MySQL.
To reach my goal, i have to store each visit into REDIS accompaned with the exact date including seconds in a JSON format, and then from a PHP script i want to fetch that records and insert them to MySQL database using CRONJOB (Each second in order to make it REALTIME for users).
INSERT INTO tbl_name
(a,b,c)
VALUES
(1,2,3),
(4,5,6),
(7,8,9);
Inserting datas in one query take a very short time and will save many performance in my server.
So my exact problem is:
To be able to add a new entry into REDIS for each visit to an actual date (This mean add all visits infos to this date second) in a JSON FORMAT if possible or not, and then using a CRONJOB php script, i can fetch all the data in real time and add them to MySQL database (For each added row to MySQL database will be removed from REDIS to prevent duplicate).