hello everyone, sorry for the long post, but i am stumped and i want to be as precise as possible.
this is my setup: php 4.2.0 with the socket extension, as a dynamically loaded module in apache 1.3.23. it is running on is a red hat 7.0 box with kernel 2.2.19. this is was i am trying to do: i am using the socket functions to connect to a server which is running a ticketing software using a specifically designed protocol; the details do not matter here. i'll call my webserver "webserv.com", the client calling the script "client.com" and the ticketsystem "tixserv.com". i think i am doing everything by the book - just a simple one-shot tcp-client; writing some request to tixserv.com, reading the response and closing the connection. i am using socket_create(), socket_connect(), socket_write(), socket_read(), and finally socket_close(), pretty much the same way as the example 2 ("Simple TCP/IP client") in the php manual. this seems to work well (no errors or warnings). this is my problem: if i monitor the connection attempts with netstat, i am seeing the following behaviour: firstly, connections are established: from webserv.com to client.com and from webserv.com to tixserv.com: tcp webserv.com:1558 tixserv.com:45007 SYN_SENT 1126/httpd tcp webserv.com:www client.com:1894 ESTABLISHED 1126/httpd then, the connection from webserv.com to tixserv.com is closed (using socket_close() in the script), so the connection status goes to TIME_WAIT: tcp webserv.com:1558 tixserv.com:45007 TIME_WAIT - tcp webserv.com:www client.com:1894 ESTABLISHED 1126/httpd i see that to go to TIME_WAIT status is the correct way to behave for a socket. but the problem is that httpd somehow seems to wait for the TIME_WAIT status to go away and keeps the connection open during this time (ESTABLISHED). this takes a really long time (at least 30 seconds or more). at some time, the TIME_WAIT of the connection to tixserv.com finally goes away, and the connection to the client falls into that state: tcp webserv.com:www client.com:1894 TIME_WAIT - strange - my browser and php seem to ignore this: the script execution, measured with microtime(), is around 800 miliseconds, of which at least 90% is response time by tixserv.com which is fine. also, my browser does not need more than a second to display the script results. nonetheless, the httpd connection on the server stays ESTABLISHED for at least 30 seconds. the scary thing about this is that it gets worse if i start to stress the server. i used jakarta-jmeter to simulate simultaneous requests. jmeter did not behave the same as my browser: it actually waited until the httpd connection status was really closed. this totally stressed webserv.com: i had response times around 600 seconds and more, with only 5 threads doing 2 requests for the script. the load on webserv.com was huge during that time, sometimes i even had to stop apache to end the test. i am not sure if this is a bug or a problem of my code/concept. ideas, anyone? regards, guido -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php