Thursday, August 20, 2015

Why is Messaging considered superior to Shared DB? Messaging vs Shared DB?(102/285 tech notesfor 2015)

DB is good solution for a low traffic application:
If you are building a simple application with low traffic, there is
something to be said about keeping another component out of your system. It
is very likely not using a message bus is the right answer for you.

However, I would suggest building your system in a way you could swap out
the database based queue system for middleware solution. I agree with the
article. A database is not the right tool for queue based system, but it
may be good enough for you.

Advantages of Queue based systems:
Queue based system like RabbitMq are built around massive scale on moderate
hardware. Their architecture is able to achieve this by avoiding processes
which make ACID compliant database system slow by their nature. Since a

Message bus -
only needs to ensure a message is stored and successfully processed,
it doesn’t need to bother with locking and writing transaction logs.

Both of these concepts are absolutely required for an ACID system but are
often a cause of contention.

Issue with DB:
Performance wise it comes down to, you have a SQL table. Lots of reads and
lots of writes. Both require some sort of locking to update rows, pages and
indexes. Your polling mechanisms is constantly locking an index to do look
ups on it. This prevents writes from happening, at best they are queued.
The code doing the processing is also locking to update the status on the
queue as they complete or fail. Yes, you can do query optimization after
optimization to get this to work, or you can use a system specifically
designed for the work load you are asking.

A RabbitMq eats up this type of workload without even breaking a sweat.
On top of that you get to save your database from the workload giving it
more room to scale doing other things.

Polling:
Another thing to consider is most queue system typically do not use a
polling technique (some allow for HTTP, but recommend to avoid using for
the receive side). RabbitMq uses network protocols specifically designed
for message buses such as AMPQ.

References:

http://mikehadlow.blogspot.fr/2012/04/database-as-queue-anti-pattern.html
brianfeucht in stackoverflow -
http://programmers.stackexchange.com/questions/231410/why-database-as-queue-so-bad

Why is Messaging considered superior to Shared DB (102/285 technotes for 2015)

DB is good solution for a low traffic application:
If you are building a simple application with low traffic, there is something to be said about keeping another component out of your system. It is very likely not using a message bus is the right answer for you. 

Friday, August 14, 2015

How To Set Up GUI On Amazon EC2 Ubuntu server?(101/285 technotes for 2015).

This was published in http://bit.ly/1LaP9tT. Based on the comments and minor changes (maked in bold) the below worked for me.

-------------------------------

This can be done. Following are the steps to setup the GUI

* Create new user with password login

How To Set Up GUI On Amazon EC2 Ubuntu server?(101/285 technotes for 2015).

This was published in http://bit.ly/1LaP9tT. Based on the comments and minor changes (maked in bold) the below worked for me.


This can be done. Following are the steps to setup the GUI

* Create new user with password login

sudo useradd -m awsgui
sudo passwd awsgui
sudo usermod -aG admin awsgui
su - awsgui

sudo vim /etc/ssh/sshd_config # edit line "PasswordAuthentication" to yes

sudo /etc/init.d/ssh restart

* Setting up ui based ubuntu machine on AWS.

* In security group open port 5901. Then ssh to the server instance. Run following commands to install ui and vnc server:

sudo apt-get update
sudo apt-get install ubuntu-desktop
sudo apt-get install vnc4server

* Then run following commands and enter the login password for vnc connection:

vncserver

vncserver -kill :1

vim awsgui/.vnc/xstartup

* replace the text with the text below (make sure u have a copy)

#!/bin/sh
def
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &

* When you’re done, hit Ctrl + C on the keyboard, type :wq and hit Enter.

* Restart the server

* Then start vnc server again.

vncserver

In the vnc client, give public DNS plus “:1” (e.g. www.example.com:1) or private ip address. Enter the vnc login password. Make sure to use a normal connection. Don’t use the key files.

Thursday, August 6, 2015

ParseMFCFile.java (101/285 technotes for 2015)

The sample output shows that the MFC file had 2 operations and the various types of artificats used and the number of times they were used.

name=“callAddressValidation”
Req:{Trace=5, Input=1, XSLTransformation=3, BOMapper=3, Stop=3, InputFault=1, ServiceInvoke=3, InputResponse=1, CustomMediation=5}
Err:{Trace=1, XSLTransformation=1, BOMapper=1, Stop=1, InputFault=1, ServiceInvoke=1, ErrorInput=1, InputResponse=1, CustomMediation=1}
name=“findStateCountyCity”
Req:{Trace=3, Input=1, BOMapper=2, XSLTransformation=2, Stop=1, InputFault=1, ServiceInvoke=1, Callout=1, InputResponse=1, CustomMediation=4}
Res:{InputFault=1, InputResponse=1}
Err:{Trace=1, XSLTransformation=1, BOMapper=1, Stop=1, InputFault=1, ServiceInvoke=1, ErrorInput=1, InputResponse=1, CustomMediation=1}

ParseMFCFile.java (101/285 technotes for 2015)