Monday, November 01, 2010

Measuring the scalibility of applications on CPU cores

Often we may be required to access the scalability of the application i.e. how well the application behaves with the increase in number of processors, memory, network bandwidth etc available to it.

Traditionally for example we may have done this by running on a 2 core machine and then run the same application on a 4 core machine with roughly same processor speed and same OS version.

But this method does not give a reliable estimate of scalability as there is lot of other parameters which change when we move between to physical machines.


We can use a muti-chip machine to access the scalability of an application. E.g. on a 2 chip Quad core machine (total 8 cores) we can test the application scalability on a single chip first (4 cores), by disable the all cores on other chip and then test the performance again on both the chips by enabling the already disabled cores i.e on all 8 cores.


Invoke the following commands through “root” user

To disable the cpu core:
echo -n "0">/sys/devices/system/cpu/cpu1/online

To enable the cpu cores use
echo -n "1">/sys/devices/system/cpu/cpu1/online


This way we can get to know how well the application scales using a single hardware box.

However we need to take care of things like which CPU cores to be disabled and which not, by knowing the processor layout of the hardware box under consideration which we catch up next time.

Sunday, August 15, 2010

Moving to 64 bit Computing

The 64 bit architectures history dates back to 1970's on RISC based Servers but is relatively new to x86 (32 bit) architecture space.
Intel shipped it first 64 bit processor (x86-64) in form of pricey Itanium Servers but Itanium did not live up to its hype. However it was when AMD introduced cheaper 64 bit Opteron processor for servers and Athlon 64 for workstations and desktop that 64 bit computing finally arrived to large arena. It is only then the 64 bit processors started gaining operating system support to exploit their functionality.

Most of the legacy applications which exist today or even ones which some developers are developing are 32 bit applications. Even though we have 64 bit operating system support on 64 bit hardware, there does not seem to be an urgency in dev community to port their 32 bit applications to 64 bit computing. The main reason which the developers may cite:

  • My application is not memory hungry and will fit in within 4 GB of virtual address space.
  • I do not use 64 bit data types (long, longlong, double etc),
  • Since i use none of the 64 bit features, why unnecessarily burden my 32 bit application with 64 bit overhead.

Apart from the concerns which developers have, one disadvantage of 64-bit architectures relative to 32-bit architectures is that the same data occupies more space in memory due to swollen pointers . In 32 bit the pointer is 32 bit in size while as in 64 bit the pointer is 64 bit in size. This increases the memory requirements of a given process and can have implications for efficient processor cache utilization.

While the concerns of a developer may me valid in some cases, let us look at the advantages which 64 bit has to offer over 32 bit:
  1. System architecture on Intel x86 (32-bit architecture) limits virtual memory space to 4 GB, This is not present in 64-bit architectures, which can use 4 GB of memory and more.
  2. Memory-mapped files with sizes more than 4Gb are becoming more difficult to implement in 32-bit architectures. However on a 64 bit architecture this is not an issue.
  3. Floating-point operations in 64 bit are implemented using a register-oriented instruction set, rather than the stack-based approach supported by x86.
  4. In 64 bit architectures (x86-64), the set of general-purpose registers is expanded from 8 in 32 bit (x86) to 16. Hence much of the program state is held in registers rather than on the stack effectively increasing the performance. Some procedures do not need to access the stack at all.

The last two points are very important form the performance perspective and should give you enough reasons to recompile your 32 bit application in 64 bit. Lot of applications when recompiled in 64 bit are often better than its counter part in 32 bit like latency performance tests. The difference is markedly visible in CPU intensive applications (throughput applications).

So there should be an urgency in porting 32 bit application (x86) to 64 bit platforms (x86-64) quickly to gain upon the performance benefit which the 64 bit computing has to offer.

Wednesday, July 21, 2010

Resurrection

I have woken up from deep slumber after nearly 6 years. Lot has changed in between. I manged to clear my grad studies, started my professional carrier and also got married. In my current role i am a devoted family man at home and a Product Performance Analyst at office.

In between I was pondering about to start writing my mind out, but for past two years I had been so occupied with my professional interests that i hardly give myself a chance to think outside the professional box .

I got inspired by my boss who is very passionate about providing computer education to the 80% of our masses who do not understand english . I also wanted to share my experiences gained by goggling. Also this blog will serve as a repository for those useful information.

I plan to write some about the technical stuff mostly performance related which i encounter as and when. I do not plan to follow any order will write random stuff. So i do not expect faithful followers but random googlers, bingers etc to hit this blog.

My goal for this blog is at least 20+ posts in one year.