Operating System - HP-UX
1855929 Members
12279 Online
104107 Solutions
New Discussion

Re: my socket is very slow in the hp-ux 11.00, why?

 
Yu Jingzhe
New Member

my socket is very slow in the hp-ux 11.00, why?

the server program and client program is very simple. the following is part of program.

/*server.c*/
int main(void)
{
socket(AF_INET, SOCK_STREAM, 0))
setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(int))

bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)
listen(sockfd, BACKLOG) == -1)
while(1)
{
accept(sockfd, (struct sockaddr *)&their_addr, &sin_size)) ==
-1)
if (!fork())
{
// this is the child process
close(sockfd); // child doesn????t need the listener
send(new_fd, "Hello, world!\n", 14, 0) == -1)
exit(0);
}
close(new_fd); // parent doesn????t need this
}
return 0;
}

/*client.c/
int main(int argc, char *argv[])
{
gethostbyname(argv[1])) == NULL)
socket(AF_INET, SOCK_STREAM, 0))
connect(sockfd, (struct sockaddr *)&their_addr,sizeof(struct
sockaddr))
recv(sockfd, buf, MAXDATASIZE-1, 0) /*slow function*/
close(sockfd);
}

this client and server works very well in the linux, but if the server
is in the hp-ux, client is in the linux, it is very slow, the time of
recv() function in the client is about 10 times longer than in linux.
If both client and server are in Hp-ux, it is much slower.

Is there some problem in my HP-UX?

hope anybody help me.

thanks

Yu
3 REPLIES 3
Steven Sim Kok Leong
Honored Contributor

Re: my socket is very slow in the hp-ux 11.00, why?

Hi,

First, check that your gethostbyname on your client is able to resolve the host to IP address properly ie. check your /etc/nsswitch.conf, /etc/resolv.conf and /etc/hosts (whichever is applicable based on your name service switches).

Second, check your network performance between your client and server using tools such as iperf described at http://dast.nlanr.net/Projects/Iperf/

The gzipped tarball can be downloaded from:

http://dast.nlanr.net/Projects/Iperf/iperf-1.2.tar.gz

It allows you to test TCP/UDP socket throughput.

Third, if your findings have been verified (ie. that HP-UX is slower), check your TCP tunable parameters using ndd

# ndd -get /dev/tcp ...

In particular, check out the following TCP network parameters:

tcp_xmit_hiwater_def (read and write)
tcp_xmit_lowater_def (read and write)
tcp_recv_hiwater_def (read and write)
tcp_xmit_hiwater_lfp (read and write)
tcp_xmit_lowater_lfp (read and write)
tcp_recv_hiwater_lfp (read and write)
tcp_xmit_hiwater_lnp (read and write)
tcp_xmit_lowater_lnp (read and write)
tcp_recv_hiwater_lnp (read and write)

Hope this helps. Regards.

Steven Sim Kok Leong
Yu Jingzhe
New Member

Re: my socket is very slow in the hp-ux 11.00, why?

Hi,Steven,
Thank your reply. My gethostbyname() function is very fast, and the network persofrmance is good. So I use ndd to check the tunable paramters. But I don't know how to use ndd to set the paramters, for example I don't know the correct value of tcp_xmit_hiwater_def. Can you tell me how to use ndd?

thanks

Yu
harry d brown jr
Honored Contributor

Re: my socket is very slow in the hp-ux 11.00, why?

Yu,

The first thing to do is to make sure your system is up to date with patches. You should have at least the Dec 2001 patch bundle installed, and then using the custom patch manager determine what other pathces are necessary/suggested.

live free or die
harry
Live Free or Die