Hello Narendra,
On 12/07/2010 10:10 PM, narendra babu wrote:
Hello folks ,
I need some inputs or guidance on improving the performance of existing c/c++
code on Linux .
Places to look for improving the performance in terms of cpu /network/ and
i/o inside the code.
I would like to any guidelines to collect information for the application
resource usage/netwok and i/o metrices
Good question ! This is exactly the type of question to ask when dealing with
performance. Most people forget that the precursor to performance tuning is
performance measurement. Trying to tune something just based on gut instinct is
like shooting in the dark hoping you hit your target. With proper benchmarking
you can, for example, come to a conclusion that there aren't really any high
gains to be achieved by optimizing that small bit of code where the application
spends just 5% of the time but you can possibly improve I/O throughput 20% by
just by tweaking a vm parameter.
Now, that said, you should understand 'performance' is a very generic broad
term. Try to answer the question -- What is it that you wish to tune for ?
Eventually you shall always end up making trade-offs. For instance, you could
make gains in I/O or network throughput but that will come at at the cost of
memory footprint or higher CPU requirements.
please let me know do we have guidelines , tools to identify these kind of
improvements inside the c/c++ code .
any tools or guidelines will be helpful
i have used vmstat/netstat/iostat for whole system but i need on application
basis .
If you think about it, your application is no different from any other
application from the system's point of view. So you can't just measure your
application in an isolated manner. That will just give you wrong metrics. You
have to consider measuring both the performance of the system as well as your
application in it's natural work environment to be able to correctly judge what
you can tune. So, use the tools you mentioned in conjunction with others for
your application.
Ok, talk aside - here are the tools that might help:
a. Start simple -- use time, strace (-C option) and ltrace (-c option) to get an
idea where your time is being spent.
b. Use top/pmap in batch-mode over the life time of your application to see
where and how memory is being used.
c. Use something like oprofile to get any idea of the environment that your
application functions in.
d. Use system-tap to instrument the measurement of whatever parameters you are
interested in measuring.
e. Use tcpdump/wireshark along with netstat to get an idea of actual bottlenecks
in network traffic.
Once you've collected your data, identify the 'hot-spots' and check to see
whether you can optimize anything there. There are tons of resources online to
help you depending entirely on what you wish to optimize for.
Finally here's a site that you might want to take some time to go through:
http://www.performancewiki.com/
cheers,
- steve
--
random spiel: http://lonetwin.net/
what i'm stumbling into: http://lonetwin.stumbleupon.com/
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc