I have set up a real-time chat application using longpolling.
Basically, I receive an ajax request and keep it through a while loop with PHP until I get an update.
The CPU is constantly at 99 which I guess is not what I should aim for.
So now I have two thoughts
1.How can I do longpolling differently to bring down the CPU value?
2.When keeping a connection open with sockets (eg c++), I use a loop to send and receive data, a constant process, just like with longpolling, but it does not affect the CPU value as much as it does with this longpolling method. Why?