module模块的测试心得(3)

这里的特征就是与后端的连接支持不了几个请求就会被nginx主动关闭,加了accept_metex off;就能够避免此问题。经过我测试,这是ngx_http_upstream_keepalive_module的普遍问题,并不是ajp模块自身的问题。

当时在调试广告投放系统的时候,就发现nginx与后端的连接,虽然按照keepalive说明文档做了,仍然维持不了连接,出现大量time_wait。希望这仅仅是我的误解,而不是真正的问题

4、这个不知道是不是问题,从strace查看,发现多出一个EPOLLOUT事件

epoll_wait(3, {{EPOLLIN, {u32=3085643784, u64=13832229564705353736}}}, 4096, -1) = 1
    gettimeofday({1299826536, 530432}, NULL) = 0
    accept(5, {sa_family=AF_INET, sin_port=htons(3421), sin_addr=inet_addr("61.135.255.86")}, [16]) = 6
    ioctl(6, FIONBIO, [1])                  = 0
    epoll_ctl(3, EPOLL_CTL_ADD, 6, {EPOLLIN|EPOLLET, {u32=3085643872, u64=13832226094371778656}}) = 0
    epoll_wait(3, {{EPOLLIN, {u32=3085643872, u64=13832226094371778656}}}, 4096, 5000) = 1
    gettimeofday({1299826536, 534502}, NULL) = 0
    recv(6, "GET /test.jsp HTTP/1.1\r\nHost: te"..., 1024, 0) = 1024
    recv(6, "; Province=010; City=010; __utmc"..., 7564, 0) = 117
    epoll_ctl(3, EPOLL_CTL_MOD, 6, {EPOLLIN|EPOLLOUT|EPOLLET, {u32=3085643872, u64=13832224891780935776}}) = 0
    socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 7
    ioctl(7, FIONBIO, [1])                  = 0
    epoll_ctl(3, EPOLL_CTL_ADD, 7, {EPOLLIN|EPOLLOUT|EPOLLET, {u32=3085643960, u64=13832223603290747064}}) = 0
    connect(7, {sa_family=AF_INET, sin_port=htons(20004), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
    epoll_wait(3, {{EPOLLOUT, {u32=3085643960, u64=13832223603290747064}}, {EPOLLOUT, {u32=3085643872, u64=13832224891780935776}}}, 4096, 60000) = 2
    gettimeofday({1299826536, 535060}, NULL) = 0
    getsockopt(7, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
    writev(7, [{"\0224\4\177\2\2\0\10HTTP/1.1\0\0\t/test.jsp\0\0\r6"..., 1155}], 1) = 1155    //向后端发送请求
    recv(6, 0xbff5f143, 1, MSG_PEEK)        = -1 EAGAIN (Resource temporarily unavailable) 
    epoll_wait(3, {{EPOLLIN|EPOLLOUT, {u32=3085643960, u64=13832223603290747064}}}, 4096, 60000) = 1
    gettimeofday({1299826536, 537102}, NULL) = 0
    recv(7, "AB\0;\4\0\310\0\2OK\0\0\2\0\fContent-Type\0\0\tt"..., 4096, 0) = 87           //读取后端数据
    fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0
    mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7de0000
    write(1, "key=Content-Type,value=text/html"..., 33key=Content-Type,value=text/html
    ) = 33
    write(1, "key=Content-Length,value=10\n", 28key=Content-Length,value=10
    ) = 28
    writev(6, [{"HTTP/1.1 200 OK\r\nServer: nginx\r\n"..., 156}, {"2 + 2 = 4\n", 10}], 2) = 166 //返回数据给客户端
    setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = 0
    recv(6, 0x9881c40, 1024, 0)             = -1 EAGAIN (Resource temporarily unavailable)
    epoll_wait(3, {{EPOLLOUT, {u32=3085643960, u64=13832223603290747064}}}, 4096, 60000) = 1  //为啥多出这个事件???
    gettimeofday({1299826536, 537666}, NULL) = 0
    epoll_wait(3,

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wywpsg.html