Posted on Leave a comment

Benchmark Go vs Rust

NOTE This article is in progress and will be updated frequently.

Since it has become necessary that I have to deal with Go, my interest in Rust has also grown again. That’s why I set up a benchmark to test the performance of both languages with relation to web services.

First, I have given a very simple API which the two languages have to implement:

openapi: 3.0.2
  title: TODO
  version: 0.1.0

  - url: ''
    description: app

      name: state
      in: query
      required: true
        type: string
          - open
          - closed

      type: object
          type: integer
          type: string
          type: string
            - open
            - closed
      type: array
        $ref: '#/components/schemas/Task'

      description: get tasks by state
          $ref: '#/components/schemas/Tasks'
        - $ref: '#/components/parameters/state'
      description: add task
              $ref: '#/components/schemas/Task'
          $ref: '#/components/schemas/Task'

The second part is a lua script for wrk benchmarking tool:

id = 0
counter = 0

request = function()
    id = id + 1
    if counter > 10 then
        counter = 0
        path = "/tasks?state=open"
        wrk.method = "GET"
        counter = counter + 1
        path = "/tasks"
        wrk.method = "POST"
        wrk.body   = "{\"id\":" .. id .. ",\"content\":\"task\",\"state\":\"open\"}"
        wrk.headers["Content-Type"] = "application/json"

    return wrk.format(nil, path)

The last (and hardest) part was the implementation of the api in rust and go.

request count | benchmark duration51015202530405060
Posted on Leave a comment

Create an Arch Linux based Vagrant base box

Here is my simple tutorial to create an Arch Linux based Vagrant base box.


First, download the Arch Linux iso on this page.

Now, create a new virtual machine:

  • Click “New”
  • Name “Vagrant Arch Linux”
  • Set “Memory size” to 1024MB
  • Select “Create a virtual hard disk now”
  • Click “Create”
  • Set “File size” to 100GB
  • Click “Create”

After creating the virtual machine, change the settings:

  • Select the virtual machine and click “Settings”
  • Select “Storage”, select the “empty” under “Controller: IDE”
  • Click on the upper right corner on the DVD icon an select “Choose Virtual Optical Disk File…”
  • Select the downloaded Arch Linux iso and click “Open”
  • Click “OK”

Finally, you can run the virtual machine by clicking “Start”. You will prompted with several boot options, choose the first (or the second, if you have an x86 system).

For the installation, I’m using the following commands to create a real minimalistic Arch Linux installation:

# loadkezs de (y=z)
# loadkeys de-latin1

# nano /etc/pacman.d/mirrorlist
- copy any server entry to the first line
- ctrl+x (exit)
- y (confirm write)

# gdisk /dev/sda
  Command (? for help): n
  Partition number (1-128, default 1): ENTER
  First Sector [...]: ENTER
  Last Sector [...]: ENTER
  Current type is 'Linux filesystem'
  Hex code or GUID (L to show codes, Enter = 8300): ENTER
  Changed type of partition to 'Linux filesystem'
- w (write)
- y (confirm write)

# mkfs.ext4 /dev/sda1
# mount /dev/sda1 /mnt
# pacstrap /mnt base
# genfstab -p /mnt > /mnt/etc/fstab
# arch-chroot /mnt

# echo archlinux > /etc/hostname
# echo LANG=de_DE.UTF-8 > /etc/locale.conf
# echo LC_COLLATE=C >> /etc/locale.conf
# echo KEYMAP=de-latin1 > /etc/vconsole.conf

# ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime

# nano /etc/locale.gen
- uncomment:
  de_DE.UTF-8 UTF-8
  de_DE ISO-8859-1
  de_DE@euro ISO-8859-15
- ctrl+x (exit)
- y (confirm write)
# locale-gen

# nano /etc/pacman.conf
- uncomment:
  Include = /etc/pacman.d/mirrorlist
- ctrl+x (exit)
- y (confirm write)

# pacman -Sy gptfdisk syslinux xz sudo networkmanager openssh rsync nfs-utils ntp virtualbox-guest-utils-nox
- y (confirm)

# nano /etc/mkinitcpio.conf
- change:
  HOOKS="base udev autodetect ..."
- to:
  HOOKS="systemd autodetect ..."
- uncomment:
- uncomment and change:
- to:
- ctrl+x (exit)
- y (confirm write)

# mkinitcpio -p linux
# passwd
  Enter new UNIX password: vagrant
  Retype new UNIX password: vagrant
  passwd: password updated successfully

# nano /boot/syslinux/syslinux.cfg
- change:
  APPEND root=/dev/sda3 rw
- to:
  APPEND root=/dev/sda1 rw
- comment following labels:
  archfallback, hdt, reboot and poweroff
- ctrl+x (exit)
- y (confirm write)

# syslinux-install_update -iam

# nano /etc/sudoers
- uncomment:
- ctrl+x (exit)
- y (confirm write)

