-
Notifications
You must be signed in to change notification settings - Fork 31
High CPU load #11
Comments
The high CPU load is probably from the read loop. We should probably switch over to using stream_select and stream_get_line in the readLine method. If you'd like to make the adjustments and see if this solves your CPU issue, then just submit a pull request. That would be greatly appreciated. public function readLine()
{
$result = stream_select(array(STDIN), array(), array(), 2);
if ($result > 0)
{
return trim(stream_get_line(STDIN, 65535, "\n"));
}
else return "";
} It may also be advantageous to do some research into using react |
I'll test it tomorrow at work, @home it doest work since there's a bug in php 5.3.10 - stream_get_line(); |
Do you know how tuples are sent to an php bolt ? Is it like Since when I'm trying to debug the bolt behaviour with tail (and the DEBUG log generated form the bolt) I don't get the load with current code and the new one, but if I do: So It might be that bolt got "disconnected" from the stream of tuples and therefor the load ? |
That's essentially what it looks like. Just a flooded stream of json. Multilang Protocol for more information. It sounds like we aren't checking for EOF anywhere in that loop. So we get an infinite loop at the end of the file. IIRC, |
Out of curiosity Is this still an issue? I'm doing research for a realtime analytics platform, and we will most likely make a symfony2 bundle encompassing this, as such could easily fork the code, but don't wan't to do the work double. |
While I can use storm-php for my bolts I have very high CPU load.
This is probably because of while(true) $line = trim($this->readLine()); ?
If this is the case should we implement usleep or something to ease off when no data is coming ?
The text was updated successfully, but these errors were encountered: