Computer Laboratory

Scratchpad

A collection of disorganised copypasta.

PostgreSQL Bulk Load

Shared memory buffers should be extended to occupy about 10% of RAM capacity. Note that on larger systems, this may exceed the shared memory limit imposed by the kernel. This can be overridden using sysctl.

The write-ahead log will flush relatively quickly under default conditions. This can be increased according to RAM capacity. Also by default, the DB will fsync after every write transaction. This can be disabled during a bulk load.

CPU cache performance measurement

Links:

Show cache layout

 grep . /sys/devices/system/cpu/cpu0/cache/index*/*

Measure latency and bandwidth of accessing up to 256MB of memory:

 taskset 0x1 ./lat_mem_rd -N 1 -P 1 256M 512
 ./bw_mem –N 10 –P 4 16K rd   # L1  }
 ./bw_mem –N 10 –P 4 1536K rd # L2  } figures depend on cache capacities
 ./bw_mem –N 10 –P 4 256M rd  # RAM }

CL Sysadmin links

Linux software RAID on Ubuntu 10.04

List current LVM physical to group mappings.

 sudo pvdisplay

Show mappings between MD arrays and physical partitions.

 sudo mdadm --detail /dev/md? | grep dev

Create a RAID 0 array using /dev/sda8 and /dev/sdb8, with 4k chunks.

 sudo mdadm --create /dev/md8 --level=0 --raid-devices=2 /dev/sd[ab]8

Persist the array config between reboots

 sudo mdadm --misc --scan --examine

(Copy the UUID of the newly created array)

 sudo vim /etc/mdadm/mdadm.conf
 ARRAY /dev/md8 UUID=<paste>
 :wq
 sudo update-initramfs -u

Optionally update /etc/fstab to automount the new array