Net_Gearman Problems
| From: | Joshua Eichorn | Date: | Thu, 05 Jun 2008 05:20:59 +0000 |
| Subject: | Net_Gearman Problems | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-50232@lists.php.net to get a copy of this message | ||
I started using Net_Gearman today (SVN version), works pretty well but i have run into 1 big problem.
Net_Gearman is using a non blocking socket, which means if you want to send a lot of data say 300k and your link isn't fast, say an ssh tunnel from a EC2 node then the socket_write will fail with EAGAIN.
Now commenting out socket_set_nonblock on line 154 fixes my problem but i'm guessing thats not the correct solution since it should make everything slower.
The manpage for send says
When the message does not fit into the send buffer of the socket, send() normally blocks,
unless the socket has been placed in non-blocking I/O mode. In non-blocking mode it would
return EAGAIN in this case. The select(2) call may be used to determine when it is possi-
ble to send more data.
So in theory you can use socket_select in this case and then break the data up into smaller chunks yourself
Anyone who has worked on Net_Gearman or Sockets have any thoughts?
I also have some other thoughts:
Make sure the docs for 0.1.2 let everyone know your json encoding the data now
Maybe changing data encoding method should be configurable or at least have an example of changing it by extending whatever you need to extend
Have you thought of just passing an instance of the Job class to addAbility, the current setup is limiting and i don't really see the benefit
Are you going to add a method of doing easy sync calls, background ones are easy with the __call mapping but its 5 lines for a sync call.
Thanks for the code
-josh