February 2008 Archives

Tired of having large fsync() times and bad performance when accessing many files in a random i/o manner on big volumes? Do you notice strong latencies where the system seems to be stalled?

Sun published a zfs patch for Solaris 10 SPARC and x86 yesterday. It addresses the fsync() issue which caused me some troubles.

Using filebench varmail, fsync() went down from 1500 ms to 20 ms. The related Sun bug id is 6535160, it was already fixed in Nevada releases and in OpenSolaris. Now you have it for Solaris 10 production systems.

As a side note: There is also a kernel update, 127112-10, which addresses security issues.

The patches will require a reboot.

Fun with DTrace and ZFS mirrors (Solaris 10)

| | Comments (3) | TrackBacks (2)

[Update Apr 11th, 2009:]

All ZFS movies on this site:

ZFS as a movie actor
ZFS scrub

and my Youtube Playlist:


and my Channel:


As a little DTrace exercise, I wanted to show how often disk blocks are read and written on a ZFS volume. More, it should be possible to watch zfs' write mechanism (more or less sequential on forthcoming unused blocks).

To begin, I started with a DTrace script like this:

#!/usr/sbin/dtrace -s

#pragma D option quiet

  printf("%i,%i,%i,%i,%i\n",(timestamp/1000000),args[1]->dev_minor,args[0]->b_lblkno,args[0]->b_flags & B_WRITE,args[0]->b_bcount);

This resulted in a file beginning like that:


[.... continued ...]

The columns mean: Timestamp (in milliseconds), minor device node of device, logical block number, read/write (read=0,write=256), number of bytes read or written starting from the given logical block.

This data file was then processed with a nifty perl script (using GD and the libgd graphics library), displaying each pixel as a block range of the device. Each read requests makes the dot greener, each write makes the underlying dot more red. For 10 seconds of data, I made a frame - at the end I had an animated gif which is funny to watch. You see growing "red" areas (write) and more or less random read i/o. And: You see the spool area, where files are written and read afterwards (the middle of the picture) - this is the heavy loaded postfix spool queue.
The left side of the graphic shows device 448, the right side device 512. Both are the two parts of a zpool mirror - hence the rather identical access patterns.

View animated gif but be warned: The file is 5 MB in size and it depends on your browser whether it can handle such large animated gifs - or not.

Georgia on my mind - Asterisk plays music!

| | TrackBacks (0)
While surfing on wikipedia, I found a nice article about the georgia anthem "Georgia on my mind". There is also an OGG file included of the Georgia chorus sung by the Air National Guard Band of the Southwest.

As I will use this file as a fine example and in fact it is licensed with a Creative Commons License, Attribution 2.5. I state: "This was performed as an exhibition by the Air National Guard Band of the Southwest, at the Moorpark College Jazz Festival on May 12, 2007. The vocals are sung by a woman."

For the fastest: Dial 1-678-954-8235 and you'll hear that chorus.

