Question

Our setup is as follows:

  • Primary DB Server, Amazon EC2 m2.xlarge instance (17GB ram, 2x3.25ecu CPU) running Percona 5.5.x
  • Application Server(s), Amazon EC2 m1.large instance (7.5GB ram, 2x2ecu CPU) running PHP 5.4
  • php-handlersocket PECL library found here http://code.google.com/p/php-handlersocket/

For the most part it works but as soon as I load up the app server with even relative traffic, the results start failing on queries where the result record(s) have fields with medium to large values. The two main culprits in our case are XML strings that are ~5Kb, and media files stored as binary objects 5-500Kb. The symptom is if I request 10 fields and the XML is in the 8th field, I'll get 7 results with data, and the 8th will be empty, 9 and 10 are not included at all.

There is a reported issue for the php-handlersocket library relating to this kind of problem, however there's also a proposed fix, which I've implemented and I thought it helped, but it seems not entirely. The issue details and fix are here http://code.google.com/p/php-handlersocket/issues/detail?id=28

My HandlerSocket settings are just slightly different than the defaults, should I be setting these different?

loose_handlersocket_port = 9998
loose_handlersocket_port_wr = 9999
loose_handlersocket_threads = 4
loose_handlersocket_threads_wr = 1
open_files_limit = 65535

I've reduced the default read threads to 4 since they recommend CORES * 2, the default is 16. I thought slower responses would be better than none at all, but this didn't seem to make a difference.

The php-handlersocket project looks to be dead which on it's own is a bit surprising, the last source updates were more than a year ago, but there doesn't seem to be any other PHP library available so I'm stuck.

I'm wondering if anyone has had similar problems, if there are other libraries available or if I should be exploring skipping libraries and creating my own interface with something like CURL.

Was it helpful?

Solution

So in the end, as with many problems, I became wary of an open source project with limited attention and decided to write my own php sockets based solution that's working perfectly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top