The interaction between the front-end ajax and the computationally expensive php will throw unexpected results.

problem description

now there are two files, fund.html and fund.php. Fund.php handles a lot of computing work, and fund.html is displayed as the front end.
now you want to use the setInterval function in fund.html to poll for the calculated content in fund.php at a fixed time of 8s. When you find that there is a jump, sometimes you get the complete calculation result. SWHYToETH should be more than 0.8. sometimes you only get more than 0.4. you don"t know what the problem is.
1.ajax is asynchronous in the polling process. After initiating the ajax request, fund.php (1) is operating. When the operation is not finished, 8s has passed and ajax polling is initiated again. Does fund.php (1) restart the calculation? Or do you want to start a new thread to operate on a new fund.php (2) , while fund.php (1) continues the previous operation?
2. What can be done to get the desired results for the interaction?

the environmental background of the problems and what methods you have tried

environment: win10 + visualCode + local WAMP Server (also try to deploy Aliyun Hong Kong virtual host for testing)
tried method: suspected to be caused by asynchronous, using async:false,ajax synchronization method, the test on WAMP Server has achieved the desired results. The result on Aliyun Hong Kong virtual host is the same as before, with jumps of 90 and 40

.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
fund.html

<script>
        setInterval(function () {
            
            $.get(
                "phps/fund.php",
                function (result) {
                    if (result != null) {
                        var result = JSON.parse(result); //holding
                        console.log(result["SWHYToETH"] + " " + result["SWHYToUSDT"]);
                    }
                }
            )
            
        }, 8000);
    </script>

fund.php

<?php
set_time_limit(0);//
/**/
echo json_encode($result_Array);
?>

what result do you expect? What is the error message actually seen?

normally, the SWHYToETH should be around 0.008, but now we are seeing 0.004 and 0.008 jumps. I don"t know why. The following figure shows:

Jul.15,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ed4fda-3513.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ed4fda-3513.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?