Wednesday, August 13, 2014

C++ GExecutor 1.1 version is released!

Asynchronous and Synchronous together!

https://github.com/cppexecutor/gexecutor

Finally completed framework that solves pressing problems in many high transactions applications in real world scenarios.

I love asynchronous architectures and applications. But, every now and then there is a requirement to make synchronous API calls like third party API, or do a database call for configuration information that is synchronous. 

GExecutor provides a unified way to handle synchronous and asynchronous tasks by abstracting them from underlying thread and process architecture. It is a C++ library which offers similar capabilities like Executor framework in Java and Twisted in Python.

One of the well studied patterns for implementing a High performance I/O bound applications is to use asynchronous processing of client requests. Multiple client requests can be served without the cost of context switching thus achieving better performance at lower CPU and memory requirements. Such a design pattern is also referred as reactor pattern. Libraries like libevent or boost::asio make it easy to implement reactor patterns built on lower level APIs like kqueue, epoll, select etc.

Multi-threaded or multi-process performance can outperform a single threaded systems by using concurrent data structures or shared memory in spite of added context switches and locking overheads in a reactor pattern. However, such systems may not perform well due to bad locking design (coarse), deadlocks, and complex data structures based on shared memory. More details on this discussion can be found at C10K Problem.

GExecutor offers a hybrid solution to take advantage of both paradigms and make it simple to use appropriate pattern for different aspects of application without loss of performance. It is a hybrid event loop based task processing framework which handles and routes tasks between async event loops and worker threads for processing synchronous tasks. It is designed as a utility that can be layered on top of libevent or asio.

Existing applications can continue to use their current bindings to native interfaces and just use GExecutor for deferred task processing.

cheers!









Friday, August 23, 2013

Linux Kernel Upgrade / Downgrade in Ubuntu

Sometimes you may want to change the kernel running.

Get list of installed kernel in the system:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'

linux-headers-3.5.0-17
linux-headers-3.5.0-17-generic
linux-headers-3.5.0-27
linux-headers-3.5.0-27-generic
linux-headers-3.5.0-28
linux-headers-3.5.0-28-generic
linux-headers-3.5.0-39
linux-headers-3.5.0-39-generic
linux-image-3.5.0-17-generic
linux-image-3.5.0-27-generic
linux-image-3.5.0-28-generic
linux-image-3.5.0-39-generic
linux-image-extra-3.5.0-17-generic
linux-image-extra-3.5.0-27-generic
linux-image-extra-3.5.0-28-generic
linux-image-extra-3.5.0-39-generic

Install version of headers and kernel image
apt-cache search linux-image
Eg. just install the 3.5.0-39 version of kernel
sudo apt-get install linux-image-3.5.0-39-generic

Install 3.5.0-32 version of kernel
sudo apt-get install linux-image-extra-3.5.0-32-generic linux-image-3.5.0-32-generic linux-headers-3.5.0-32-generic linux-headers-3.5.0-34

Update grub to default into the version you just installed.

gksudo gedit /etc/default/grub

Reboot

References
http://askubuntu.com/questions/233380/how-do-i-downgrade-kernel-on-12-10

Saturday, May 25, 2013

Helpful Ubuntu and Linux Admin Utilities

SSH with no password


Simple Steps
1. On Client (Mac or Linux): create keys
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
2. Copy only Public Key to the Server or remote host

ssh-copy-id <username>@<host>
If ssh-copy-id not found then do this on the server
cp authorized_keys authorized_keys_Backup
cat id_rsa.pub >> authorized_keys

Software

sudo apt-get install openssh-server
sudo apt-get install openssh-client

Copy files from one machine or folder to another


sudo rsync -azvv /home/path/folder1/ /home/path/folder2

Software

sudo apt-get install rsync


Sunday, June 24, 2012

Read / Write Samba mount using fstab in Ubuntu 12.04


Tried to configure /etc/fstab to mount to the samba share but it always does it in read only mode.

/etc/fstab entry:
//192.x.x.x/public /media/backup cifs rw,user=guest 0 0
The local mount /media/backup remains a readonly. There are couple of issues.
1. It does not tell fstab to use rw
2. when the mount happens it does get mapped to local user that you want rw access as

Remedy:
Provide local user name, uid, gid for proper rw access. 

//192.x.x.x/public    /media/backup    cifs rw,_netdev,user=guest,uid=1000,gid=1000    0    0

The _netdev delays the mount till the network is up during startup.

Just installed the newest Ubuntu 13.04. It is cool, it is fast and I love it. Except, for usual hiccups. My last 10.04 was so stable I forgot how I got it to that configuration :)

Best reference on this so far:
https://wiki.ubuntu.com/MountWindowsSharesPermanently

Sunday, June 10, 2012

Android SDK installation on 64-bit Ubuntu needs ia32-libs

Android SDK still uses 32-bit based toolchain. The installation of the packages would fail if the 64-bit linux / 12.04 is not configured for 32-bit system.

You may hit error during Eclipse Installation as "platform-tools/adb libstdc++.so.6 not found"

Here are the steps

1. A good package to install before doing any development in linux as https://help.ubuntu.com/community/CompilingEasyHowTo

sudo apt-get install build-essential

If you already have figured out need for gcc and g++ then ignore this.

2. Install 32-bit standard libraries

sudo apt-get install ia32-libs

Since, it is a 64-bit system so you cannot run any 32-bit programs as standard libraries are not found. However, you can still cross-compile a 32-bit toolchain which uses 32-bit version of standard libraries that can work with 64-bit base kernel. These standard libraries are provided as ia32-libs package.

This package would also allow one to use any other 32-bit programs on this system.