I'm doing a server running Ubuntu Server 12.04 and Apache. The users have continuous updates in the dinamic pages through a Java script, downloading JSON files through Ajax request to server. All the users need the same data provided by a PHP file from a secondary mySQL database. To reduce the server load I decided to update the JSON file each second and save them in the server providing them as static content (like a txt file). For this reason I need a solution to run a PHP or any other language script on the server every second.
For future necessity i can't implement a logic like: compile the JSON at the first request and keep them saved for the other requests in the same second.
I read about the CronTab in Ubuntu but it dont allow me to perform the code each second. I tought about changing the entire Cron code 'cause I can't find other solutions.
Someone know if there is any solution in Ubuntu or maybe in the Apache codes to do it? I need something stable and reliable. Someone ever heard about a sistem to perform code on server without the necessity of requests; to manipulate data each second?
Any suggestion is welcome even complex but for a reliable result!