Skip to content

[bug]Concurrent with more than 1000 requests. #129

Closed

Description

@slince

Hello there

I met two problem.

  • Concurrent with more than 1000 requests.

I find that if I send more than 1000 requests at the same time, some requests will get timeout exception.

  • unable handle http message with bad separator:

Some http header and body are concatenated by "\n\n", not "\r\n\r\n". this package cannnot handle theme correctly, but browser can.
ps: I encountered this problem on win, I do not know Linux will not have this problem

Activity

  1. clue commented on Feb 27, 2018

    @clue
    Member

    I find that if I send more than 1000 requests at the same time, some requests will get timeout exception.

    This is more or less expected behavior as your system and/or network may not be able to cope with this high number of concurrent requests. As an alternative, I would suggest using some kind of queuing mechanism to limit your concurrency, for example https://github.com/clue/php-mq-react.

    Some http header and body are concatenated by "\n\n", not "\r\n\r\n". this package cannnot handle theme correctly, but browser can.

    Can you show us some code and/or URLs to reproduce the problem you're seeing? As per https://tools.ietf.org/html/rfc7230#section-3.5 this would require a CRLF, but apparently also accept a LF for robustness.

  2. slince commented on Feb 27, 2018

    @slince
    Author

    @clue I wrote some debug code in package "react/http-client"

    //vendor/react/http-client/src/Request.php#L133

        public function handleData($data)
        {
            $this->buffer .= $data;
            debug($data);
            debug(false !== strpos($this->buffer, "\n\n"));
            debug(false !== strpos($this->buffer, "\r\n\r\n"));
            exit;

    and result:

    \vendor\react\http-client\src\Request.php (line 137)
    'HTTP/1.0 200 OK
    Content-type: text/html
    
    {"1":{"accept":0,"reject":0,"failed":0,"hw_failed":0,"time":68552,"miner_ip":"cryptonight.eu.nicehash.com:3355","miner_username":"19qaJZPjFqdhq4xCVeKYdwQcgj14FATpn6","diff":0,"network_delay":0,"hashrate":0,"hashrate_list":[0,0,0,0,0,0,0,0,0,0,0,0],"hashrate_list_15m":[0,0,0,0,0,0,0,0,0,0,0,0],"hashrate_list_30m":[0,0,0,0,0,0,0,0,0,0,0,0],"hashrate_list_45m":[0,0,0,0,0,0,0,0,0,0,0,0],"hashrate_list_1h":[0,0,0,0,0,0,0,0,0,0,0,0]},"2":{"accept":1332,"reject":62,"failed":57,"hw_failed":57,"time":68557,"miner_ip":"cryptonight.eu.nicehash.com:3355","miner_username":"19qaJZPjFqdhq4xCVeKYdwQcgj14FATpn6","diff":400015.581168,"network_delay":0,"hashrate":0,"hashrate_list":[2000.077881,4666.848145,7333.618164,4000.155762,6000.233398,6666.925781,8667.003906,1333.385254,4000.155762,4000.155762,5333.541016,4666.848145],"hashrate_list_15m":[5333.541504,4666.847656,6444.696289,4889.079102,4222.386230,4000.155273,4666.848145,5111.310547,4666.847656,5555.772461,4666.848145,4666.847656],"hashrate_list_30m":[3777.925781,5000.196289,4611.312012,5555.774902,3333.464111,5222.427734,5000.196777,5666.890137,4111.272949,4889.080566,5111.311523,4666.850098],"hashrate_list_45m":[5600.221680,4444.619141,5555.773926,6074.314453,4926.210449,4666.850586,5444.673340,3777.927002,5259.466797,5185.390137,4592.772461,4963.158691],"hashrate_list_1h":[4776.639160,4387.842773,5633.562012,4622.398926,5000.197266,6359.663574,4387.843750,5082.133301,4277.947266,5333.544922,4500.178711,4887.724609]},"3":{"accept":693,"reject":95,"failed":0,"hw_failed":0,"time":68557,"miner_ip":"cryptonight.eu.nicehash.com:3355","miner_username":"19qaJZPjFqdhq4xCVeKYdwQcgj14FATpn6","diff":200007.790584,"network_delay":0,"hashrate":0,"hashrate_list":[1333.385254,3333.463379,1333.385254,4000.155762,2666.770508,2666.770508,3333.463379,666.692627,2000.077881,1333.385254,2666.770508,2000.077881],"hashrate_list_15m":[2666.770264,3777.924561,2666.770264,1777.846924,3111.231934,1777.846924,2222.308594,1777.846924,2000.077759,3111.231934,2000.077759,2000.077759],"hashrate_list_30m":[1333.385132,3000.117432,1777.846802,1222.269775,1333.385132,2666.770508,3222.348389,2222.308594,2444.539551,2000.077637,2555.655029,2000.077637],"hashrate_list_45m":[1926.001099,2074.155273,1851.924072,2296.386230,1777.847046,2592.694580,1407.462036,1926.001099,2889.002686,2518.617432,1926.001099,2370.463379],"hashrate_list_1h":[1943.980835,2110.607910,1388.943115,1888.963013,2055.636475,2388.319580,2166.149658,1499.642090,2000.078613,2722.329834,2222.309814,2277.234863]},"4":{"accept":1417,"reject":82,"failed":0,"hw_failed":0,"time":68557,"miner_ip":"cryptonight.eu.nicehash.com:3355","miner_username":"19qaJZPjFqdhq4xCVeKYdwQcgj14FATpn6","diff":400015.581168,"network_delay":0,"hashrate":0,"hashrate_list":[1333.385254,5333.541016,4666.848145,5333.541016,6000.233398,6000.233398,8000.311523,9333.696289,2000.077881,7333.618164,6000.234375,6666.926758],"hashrate_list_15m":[3555.693848,4444.617188,6666.925781,5778.002441,3777.924561,5778.002441,4889.079102,6222.463867,3777.924561,5778.003418,6444.695312,6666.925781],"hashrate_list_30m":[3889.041748,4777.963379,5111.312988,4666.850586,6444.696777,5000.195312,4000.157471,6222.465332,4777.964355,5555.772461,4777.966309,6555.814453],"hashrate_list_45m":[7911.561523,4148.310547,5185.389648,5185.389648,4000.158203,4592.772461,5111.312012,6666.929688,3629.772949,5407.620117,5629.852051,5333.544922],"hashrate_list_1h":[5054.351074,5720.860352,5222.428711,6655.922852,4666.850586,4943.267090,4332.301758,4887.725098,5722.448242,5111.313965,5166.871094,5665.317871]},"dashboard":{"temperature_list":[40,40,40,40,39,39,40,40,40,40,40,40],"fanspeed_list":[1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200],"fanspeed_list2":[1110,1080,1110,1110,1110,1110,1110,1110,1110,1110,1080,1110],"temperature":40,"temperature_unit1":255,"temperature_unit2":39,"temperature_unit3":39,"temperature_unit4":46,"fanspeed":1200,"fanspeed2":1110,"ip":"192.168.1.166","gw":"192.168.1.1","mac":"08:13:bb:5a:54:6f","freq":360}}'
    \vendor\react\http-client\src\Request.php (line 138)
    true
    \vendor\react\http-client\src\Request.php (line 139)
    false
    

    This is a http 1.0 response.

  3. kelunik commented on Apr 7, 2018

    @kelunik

    @slince Could you share which server software generates such responses?

  4. slince commented on Apr 8, 2018

    @slince
    Author

    @kelunik The service is very old and you can see that it is using the http 1.0, which is a CGI written in C language

  5. added this to the v0.5.9 milestone on Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions