Performance Engineering: True measure of code performance

If you understand throughput as the effective number of transactions that users experience per second from your hardware software stack then you would ideally want maximum possible transactions per second from your setup.

 

We understand that any software stack would ultimately use CPU cycles to process all these transactions. Hence, the transactions per second delivered per CPU cycle is the true measure of the performance of your system.

 

Ideally we should be measuring throughput of a system and how many CPU cycles does it take to deliver that throughput. Inefficient code would spend many more CPU cycles to deliver X number of transactions per second aka tps. Optimized and efficient code would deliver the same transactions per second using far lesser CPU cycles.

 

Thus a good measure of system performance is throughput per CPU usage. This is the number to watch.

Advertisements

3 Comments to “Performance Engineering: True measure of code performance”

  1. Throughput per CPU usage may be a good measure.Lets see deep into it.

    How you are going to calculate this CPU usage?
    How much is the cost for this calculating?
    Calculating CPU can be very complex?Are you using tools for that?
    If so, how much those tools costs for us?What will be overall cost?
    How much we are going to (as a company and as a client) benefit if we adopt to calculate the CPU usage as throughput tomorrow?

    • > Throughput per CPU usage may be a good measure.Lets see deep into it.

      Throughput / CPU is one of the many parameters to look at Performance. If can be used to for following exercises
      If you are comparing two software stacks doing similar work, then the one which uses less cpu is better. The difference will be more visible when the load become larger and cpu is close to saturation.
      You can also compare Throughput/cpu of your configuration under different condition, to localize which parts of the code are consuming more cpu. Can they be optimized to reduce the cpu consumption.
      > How you are going to calculate this CPU usage?

      A simple rule would be to look at Throughput / (sys+usr). This will give aggregate of cpu usage within the system and by the application. Further insight can be obtained by looking at Throughput per either sys or usr. High usr cpu would mean application or user-space programs are taking up more cpu.

      > How much is the cost for this calculating?

      Computing cost : Getting cpu usage is high at all. Most unix system have ‘sar’ utilities, which readily give the cpu usage and its break down. However, its some work to get run-time sar information and compute THroughput/cpu that makes sense for you.
      Monetoary Cost : If you can write wrapper scripts to acquire and analyze system monitoring data, then it will cost nothing. However, there are also paid application available which will allow you to compute various performance parameters – if you know what you are looking for.

      > Calculating CPU can be very complex?Are you using tools for that?

      There are many like cpuinfo, mstat, etc. however sar is generically available on most unix platforms (though there are minor differences for different OS).

      > If so, how much those tools costs for us?What will be overall cost?

      If your business requires extensive debugging of code or is running business-critical applications then it may be worth buying one. But for most use cases it is not required. You are better off using one of the system packaged tools mentioned above – sar etc.

      > How much we are going to (as a company and as a client) benefit if we adopt to calculate the CPU usage as throughput tomorrow?

      As you may expect – It will depend on the specific applications / usage. In cases where cpu usage is high and there is a lot of transaction load, such analysis may give extra-performance (and/or) improve source code.

    • If you use Solaris, maybe you could try DTrace.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: