views:

347

answers:

5

I have a server application written in C++ and deployed in Cent OS. I haven't wrote any part of its code but i need to optimize its performance. Its current performance is acceptable for few amount of users but when the number of users increase the server's performance decrease dramatically.

Are there any tools, techniques or best practices to find out the bottlenecks?

A: 

That is a bit of a very vague question. There are serveral things we don't know about the setup: 1. what data the program typically gets 2. what software 3. the normal timings that it takes to process things.

With that and more information we might be able to answer your question.

monksy
+10  A: 

People typically use profilers to determine performance bottlenecks. Earlier SO questions asking for C++ profilers are here and here (depending on the operating system and compiler you use). For Linux, people typically use gprof, just because it comes with the system.

Martin v. Löwis
Profilers are great - but clearly unsuitable for use on a production system - you'll need to reproduce the problem on a non-production system first.
MarkR
Actually, you don't need to see the problem on the development system. Instead, the profiler might tell you were a significant portion of the run-time is spent even if you don't recognize this as being "long". Of course, there are other problems (e.g. with database performance) where profiling the application won't help.
Martin v. Löwis
+3  A: 

You'll start by building a performance test environment if you don't have one

  • Production-grade hardware. If you do not have the budget for this, you may as well give up.
  • Driver program(s) or hardware devices which throw production-like traffic at it at a high rate - as fast or faster than production. Depending on your protocol and use-case this may be easy or difficult. One technique is to sample some requests from production and replay them - but this may be give unrealistic results as it will give higher cache hit rates.
  • Surrounding infrastructure as similar to production as you can reasonably get

Then reproduce the problem, as it exists in production. Once you've done that, then use a profiler etc, as others have suggested.

MarkR
+1 Nice comments on how to reproduce the performance problem.
Tom Leys
A: 

This works, without fail.

Mike Dunlavey
A: 

Is a flawed design considered a bottleneck?

woolstar
Answering a question with a question...?
GMan