One of our clients had recently requested that he wished us to develop a script which would allow him to export his website members to an e-newsletter system he uses to send out emails to his members on a regular basis apprising them of new offers and latest updates/improvements on the website. His website has quite high traffic with over 20,000 active members so even though he used to send them email at the end of each month the process is quite time consuming and he wanted to automate it in some way.
After studying the e-newsletter system architecture and determining the tables which would need to be populated I wrote down the script which would perform the necessary exporting of data from one system to the other. Boy was I in for a surprise.
The script was running fine on the staging server and was copying the records correctly I deployed it on the live website to test it. The script had run for barely 15 seconds when the No Nodes Available error came up. I refreshed the page but it gave the same error. A first I thought that the script may be timing out however that premonition was ruled out as the error message did not say that the script had timed out or something to that effect. More over I had already increased the script time out to a sufficient time so the error was bit confusing.
I Googled the problem a bit and found that this problem was being encountered by a lot of people who hosted their websites on Rackspace. Rackspace have some sort of load balancers in place which check whether the page has displayed output with in the cut off time limit. If it has not then it will display the nodes not available error. Seeing this, the cut off time limit seems to be very low as the script had timed out within 15 seconds.
The solution they have provided is that there should be some sort of activity on the page while the script is processing the data. The activity can be anything like displaying an animated gif or displaying some text on the page. I modified the code to display the number of records which have been copied over in real time. I also set the buffer to false so the output of the page is sent to the browser as soon as some processing has been completed. I know it’s not a good idea to set buffer to false however in the circumstances this needed to be checked.
After making the change the script worked fine and copied the records correctly. I encountered no further nodes not available error.
Hope the above helped.
Tweet