i've got a module known as online occasions during my website, this module will run for each 8 sec and brings a current activities during my websites. So, if a lot more than 100 customers are utilizing this site at any given time, it consumes more memory and much more cpu usuage. what must i do in order to reduce cpu usage and memory, provided it shouldn't affect a online occasions module. could it be would to behave with files here? please assist me to.
Basically comprehend it properly the module must run every 8 seconds?
Why don't you keep time once the module went last after which with every access from individuals 1000's of customers you simply see if time because the module last went is larger than 8 seconds? If it's you went the module and store thwe new time, whether it is not you need to do nothing and watch for another user to gain access to the website, to create new online occasions for him?
http://www.prelovac.com/vladimir/wordpress-optimization-guide (About Wordpress, but has good strategies for all programs)
In the beginning, result in the interval greater. Then, cache the module in some way on server side. E.g. create a static html file that will get loaded via a php file, which is only going to get up-to-date if something has transformed within the db, which means you only have to query the DB and render the information from this if really something happened. An easy method of ensure cache update is always to take away the static file each time something alterations in the DB. This only is sensible if you will find very few DB changes.