References:
1. Data Table Name: popadv, which contains a field: ADV, which is used to store ad links. There are about 100 records.
2. Try to achieve the average value based on the randomly selected advertisements, that is, the chances for these 100 advertisements to be selected are not much different. Do not select one advertisement for 50 times, or the other for two times.
3. There are about 0.3 million views every day. That is to say, your program must be able to carry 0.3 million accesses every day.
<? PHP
/**
* Load Balancing Algorithm
*
* The average value of advertisement display can be greatly increased based on the user's access time in milliseconds.
*/
$ Mtime = explode ('', microtime ());
// Link cache Array
$ Adv = array ('link 1', 'link 2', 'link 3', 'link 4', 'link 5 ');
$ I = $ mtime [0] % count ($ AdV );
Echo $ adv [$ I];
?>