How to record process execute time - Unix

This is a discussion on How to record process execute time - Unix ; Hi, I have a server with more than 2000 at web and 2000 at telnet. Indeed, it is bbs system with web support. And the load average is very high. Now, I want to find that how much time some ...

+ Reply to Thread
Results 1 to 12 of 12

Thread: How to record process execute time

  1. How to record process execute time

    Hi,
    I have a server with more than 2000 at web and 2000 at telnet.
    Indeed, it is bbs system with web support. And the load average is
    very high. Now, I want to find that how much time some CGI process
    takes on average and how much in user space, how much in system space,
    how much I/O it use as well as network. Is there such a tool in Unix
    for this purpose? Something worth notice is that the CGI is running by
    apache, and I can't trace it because it start and do some I/O and then
    return. I should never pause some and trace some.

    Any advice will be appreciated very much!
    Thanks in advance!

    Regards!
    Bo

  2. Re: How to record process execute time

    Bo Yang wrote:
    > Hi,
    > I have a server with more than 2000 at web and 2000 at telnet.
    > Indeed, it is bbs system with web support. And the load average is
    > very high. Now, I want to find that how much time some CGI process
    > takes on average and how much in user space, how much in system space,
    > how much I/O it use as well as network. Is there such a tool in Unix
    > for this purpose? Something worth notice is that the CGI is running by
    > apache, and I can't trace it because it start and do some I/O and then
    > return. I should never pause some and trace some.
    >
    > Any advice will be appreciated very much!
    > Thanks in advance!
    >
    > Regards!
    > Bo

    Personally, I'd use SNMP and graph it with something like Cacti.

    --
    DM davidm@cia.com.au

    'It would go against respecting principles and truth if you have to
    respect and accept anything just because it is the other side's view.'
    - Kim Jung Ill

  3. Re: How to record process execute time

    Bo Yang writes:

    > Indeed, it is bbs system with web support. And the load average is
    > very high. Now, I want to find that how much time some CGI process


    A high load is ok if the CPU has cycles to spare when doing them.

    The answer to your question depends on which Unix-version you are using.

    --
    Thorbjørn Ravn Andersen

  4. Re: How to record process execute time

    On 10 19 , 4 44 , Thorbjoern Ravn Andersen
    wrote:
    > Bo Yang writes:
    > > Indeed, it is bbs system with web support. And the load average is
    > > very high. Now, I want to find that how much time some CGI process

    >
    > A high load is ok if the CPU has cycles to spare when doing them.


    Yeah, the CPU is idle for about 50%. So, what a load indicate anyway?
    Does that mean the system is under high volumn?

    > The answer to your question depends on which Unix-version you are using.


    I use Linux.

    Regards!
    Bo


  5. Re: How to record process execute time

    Bo Yang writes:

    > > A high load is ok if the CPU has cycles to spare when doing them.

    >
    > Yeah, the CPU is idle for about 50%. So, what a load indicate anyway?


    The load is the average length of the run queue, i.e. the number of
    programs which are ready to run. If the CPU has cycles to spare it
    indicates that the programs quickly determine they are done and let
    the next one get the CPU.

    This could be the case with a lot of threads which do some kind of
    check-for-activity and if none wait some more.

    Sounds like your BBS has a thread per login.

    > Does that mean the system is under high volumn?
    >
    > > The answer to your question depends on which Unix-version you are using.

    >
    > I use Linux.


    Its been a while, but I believe that top, iostat and vmstat er the
    tools you need for this.
    --
    Thorbjørn Ravn Andersen

  6. Re: How to record process execute time

    On 10 19 , 12 23 , Thorbjoern Ravn Andersen
    wrote:
    > Bo Yang writes:
    > > > A high load is ok if the CPU has cycles to spare when doing them.

    >
    > > Yeah, the CPU is idle for about 50%. So, what a load indicate anyway?

    >
    > The load is the average length of the run queue, i.e. the number of
    > programs which are ready to run. If the CPU has cycles to spare it
    > indicates that the programs quickly determine they are done and let
    > the next one get the CPU.
    >
    > This could be the case with a lot of threads which do some kind of
    > check-for-activity and if none wait some more.
    >


    Because my system use CGI with apache. I find in the busy time there
    are more than 120 process created per second. I get this from sar. And
    the main task for each process is just read/write disk and then send
    the response back to the browser. I think when it is the busy time,
    there are more than 160 requests from the browsers to apache, and
    apache fork many cgis to complete the task. This causes the high
    process creation rate. For the load average, I think when the process
    creation rate are high, there will be many process waiting in the run
    queue. And because many of them just do simple I/O, the the CPU idle
    is still high.
    Could you please tell me that whether my explanation is right?
    Thanks.
    And if so, how to improve the situation? FastCgi? Thanks!

    Regards!
    Bo


  7. Re: How to record process execute time

    Bo Yang writes:

    > Could you please tell me that whether my explanation is right?
    > Thanks.
    > And if so, how to improve the situation? FastCgi? Thanks!


    This sounds like a reasonable explanation. I am not an Apache expert,
    but you may want to say what your CGI programs are written in and what
    they actually do.

    If they are Perl programs, there are very efficient extensions to
    Apache.
    --
    Thorbjørn Ravn Andersen

  8. Re: How to record process execute time

    Thorbjoern Ravn Andersen
    > Bo Yang writes:
    >
    >> Could you please tell me that whether my explanation is right?
    >> Thanks.
    >> And if so, how to improve the situation? FastCgi? Thanks!

    >
    > This sounds like a reasonable explanation. I am not an Apache expert,
    > but you may want to say what your CGI programs are written in and what
    > they actually do.
    >


    They are written in C and the main task for each cgi if roughly do a
    little disk read/write and return the result to the browser.

    > If they are Perl programs, there are very efficient extensions to
    > Apache.


    I hope FastCgi can help in this situation. Anyway, thank you for your
    help. Thanks!

    Regards!
    Bo

  9. Re: How to record process execute time

    Bo Yang writes:

    > I hope FastCgi can help in this situation. Anyway, thank you for your
    > help. Thanks!


    You are welcome. If this turns out to be a bottleneck anyway and you have
    the source for the small CGI-programs it is not hard to embed them
    natively in Apache.
    --
    Thorbjørn Ravn Andersen

  10. Re: How to record process execute time

    Thorbjoern Ravn Andersen :
    > Bo Yang writes:
    >
    >> I hope FastCgi can help in this situation. Anyway, thank you for your
    >> help. Thanks!

    >
    > You are welcome. If this turns out to be a bottleneck anyway and you have
    > the source for the small CGI-programs it is not hard to embed them
    > natively in Apache.

    You mean embedding the cgi programs into Apache itself. That sound very
    cool!

    Thanks!

    Regards!
    Bo

  11. Re: How to record process execute time

    Bo Yang writes:

    > You mean embedding the cgi programs into Apache itself. That sound
    > very cool!


    That is how the various CGI accellerators work themselves.

    You may want to look in a tutorial if your C needs brushing up.

    Personally I just use Apache as a frontend, as we do java-stuff and
    there are many high quality http servers in Java.

    --
    Thorbjørn Ravn Andersen

  12. Re: How to record process execute time

    Thorbjoern Ravn Andersen :
    > Bo Yang writes:
    >
    >> You mean embedding the cgi programs into Apache itself. That sound
    >> very cool!

    >
    > That is how the various CGI accellerators work themselves.
    >
    > You may want to look in a tutorial if your C needs brushing up.
    >
    > Personally I just use Apache as a frontend, as we do java-stuff and
    > there are many high quality http servers in Java.
    >

    Thank you very much! I will dig into more when neccessary, thanks!

    Regards!
    Bo

+ Reply to Thread