# nano /etc/ntp.conf
- change:
  server [0-3]
- to:
  server [0-3]
# ntpd -gq

# useradd -m -g users -s /bin/bash vagrant
# gpasswd -a vagrant wheel
# gpasswd -a vagrant vboxsf

# passwd vagrant
  Enter new UNIX password: vagrant
  Retype new UNIX password: vagrant
  passwd: password updated successfully

# systemctl enable sshd
# systemctl enable vboxservice
# systemctl enable rpcbind
# systemctl enable ntpd
# systemctl enable NetworkManager

# mkdir -p /home/vagrant/.ssh
# wget -L -o /home/vagrant/.ssh/authorized_keys
# chmod 0600 /home/vagrant/.ssh/authorized_keys
# chmod 0700 /home/vagrant/.ssh
# chown -R vagrant:users /home/vagrant

# exit
# umount -R /mnt
# systemctl reboot

- cleanup, login as root
# pacman -Scc --noconfirm
# rm -rf /var/log/journal/* /var/log/old/* /var/log/faillog /var/log/lastlog /var/log/pacman.log
# rm -f /home/vagrant/.bash_history
# rm -f /root/.bash_history
# cd /root
# dd if=/dev/zero of=zerofillfile bs=1M
# rm -f zerofillfile
# history -c

# systemctl poweroff

Now you can create and add a base box by the following command:

vagrant package --base "Vagrant Arch Linux"
vagrant box add "archlinux/base"


Posted on Leave a comment

Mastering Symfony 2 – Part 1 – Installation

I’ve switched to a new employer and so the used framework. So I’m writing about my experience with Symfony 2.

So first, ensure you have a current version of composer, if not, download it:

curl -sS | php

Now, you can use composer to create a new Symfony 2 based project:

./composer.phar create-project symfony/framework-standard-edition sf2-project '~2'

It will load the latest stable version since the syntax of ~2 is the same like >= 2.0, < 3.0.  You can check here for the release notes. After the download process you will be polled for some decisions:

Would you like to install Acme demo bundle? [y/N]

The Acme demo bundle  will install some classes to demonstrate some features of Symfony 2. It’s up to you to install this bundle. I will not use this bundle in future posts, but it’s maybe helpful to you.

All other decisions you can leave unattended as we will change them later:

database_driver (pdo_mysql): 
database_host (          
database_port (null): 
database_name (symfony): 
database_user (root): 
database_password (null): 
mailer_transport (smtp): 
mailer_host ( 
mailer_user (null): 
mailer_password (null): 
locale (en): 
secret (ThisTokenIsNotSoSecretChangeIt): 

Finally you did it, you installed Symfony 2 successfully….

Posted on Leave a comment

Install Vagrant on Arch Linux

For development, Vagrant is the best way to provide a development environment. On Arch Linux some preconditions are needed to be satisfied.



First, you have to install VirtualBox and the host modules

sudo pacman -Sy virtualbox virtualbox-host-modules net-tools

If you use an custom kernel, you should use virtualbox-host-dkms instead. You can find more information in the official wiki.

Now the VirtualBox kernel modules have to be loaded. For auto loading on every start create the following file:



Also, you have load these modules with modprobe MODULNAME .


Many Vagrant boxes are configured to use NFS for sharing the data between host and guest system.  It’s a lot faster than the shared folder from VirtualBox. So install the following packages:

sudo pacman -Sy nfs-utils

After that, you have to edit some files. First set the Domain  in (i’ve choosed lan):



Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = lan


Nobody-User = nobody
Nobody-Group = nobody


Method = nsswitch

If you have a firewall, you have to set static ports, even if not it’s recommended. Modify the following files and add/modify options:


STATD_OPTS="-p 32765 -o 32766 -T 32803"



MOUNTD_OPTS="-p 20048"

Enable and start rpcbind

sudo systemctl enable rpcbind
sudo systemctl restart rpcbind

Finally we have to start the services

sudo systemctl restart nfs-config
sudo systemctl restart rpc-statd
sudo systemctl restart nfs-server

(If you get some errors… try to restart the whole system)


Another option getting popular is rsync. Simply install it via:

sudo pacman -Sy rsync



Now we can install Vagrant:

sudo pacman -Sy vagrant


Posted on 7 Comments

Install Redis on Arch Linux

redis logo

Installing a Redis server is really simple on Arch. First, you have to install the package via package manager

sudo pacman -Sy redis

The package comes without an systemd service so you have to create one for your own. Create a new file

sudo nano /etc/systemd/system/redis.service

and add the following content

Description=Redis Server

ExecStart=/usr/bin/redis-server /etc/redis.conf
ExecStop=/bin/kill -15 $MAINPID


Now you’re able to enable and run the Redis server with

sudo systemctl daemon-reload
sudo systemctl enable redis.service
sudo systemctl start redis.service

Really simple, isn’t it?