C-Why should Phpredis call poll two times after sending the data?

Source: Internet
Author: User
Tags pconnect htons
$host = '127.0.0.1';$port = 8888;$key = 'group:32149904:binding';$redis = new Redis();$redis->pconnect($host, $port);$obj = $redis->get($key);echo $obj, PHP_EOL;

PHP code is the above, and then I strace a bit, the result is as follows

1565 Connect (3, {sa_family=af_inet, sin_port=htons (6080), sin_addr=inet_addr ("10.83.73.168")}, +) = 1 einprogress ( Operation now in progress) 1566 poll ([{fd=3, events=pollin| Pollout| pollerr| Pollhup}], 1, +) = 1 ([{fd=3, revents=pollout}]) 1567 getsockopt (3, Sol_socket, So_error, [0], [4]) = 01568 fcntl (3, f_s ETFL, O_RDWR) = 01569 setsockopt (3, Sol_tcp, Tcp_nodelay, [1], 4) = 01570 poll ([{fd=3, events=pollin| pollpri| pollerr| Pollhup}], 1, 0) = 0 (Timeout) 1571 sendto (3, "*2\r\n$3\r\nget\r\n$22\r\ngroup:32149904" ..., 0) = 4 21572 poll ([{fd=3, events=pollin| pollpri| pollerr| Pollhup}], 1, 0) = 0 (Timeout) 1573 poll ([{fd=3, events=pollin| pollerr| Pollhup}], 1, +) = 1 ([{fd=3, Revents=pollin}]) 1574 recvfrom (3, "$44\r\n{\" allyid\ ": \" 60979\ ", \" appid\ ": \" "..., 8192                        , msg_dontwait, NULL, NULL) = 511575 Write (1, "{\" "allyid\": \ "60979\", \ "appid\": \ "ex_mm" ..., () = 441576 write (1, "\ n", 1) = 11577 Poll ([{fd=3, events=pollin| pollpri| pollerr|Pollhup}], 1, 0) = 0 (Timeout) 1578 setsockopt (3, Sol_tcp, Tcp_nodelay, [1], 4) = 01579 poll ([{fd=3, events=pollin| pollpri| pollerr| Pollhup}], 1, 0) = 0 (Timeout) 1580 SendTo (3, "*2\r\n$3\r\nget\r\n$22\r\ngroup:32149904" ..., 0) = 4 21581 poll ([{fd=3, events=pollin| pollpri| pollerr| Pollhup}], 1, 0) = 0 (Timeout) 1582 poll ([{fd=3, events=pollin| pollerr| Pollhup}], 1, +) = 1 ([{fd=3, Revents=pollin}]) 1583 Recvfrom (3, "$44\r\n{\" allyid\ ": \" 60979\ ", \" appid\ ": \" "..., 8192                        , msg_dontwait, NULL, NULL) = 511584 Write (1, "{\" "allyid\": \ "60979\", \ "appid\": \ "ex_mm" ..., () = 441585 write (1, "\ n", 1) = 1

In 1572 rows, after the Get command is sent, the call to Poll,timeout passes the 0,1573 line again to call Poll,timeout into 2000.

Excuse me, why do we call two times poll? Can I just call once?

Reply content:

$host = '127.0.0.1';$port = 8888;$key = 'group:32149904:binding';$redis = new Redis();$redis->pconnect($host, $port);$obj = $redis->get($key);echo $obj, PHP_EOL;

PHP code is the above, and then I strace a bit, the result is as follows

1565 Connect (3, {sa_family=af_inet, sin_port=htons (6080), sin_addr=inet_addr ("10.83.73.168")}, +) = 1 einprogress ( Operation now in progress) 1566 poll ([{fd=3, events=pollin| Pollout| pollerr| Pollhup}], 1, +) = 1 ([{fd=3, revents=pollout}]) 1567 getsockopt (3, Sol_socket, So_error, [0], [4]) = 01568 fcntl (3, f_s ETFL, O_RDWR) = 01569 setsockopt (3, Sol_tcp, Tcp_nodelay, [1], 4) = 01570 poll ([{fd=3, events=pollin| pollpri| pollerr| Pollhup}], 1, 0) = 0 (Timeout) 1571 sendto (3, "*2\r\n$3\r\nget\r\n$22\r\ngroup:32149904" ..., 0) = 4 21572 poll ([{fd=3, events=pollin| pollpri| pollerr| Pollhup}], 1, 0) = 0 (Timeout) 1573 poll ([{fd=3, events=pollin| pollerr| Pollhup}], 1, +) = 1 ([{fd=3, Revents=pollin}]) 1574 recvfrom (3, "$44\r\n{\" allyid\ ": \" 60979\ ", \" appid\ ": \" "..., 8192                        , msg_dontwait, NULL, NULL) = 511575 Write (1, "{\" "allyid\": \ "60979\", \ "appid\": \ "ex_mm" ..., () = 441576 write (1, "\ n", 1) = 11577 Poll ([{fd=3, events=pollin| pollpri| pollerr|Pollhup}], 1, 0) = 0 (Timeout) 1578 setsockopt (3, Sol_tcp, Tcp_nodelay, [1], 4) = 01579 poll ([{fd=3, events=pollin| pollpri| pollerr| Pollhup}], 1, 0) = 0 (Timeout) 1580 SendTo (3, "*2\r\n$3\r\nget\r\n$22\r\ngroup:32149904" ..., 0) = 4 21581 poll ([{fd=3, events=pollin| pollpri| pollerr| Pollhup}], 1, 0) = 0 (Timeout) 1582 poll ([{fd=3, events=pollin| pollerr| Pollhup}], 1, +) = 1 ([{fd=3, Revents=pollin}]) 1583 Recvfrom (3, "$44\r\n{\" allyid\ ": \" 60979\ ", \" appid\ ": \" "..., 8192                        , msg_dontwait, NULL, NULL) = 511584 Write (1, "{\" "allyid\": \ "60979\", \ "appid\": \ "ex_mm" ..., () = 441585 write (1, "\ n", 1) = 1

In 1572 rows, after the Get command is sent, the call to Poll,timeout passes the 0,1573 line again to call Poll,timeout into 2000.

Excuse me, why do we call two times poll? Can I just call once?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.