Back to Asterisk.
As I like the state of Georgia I tried to put that chorus on my asterisk server so I could ring it to hear it (ok I won't do it too often but I wanted to have some kind of reason to tell my fiancée that I am sitting again in front of that terminal...).

In the United States, digital voice communications in telephone systems are normally done with the ulaw format using 8000 samples per seconds, 8-bit wide each. It includes a dynamic compression, originally each sample is 16 bits wide. The ulaw algorithm makes a 8 bit sample out of it. Sampling accuracy is high at nearly silent tones and mediocre for louder sounds.
In Europe a similar technique is used, but we call it alaw here, in fact it does the same, it compresses 16 bits to 8. It is very simple to convert ulaw digital data to alaw and vice versa, just use a 255-value-table of compound alaw/ulaw sample pairs.

The first thing to do is to convert the ogg sound file to ulaw (and alaw). I'll use the swiss army knife of sound converters, sox.

sox ANGB_Georgia.ogg -r 8000 -U -c 1 -t raw georgia.ulaw resample -ql


sox ANGB_Georgia.ogg -r 8000 -A -c 1 -t raw georgia.alaw resample -ql

The "-c 1" downmixes the stereo output samples of the ogg file to mono (stereo on a phone system wouldn't really not make any sense), "-r 8000" tells sox to create a 8000 samples/sec output file. "-U" is the selector for ulaw, "-A" for alaw.

After copying these files to /var/lib/asterisk/sounds/pascal, I have been able to define this:

exten => 16789548235,1,Answer(1000)
exten => 16789548235,n,Playback(pascal/georgia)
exten => 16789548235,n,Hangup

So whenever a call comes in to 1-678-954-8235, you will hear the chorus, as Asterisk answers the phone first, then plays back the file and then hang up the line.

As you can see, Playback uses files relative to /var/lib/asterisk/sounds, (if you installed Asterisk in its standard locations). The file extension ".ulaw" is added automatically. Asterisk uses the ulaw file because it is an american phone line.

To have a usage for my alaw file, I just put it on one of my numbers of my ISDN line in Germany, using alaw. In that asterisk box, I had to define that:

exten => 3614219,1,Answer(1000)
exten => 3614219,n,Playback(pascal/georgia)
exten => 3614219,n,Hangup

Not really exciting, is it? The sole difference between the above US example and this one is the fact it will use the alaw file - German ISDN's voice transmissions are in alaw format.

So for the next days, you will be able to hear that chorus on

1-678-954-8235  (USA) and
(011)-49-7531-3614219   (German ISDN)

Enjoy :)

After upgrading our Ironport Appliances to version 5.1.2 (as intermediate to be able to continue to 5.5.1), we noticed this tiny configuration setting "Regional Scanning" - which offers only the region "China".

Is this the beginning of Ironport boxes segregating the whole world into regions with different censorship needs?

EDIT: A writer from Heise Online asked Ironport INC about this measure and they said it is because they need different spam detection algorithms to reliably separate chinese spam from chinese ham (good mails). I was a little bit too paranoid this time.

Another era is over... Polaroid Instant Photography!

| | TrackBacks (0)
As Heise Online states, the days of Polaroid instant photography will be over soon.

501px-Polaroid_SX-70.jpgIt's all over now, baby blue... At least in my brain. After having read that Heise article, immediately I began thinking of my childhood, where I had such a camera and I almost never had a film pack for it, they were far too expensive.

But when you had one... Those bad pictures of parents just coming out of their bedroom (the kind of psycho terror of flashing them at 6am) and this chemical smell which was in the air when you saw the picture developping itself...

And a smile comes on my face, thinking about these "new" instant photographiers, connecting their little photo printer on their camera and working with bad software and many cables...

But wait... You still have an alternative... Fuji INSTAX! Without the polaroid feeling of course....

(Image source: Wikipedia).

ZFS vs Hardware Arrays

| | TrackBacks (0)
Starting with these devices  (MPxIO)

       1. c6t600D0230006B66680C50AB7821F0E900d0 <ADVUNI-OXYGENRAID 416F4-347B-3.41TB>
       2. c6t600D0230006C1C4C0C50BE5BC9D49100d0 <ADVUNI-OXYGENRAID 416F4-347B-3.41TB>

I wanted to create a mirrored zpool for great data security as these two devices are located in seperate floors and rooms of the building.

Easy enough, I decided to do the simple (naive?) approach:

zpool create myvolume mirror c6t600D0230006B66680C50AB7821F0E900d0 c6t600D0230006C1C4C0C50BE5BC9D49100d0

After some copying many files on /myvolume all looked perfect:

# zpool list
NAME                    SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT
myvolume               3.41T    735G   2.69T    21%  ONLINE     -

Looking at my devices I noticed that every 5 seconds (or so), the device stops accepting data and all drives lights are running mad for 2 seconds. Looking at the management console of these devices I saw that the whole internal RAM write buffer is written out in these intervals. Absolute performance cutter.

It seems that ZFS is perfect for hard drives which have the integriety and reliability of a politician, so it flushes very often. My RAID devices obey to these flush commands, and there is no possibility to set them to ignore these requests.

Just use this in /etc/system:

set zfs:zfs_nocacheflush=1

and reboot.

Transfer rates to these devices have have quadrupled since this. The setting is not critical for me, as my devices do have battery buffered RAM caches and they turn write caching immediately off if there is a problem with batteries.

The headline picture...

| | TrackBacks (0)

was taken at Five Points Station in Atlanta, GA in October 2005. Every advertisement frame was rent by Apple promoting the iPod then.

It was strange to see as a european that many americans don't seem to like the MARTA system and some of them even didn't want to have their suburb areas to be connected by MARTA - as this would spread criminality to their homes. I used MARTA for 3 weeks, at day, at night and did not have any problems.

Fares are extremely low compared to german commuter systems.

Solaris 10 with MPxIO (scsi_vhci.conf)...

| | Comments (13) | TrackBacks (0)
[Update September 24th, 2009: With OpenSolaris the format of the config file has changed: Here's an update.]

With two RAID devices in different locations onsite you may want to use a ZFS mirror to access them - as well as Sun MPxIO to have redundant links to them.

The relevant configuration is /kernel/drv/scsi_vhci.conf as scsi_vhci is the MPxIO driver for redundant scsi/fc links.

Yes Solaris 10 is quite good but this configuration is like telling your grandma to disguise herself as a man to be able to use trousers:

Using Sun Arrays all works without any problem. The latter do arise when you want to use other devices (non-Sun), which is not really an uncommon practice...

You have to tell scsi_vhci to ACCEPT your device based on the vendor- und product-id which it tells you at SCSI inquiry stage.

In my case, I had to add this to scsi_vhci.conf:

device-type-scsi-options-list =
"ADVUNI  OXYGENRAID", "symmetric-option";

symmetric-option = 0x1000000;

You see the grandma's trousers?

These lines tell the driver that whenever it encounters a "ADVUNI OXYGENRAID" device it should use the value "0x1000000" as an option - which stands for "behaves like a sun fc array and is able to handle redundant links" (I think Sun believes that only Sun devices can do that...).

You notice the TWO SPACES between Vendor and Product-ID? They are part of the game. The scsi_vhci driver expects the vendor and product id as 8 character-words each. You have to fill up with spaces. ADVUNI has only 6 characters, so you have to use two spaces. If your SCSI vendor id has 8 chars, just don't use any space! Otherwise the driver just ignores your devices. Without a warning or error, of course.

To find out SCSI Vendor and Product-ID,just use format(1), select one of the instances of your device (each link to your device shows up as a different entry):

format> inquiry
Vendor:   ADVUNI 
Product:  OXYGENRAID 416F4
Revision: 347B

Only use the first part of "Product:", until the first space!

After doing a reboot -- -r

it should work:

# format
Searching for disks...done

       0. c3t0d0 <DEFAULT cyl 8872 alt 2 hd 255 sec 63>
       1. c6t600D0230006B66680C50AB7821F0E900d0 <ADVUNI-OXYGENRAID 416F4-347B-3.41TB>
       2. c6t600D0230006C1C4C0C50BE5BC9D49100d0 <ADVUNI-OXYGENRAID 416F4-347B-3.41TB>

My two different(!) hardware devices are using a new virtual controller (c6) to access the multiple links (each c6 device has 4 redundant links to it, without scsi_vhci you would see all these links as different disk instances).

[Update Apr 19th, 2008:] You may check the multiple paths handled by scsi_vhci by using vhci_stat.

Now I found performance was abysmal. I smiled too early. It just would have been too easy until now.

The solution is a technique called "logical block" round-robin.
First round-robin should speed up things as all fiberchannel links are used and after a failing link recovery is faster as you don't have to transfer all outstanding operations to the next functioning link. But it did not work well.

I found that each of the controllers of these raid devices do have their own RAM cache which won't be used efficiently when every subsequent 512-byte-block request is done by the next controller... And yes, scsi_vhci has a solution for this, if you have much luck. This option came in with a patch or by installing at least Solaris 10 8/07.  Otherwise it just won't recognize the option:

device-type-mpxio-options-list =
"device-type=ADVUNI  OXYGENRAID", "load-balance-options=logical-block-options";
logical-block-options="load-balance=logical-block", "region-size=20";

Complicated? This line tells scsi_vhci to override some default options for device type "ADVUNI  OXYGENRAID" (also with 2 spaces, see above!).

What's logical-block round-robin? You define a block size to summarize requests in this block size range to be served by ONE link. region-size=20 means 2^20 bytes = 1 MB. With this "trick" the onboard controller caches do their thing of prefetching and caching right.

In case you did not know it, you can define outgoing MSNs in asterisk and misdn (Linux). It is even possible to tie a specific local telephone to another outbound channel:

exten => _X.,1,Set(OUTBOUNDMETHOD="mISDN/1/${EXTEN}");
exten => _X.,n,ExecIf($[ "${CALLERID(num)}" = "*1"],Set,CALLERID(num)=3614217)
exten => _X.,n,ExecIf($[ "${CALLERID(num)}" = "*2"],Set,CALLERID(num)=3614218)
exten => _X.,n,ExecIf($[ "${CALLERID(num)}" = "*6"],Set,
exten => _X.,n,Dial(${OUTBOUNDMETHOD})

In this case, the local phones *1 and *2 will send 3614217 or 3614218 respectively as local number on outgoing calls. *6 will allways use the sip provider defined as "sipPASCAL" in sip.conf.

Since many isdn providers list charges by msn in their invoices this is neat.

*1 and *6 are lines defined on my Cisco 7960 phone at my desk so I may choose myself which line I will use for callout.
my_7960.jpgFinally I got my Skinny Cisco 7960 phone working with my Asterisk server at home.

I am using chan-sccp-b, and I built it:

sassandra:/home/pascal/chan_sccp-20071213 $ make
sh ./create_config.sh "/usr/include"
Now compiling .... chan_sccp.c          1855 lines
Now compiling .... sccp_actions.c       1643 lines
Now compiling .... sccp_channel.c       1155 lines
Now compiling .... sccp_device.c        927 lines
Now compiling .... sccp_line.c          117 lines
Now compiling .... sccp_utils.c         1703 lines
Now compiling .... sccp_pbx.c           1004 lines
Now compiling .... sccp_cli.c           819 lines
Now compiling .... sccp_softkeys.c      558 lines
Now compiling .... sccp_socket.c        394 lines
Now compiling .... sccp_indicate.c      329 lines
Linking chan_sccp.so

The resulting .so-File has to be copied in the asterisk modules directory (/usr/lib/asterisk/modules if you have installed asterisk in standard locations).

Insert these lines in your modules.conf (/etc/asterisk/modules.conf):

noload => chan_skinny.so
load => chan_sccp.so

A sample sccp.conf:

keepalive = 30              
context = default
dateFormat = D.M.Y            ; date format         
bindaddr =            ; interface to bind to
port = 2000                   ; port to bind to (2000 = skinny)
debug = 4
accountcode=skinny            ; recordname appearing in cdr
callwaiting_tone = 0x2d       ; turn off callwaiting tone == 0
echocancel = on
silencesuppression = off
cfwdall = on                  ; turn on call forward button
cfwdbusy = on                 ; turn on call forward when busy button
dnd = on                      ; turn on "do not disturb"
mwioncall = on                ; lit message waiting light when new messages are
                              ; in voicemailbox
digittimeoutchat = #          ; type hash to stop dialing timeout
disallow = all
allow = alaw
allow = ulaw                  ; european isdn is alaw, so i use alaw as first preference

type        = 7960            ; my phone is a 7960
description = Pascal          ; name appearing in the upper right
tzoffset    = 0
autologin   = *1,*6           ; we have exten *1 and *6
speeddial   = 1234567890,Important Number 1
speeddial   = 0987654321,Important Number 2
speeddial   = 0015552522631,Fake Number
speeddial   = 0310,Test
device => SEP000CCE3A88CA     ; This is the device Name (SEP+Mac)

id            = *1            ; Extension
label         = 3614217       ; label on line button
description   = Pascal       
context       = default       ; incoming call context
callwaiting   = 1
incominglimit = 3             ; max 3 incoming calls
mailbox       = 1@default     ; corresponding voicemail box
vmnum         = *9            ; extension to dial to access VoiceMailMain()
cid_name      = Pascal Gienger
cid_num       = *1
line => *1

id            = *6
label         = 584298
description   = Pascal
context       = default
callwaiting   = 1
incominglimit = 3
cid_name      = Pascal Gienger
cid_num       = *6
line => *6

Extensions *1 and *6 are listed as line buttons on my 7960 screen, the second arguments of the speeddial-Commands are Strings which are displayed on the 7960's screen. If you omit them, the numbers will be shown.

In your dhcp server setting for the phone, don't forget to define option 150 (I am using ISC dhcp):

option cisco-tftp code 150 = array of ip-address;

subnet netmask {
        default-lease-time 86400;
        max-lease-time 172800;
        option domain-name-servers;
        option routers;

Then you may define the phone entry:

host phone1 {
        hardware ethernet 00:0c:ce:3a:88:ca;
        option cisco-tftp;

In my configuration on the asterisk host ( a tftp server is running and there the phone should at least find 1 file:

  • SEPxxxxxxxxxxxx.cnf.xml (xxxxxxxxxxxx = MAC of your phone, uppercase!)
You do NOT need an "XMLDefaults.cnf.xml"-File unless you want to include also unknown devices (without a proper SEPxxxx-File)!

My SEP-file has the name SEP000CCE3A88CA.cnf.xml and looks like this:

    <member  priority="0">
 <versionStamp>{Jan 28 2008 19:01:00}</versionStamp>

The most important part are the lines




as they define the address and port of your Asterisk server!
I wanted my phone to display all messages in french but my dialtone like in the united kingdom (i like that sound). I copied the needed messages from a cisco call manager to my tftp server. Due to copyright issues I can't post them here.

To make your phone reload any changes you made in this file you have to set up

 <versionStamp>{Jan 28 2008 19:01:00}</versionStamp>

as the phone compares this date to know that you want the configuration to be updated.

Even if your phone does not find  these files, it will still work - using the locale ist loaded the last time successfully - on new phones this will be English/United States.

After these steps the 7960 works in my asterisk environments. I can call out on ISDN and SIP lines and still have an SCCP (Skinny) phone on the desk.

The Dial() device parameter in extensions.conf  is "SCCP", so you may write:

exten => *1,Dial(SCCP/*1)


exten => 3614217,Dial(SCCP/*1)

to map an external ISDN number (in my case) to the local line *1 on the Cisco phone.

Up and running

| | Comments (1) | TrackBacks (0)
As every thing has to be started before it can grow here is my start. Enjoy!

December 2015

Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    


This blog is owned by:

Pascal Gienger
Jägerstrasse 77
8406 Winterthur

Google+: Profile
YouTube Channel: pascalgienger