20 years of photoshop

Photoshop 1.0 was release 20 years ago!

You will find here a good (and lengthy) piece about how version 1.0 was created in a garage (well not in a garage per se but you know what I mean) by two brothers: Thomas and John Knoll . There is also a screenshot of every version up to CS4 as well as a recent video interview of one of the creators.

dstat for Linux: an alternative to sar/vmstat/iostst/etc.:

Written in python, dstat is a neat piece of tooling. It is a monitoring tool akin to sar, iostat, vmstat, etc. It allows you to measure a host of metrics. You can install it on any modern ubuntu box by typing “apt-get install dstat” (and I am sure it is available for any major distro).

By just typing dstat, you’ll get this (refreshed every second):

dstat1 output

There is quite some options:

Dstat options:
-c, --cpu              enable cpu stats
-C 0,3,total           include cpu0, cpu3 and total
-d, --disk             enable disk stats
-D total,hda           include hda and total
-g, --page             enable page stats
-i, --int              enable interrupt stats
-I 5,eth2              include int5 and interrupt used by eth2
-l, --load             enable load stats
-m, --mem              enable memory stats
-n, --net              enable network stats
-N eth1,total          include eth1 and total
-p, --proc             enable process stats
-s, --swap             enable swap stats
-S swap1,total         include swap1 and total
-t, --time             enable time/date output
-T, --epoch            enable time counter (seconds since epoch)
-y, --sys              enable system stats
--ipc                  enable ipc stats
--lock                 enable lock stats
--raw                  enable raw stats
--tcp                  enable tcp stats
--udp                  enable udp stats
--unix                 enable unix stats
-M stat1,stat2         enable external stats
--mods stat1,stat2
-a, --all              equals -cdngy (default)
-f, --full             expand -C, -D, -I, -N and -S discovery lists
-v, --vmstat           equals -pmgdsc -D total
--integer              show integer values
--nocolor              disable colors (implies --noupdate)
--noheaders            disable repetitive headers
--noupdate             disable intermediate updates
--output file          write CSV output to file

For example, “dstat -mp” will show memory and process related metrics with a refresh rate of one second (the delay is tweakable):

dstat example 2

Last but not least, you can export the output to CSV.

What I find especially neat is that you can combine any metrics with any other metrics (a bit more difficult to do with sar for instance).

iStat Menus for OS X

This is a cool monitoring app for Mac OS X. It looks a bit over the top in terms of exhaustivity but we all like it don’t we. It is called iStat Menus and is donationware. It sits in the menu bar and will display ‘real time’ information related to the usage of CPU, memory, disk, etc. It will also show you the temperature sensor status as well as the various fan speeds. The cpu menu looks like this (I like that you can see the top 5 cpu hogs at a glance):

iStats cpu menu

It is quite configurable:

iStats preferences

Hopefully it will not be a resource hog itself, I will give it a go.

Performance Basics: Bottlenecks

Today’s computer systems are increasingly complex, made of components made by different suppliers themselves made of components made by different suppliers, etc. Even your cheapo laptop is made that way. The same applies whether we are talking about hardware or software (big software publishers license or “borrow” code from others).

All these components, again whether hardware or software, can have an impact on performance be it perceived (“my computer feels sluggish”) or measured (time it takes to perform a certain task). Often solving performance problems starts by identifying the one component that is having the biggest negative impact on performance, the so called “bottleneck”.

To take the simple example of a single computer (enterprise systems composed of a myriad of networked computers are much more complex), there is a number of basic components whose utilization must be measured in order to identify a bottleneck:

  • CPU
  • Disk (Storage)
  • Memory
  • Network

There is a lot of software offering to measure the utilization of these components, Operating Systems usually come up with basic tools to monitor real time performance: sar/iostat/vmstat, etc. on UNIX/Linux style systems, the Activity Monitor on Mac OS, the Windows Task Manager or Resource Monitor on Windows (depending on the version).

Let’s say you are converting a video file from one format to another which is something that is becoming increasingly common. I am showing here what the iostat command measures on my Mac while iMovie is finishing the export of a video:

iostat measurement while iMovie is converting a movie

iostat measurement while iMovie is converting a movie

What is important here is the “cpu” column and the “id” subcolumn. It shows the idle time as in the time that the cpu (or rather the combination of the two cores on my particular machine) does not spend working. You can see that while iMovie is converting, it is less than 20% and when iMovie stops, it goes up to about 70%. Meanwhile, the disks (first two columns) are not being used at all. This would indicate that the CPU might be the “bottleneck”. Of course you would have to use other tools such as the activity monitor to measure the memory usage, network occupancy and double check that indeed the CPU is the limiting factor i.e. the application is “cpu bound”.

In a more complex enterprise environment, you would use more or less the same method: measure as much as you can and identify the “hot spots”.

