I have a single-threading implemented program (written by somebody else). In this program, one server listens and accepts connection set up request from multiple clients, puts client information in data base, and provides this information to other processes.
Here is the problem: although the tasks the server are doing are very simple (as I just mentioned), the CPU of the server was quickly used up when the number of clients goes up. My task is to find out if the program has some bugs which leads to the CPU exhaustion; or if some implementation of the program is not efficient.
By using dtrace, I found most of the CPU was consumed by the following system calls: pollsys, recvfrom, sendto. I know the recvfrom, sendto are used to receive data from remote clients and send data to clients, but I am not familiar with pollsys and did not find enough information from internet. It seems like The pollsys syscall is normally used
for checking whether there is any data that can be read from or write to a file descriptor. Then how do I know who call pollsys and in which case the pollsys is called. Is it called periodically or called by signal interrupt, or due to some events?
I am a newbi in unix and its tracing tools. I wonder if anybody can answer my questions and also give me some suggestion like how to narrow down my focus and dig out the reason of the problem.
Thanks.
Here is the problem: although the tasks the server are doing are very simple (as I just mentioned), the CPU of the server was quickly used up when the number of clients goes up. My task is to find out if the program has some bugs which leads to the CPU exhaustion; or if some implementation of the program is not efficient.
By using dtrace, I found most of the CPU was consumed by the following system calls: pollsys, recvfrom, sendto. I know the recvfrom, sendto are used to receive data from remote clients and send data to clients, but I am not familiar with pollsys and did not find enough information from internet. It seems like The pollsys syscall is normally used
for checking whether there is any data that can be read from or write to a file descriptor. Then how do I know who call pollsys and in which case the pollsys is called. Is it called periodically or called by signal interrupt, or due to some events?
I am a newbi in unix and its tracing tools. I wonder if anybody can answer my questions and also give me some suggestion like how to narrow down my focus and dig out the reason of the problem.
Thanks.
Comment