Aug 3, 2011, 3:22 AM
Post #1 of 4
Dear Forum Users,
Realtime - Persistent - Event Based - Heartbeat Perl program
My name is Rizwan Qureshi and I am new to this forum, not new to perl though. I love perl and have been able to solve all of my programmatic problems without anyone's help. But today I am facing a design problem.
I want to make a script which should generate a separate heartbeat (processing something after specific interval, interval will be different for every event) for every event that it receives. For example on start event, a DB value should be updated. Then it should keep updating the DB value after every tick on specified interval time until stop event is received.
This should happen separately for every event that it receives. So lets say if the program receives two different events it should be able to handle them simultaneously with different timing intervals, one should run every 30 second and another every 45 second until the stop event is received.
Launching a separate thread for every event is an option, but its not very good one because I expect to receive 10,000 events per second, So I dont want to exhaust the machine with too many threads.
All of your valuable suggestions and comments will be greatly appreciated. I badly need them.