Once they are identified, you may (or may not) have a solution. The busy component might be a  bottleneck just because it has to work hard, this is the way it is: you might be able to upgrade it (or not if you are already using the latest and greatest). It could also be that the busy component is a bottleneck because the software is unnecessarily overusing it. In that case, the software might be optimized. The recent example of the audio driver problem on the mac pros is a primary example of a bug that put an uncalled strain on the CPU. It could also be that there is no solution: take the example of transmitting messages to Mars (the planet, not the chocolate bar), you will always hit a “hard limit” imposed by physics in terms of transmission times.

In conclusion, there is no definite recipe, it is fun detective work though!

Performance Basics: Latency, Throughput and Load

I am often surprised by the fact that sometimes even seasoned IT professionals get confused by the differences between latency, throughput (aka bandwidth) and load. Simply put, here are the differences:

  • latency is the time it takes for a single operation to complete. For a client accessing a website for instance, this means “the time it takes to load one page”. In the web world, latency will be more often called “response time”.
  • throughput is the number of operations a system can deliver per unit of time. To take the website example again, this means “how many pages can be served per second”
  • the load can be a bit of a fuzzy concept. Simply put it is about the relationship between the throughput and the latency. To take the webserver example again, this means: “How many pages per second can I deliver with each page being served under xxx milliseconds?”

To take a plumbing analogy, the latency is determined by the length of a pipe and the throughput is determined by the size of the same pipe.

Depending on the need of users, throughput might be more important than latency or vice versa:

  • In the case of online games, latency is often more important since clients are only transmitting small amounts of data (the position of the player).  The faster this small amount of data gets transmitted to the server the better: this can give you a competitive advantage. Let’s not forget that latency on a global planetary scale is dictated by distances as you will be limited by the speed of light and network equipments you have to go through, each adding a bit of latency: a transatlantic transfer of data, however small will take about 100ms. Interestingly enough, traders might face issues similar to online action gamers if the latency to reach a trading server is too high: they will have a competitive disadvantage.
  • In the case of video streaming, latency is not so much of an issue (it dictates how much you have to wait before the video starts) but throughput will determine the quality of the video (forget about HD content on a small pipe)

That is just a few examples but often, a given performance goal has to be defined in terms of latency and throughput as these are two very different things…

Next on the topic of Performance, we will be talking about bottlenecks.

The IBM Power 7 is Announced

The IBM Power 7 is finally announced and looks like quite an achievement. With up to 8 cores and 4 threads per core, each chip packs quite some processing power and an interesting close-to-the-chip L3 cache. They also run up to 4.1 GHz. There are no actual performance number yet apart from some websphere numbers. This will be interesting to watch…

A few interesting references: arstechnica and the register

Keyboard Issue: Playing Elite C64 on a Mac with the Cocoa Vice Emulator

Elite was THE space exploration game of the 80s and probably one of the best games ever written at the time. Ian Bell and David Braben, the two programmers who created it managed to fit thousands of worlds in the tiny RAMs of the computer of the time (the planet data were actually generated randomly).

There are many versions of elite and you can download a good few of them on Ian Bell‘s site. Being a former Commodore 64 aficionado, I would recommend, for the ultimate 8 bit experience, to grab a copy of elite C64 here. You can also grab a copy of the doc here thanks to Project C64. In order to run elite C64 on a Mac, I advise to use the Vice emulator from here. The cocoa version is well adapted to the Mac. Note that with the File -> Smart Attach Disk/Tape… menu entry, you can read the downloaded zip file directly. After some loading time (even this is emulated, you have to be patient) and pressing space bar a few times (don’t get put off by the garbled screen, it does work after some loading time) answer ‘N’ to “Loading new commander?”.  At this stage press space and F1 (Fn – F1 if your mac has the brightness control on the F1 by default) and you should be in outer space [if you are not, you need a stronger drink]:

C64 Elite Screen Shot

One thing is really problematic on the Mac though, it is the keyboard configuration as it quite differs from a C64 and a number of keys are rather “funnily” emulated. As you can see from the Project 64 documentation, there is a lot of functions associated to individual keys as it was often the case with games from that era.

Two of them are rather important if you want to succeed in docking into a space station (see below) and detailed in the documentation from project 64:

Note: these controls can only be used when the game is frozen

 Keyboard recentering toggle A
 Keyboard damping toggle     Run Stop

The question is: How do you freeze/unfreeze the game on a mac and where is Run/Stop?

Well it took me a while to find out but these are the keys on a US Keyboard equipped Macbook Pro:

  • Freezing is obtained by pressing backspace
  • Unfreezing is obtained by pressing Fn and the left arrow simultaneously (!)
  • Run/Stop is Esc (don’t press § while the game is frozen, it will bring you back to the beginning)

While the game is frozen you can press esc and or ‘a’ (lower case) to activate/deactivate the keyboard recentering/damping for the ship’s control (you will hear a little ‘blip’ when either of these options is activated/deactivated). The ‘damping’ is particularly useful as you can ‘block’ the rotation or the up/down movements of the ship on a given position without the cursor going back to the center. It is then relatively easy to get the same rotation speed as a given space station and align to the entrance. Anyway you can now experiment to see what is easiest for you…