Tuesday, December 16, 2014

Wait Time Psychology Principles

Wait Time Psychology Principles

Below are the propositions:
  1. Unoccupied time feels longer than occupied time.
  2. Process-waits feel longer than in-process waits.
  3. Anxiety makes waits seem longer.
  4. Uncertain waits seem longer than known, finite waits.
  5. Unfair waits are longer than equitable waits.
  6. The more valuable the service, the longer the customer is willing to wait.
  7. Solo waits feel longer than group waits.

Monday, December 15, 2014

What is Context Switching?

In computing, a context switch is the process of storing and restoring the state (context) of a process or thread so that execution can be resumed from the same point at a later time. This enables multiple processes to share a single CPU and is an essential feature of a multitasking operating system. What constitutes the context is determined by the processor and the operating system.


Context switches are usually computationally intensive, and much of the design of operating systems is to optimize the use of context switches. Switching from one process to another requires a certain amount of time for doing the administration – saving and loading registers and memory maps, updating various tables and lists etc.

A context switch can mean a register context switch, a task context switch, a stack frame switch, a thread context switch, or a process context switch.

Intel Tick Tock.

Attended the CMG India conference at Pune and came across Intel's tick tock

Intel's strategy goes beyond finding ways to shrink components to tinier scales in order to boost power. The company has what it calls a tick-tock strategy. It develops chip technologies in two phases.

The tick phase involves finding a way to shrink elements down to a smaller size.
The tock phase is all about arranging the shrunken elements in the most efficient configuration to increase efficiency.

Example -

Intel's Sandy Bridge chip is an example of a tock technology. The previous tock chip, codenamed Nehalem. After Nehalem (code name) came the next tick: the Westmere family of microprocessors. While they have the same configuration as the Nehalem family of chips, Intel engineered Westmere's components down to 32 nanometers. Following Westmere is the tock of Sandy Bridge.

Wednesday, December 10, 2014

What is the difference among VIRT, RES, and SHR in top output?

VIRT stands for the virtual size of a process, which is the sum of memory it is actually using, memory it has mapped into itself (for instance the video card's RAM for the X server), files on disk that have been mapped into it (most notably shared libraries), and memory shared with other processes. VIRT represents how much memory the program is able to access at the present moment.

RES stands for the resident size, which is an accurate representation of how much actual physical memory a process is consuming. (This also corresponds directly to the %MEM column) This will virtually always be less than the VIRT size, since most programs depend on the C or other library.

SHR indicates how much of the VIRT size is actually sharable memory or libraries. In the case of libraries, it does not necessarily mean that the entire library is resident. For example, if a program only uses a few functions in a library, the whole library is mapped and will be counted in VIRT and SHR, but only the parts of the library file containing the functions being used will actually be loaded in and be counted under RES.

Friday, November 28, 2014

Monitoring Load average


Load average represents the number of processes waiting in the OS scheduler queue. Unlike CPU, load average will increase when any resource is limited (e.g. CPU, network, disk, memory etc.). Please refer to the blog “Understanding Linux Load Average” for more details.
We can use the following load average values to decide whether a machine is loaded
  • If load average < number of cores, then the machine is not loaded
  • If load average == number of cores, then the machine is in full use
  • If load average >= 4X number of cores, then the machine is highly loaded
  • If load average >= around 40X number of cores, then the machine is unusable

One mistake often made is profiling the CPU without first determining whether it is truly a CPU bound use case. Although CPU utilization shown by top command is low, machine may be busy doing IO (e.g. reading disk, writing to network). Load average is a much better metric for determining whether the machine is loaded.

Generally three figures are seen in top or uptime command for load average, something like -
1.08, 0.8. 4.0. This means load average over 1,5 and 15 mins.

In top command, at the top-right hand corner you should see your load averages displayed as three numbers. These numbers are setup as follows:

Load Averages: 1.00 2.00 3.00
1.00 - 1 Minute average
2.00 - 5 Minute average
3.00 - 15 Minute average

In the example above, these load averages would indicate that 15 minutes ago the server was averaging a load of 3.00, while 5 minutes ago it was averaging a load of 2.00, and over the last minute it's been averaging a load of 1.00. This means that over the course of 15 minutes the server was doing a lot of work, 5 minutes ago it cut that workload in half, and then within the last minute it was cut in half again.

The Linux load average on a server is a rough estimate of the workload currently waiting to process.

Monday, November 17, 2014

Difference between Purge and Delete.

Purge - 
To systematically and permanently remove old and unneeded data. The term purge is stronger than delete. It is often possible to regain deleted objects by undeleting them, but purged objects are gone forever.

 

Thursday, November 6, 2014

Why they say its difficult to manage software in case where database triggers are used

Came across a problem where an insert query was failing to write to a table with error - Duplicate primary key. Interesting part was that the table did not have a primay key. After spending some time it was noticed that there were two trigger configured for the table. One for insert and other for update. The insert trigger writes the same record in some other table which had the primary key constrain which was failing if the same insert query is executed twice. 

Tuesday, October 28, 2014

Parallelism vs Concurrency

I came across a very good difference between Parallelism vs Concurrency. Again nothing new but liked the way its put, brought a smile on my face.

Parallelism is about doing things at the same time
Concurrency is about doing things independently of each other

Concurrent thinking is System thinking . It is fundamentally different to parallel thinking. We talk about parallel programs but concurrent systems.

Friday, August 1, 2014

Reverse and Forward Proxy


The difference between a 'forward' and 'reverse' proxy is determined by where the proxy is running. 

For example, your ISP probably uses a web cache to reduce its bandwidth costs. In this case, the proxy is sitting between your computer and the whole Internet. This is a 'forward proxy'. The proxy has a limited set of users (the ISP's customers), and can forward requests on to any machine on the Internet (i.e. the web sites that the customers are browsing).
Alternatively, a company can put a web cache in the same data center as their web servers, and use it to reduce the load on their systems. This is a 'reverse proxy'. The proxy has an unlimited set of users (anyone who wants to view the web site), but proxies requests on to a specific set of machines (the web servers running the company's web site). This is a typical role for Traffic Managers - they are traditionally used as a reverse proxy.

Monday, July 21, 2014

How to make progressive images

Download - jpegtran from here - http://jpegclub.org/jpegtran/

Usage: jpegtran.exe [switches] inputfile outputfile
Example:  jpegtran -progressive -optimize -copy none slideImage2.jpg slideImage2_optimized.jpg

User experience example - Check the video on this url -
http://blog.patrickmeenan.com/2013/06/progressive-jpegs-ftw.html

Other urls -
http://www.yuiblog.com/blog/2008/12/05/imageopt-4/
http://blog.patrickmeenan.com/2013/06/progressive-jpegs-ftw.html
http://www.webhostinghero.com/improve-website-load-times-using-progressive-jpegs/

Monday, July 7, 2014

Learning from nestat

The netstat output looks something like -

Source IP: Source Port     Destination IP: Destination Port

I had an understanding that the source ports for any two such netstat entries cannot be same, Was proved wrong. The source port can be same,  just that combination of 4 should be unique between two such entries.

i.e. this is possible

10.10.XX.XXX: 50493     10.10.40.XX:8009
10.10.XX.XXX: 50493     10.10.40.X:8009