dougaimian1143 2013-05-29 19:01
浏览 152
已采纳

当值太大时,php-handlersocket结果被截断

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.

  • 写回答

1条回答 默认 最新

  • dongzhao5970 2013-07-02 12:25
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看