"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

December 30, 2011

NuoDB Conflict Management

Continuing previous post on NuoDB, December there was another technical session on NuoDB. I had few questions on conflict management as well. I have captured my understanding in below notes.
 
Does Readers block writers ?
Every new update is stored as new version. There are no updates to existing records. This way reads do not block writes.
 
Write / Write Conflicts ?
Only after recent Write operation is completed, the next write operation would be performed
 
How long does these versions exist in memory ?
Thanks to Jim for commenting on post. He has provided the answer
NuoDB has a garbage collector that runs around deleting inaccessible record versions

  • Bottleneck of Current OLTP Databases - Lock management, this is synchronous, related queries would be blocked until Data is committed, Managing the Table structures on the Disc along with supporting ACID compliance. Again this depends on so many factors isolation levels, locks set.
  • NuoDB - MVCC based. Asynchronous mechanism. Conflict management related questions listed above provides clarity on implementation
Brokers - Load Balancing
Archive Manager - Stores data as Key Value Pair
Transaction Manager - Diskless.
  • The process of performing a transaction includes
  • Broker Notifies Transaction Manager for Transaction to be performed
  • Fetch the required ATOMS from Archive Manager
  • Load the Data into Transaction Manager
  • Perform the transactions
  • Pass it to Archive Manager and commit in DB
Session also covers brief overview of Elasticity, Virtualization, High Availability support of Nuo-DB. Benchmark results against Mysql results are a good start and a compelling reason to try out NuoDB
 
Happy Learning!! 

December 29, 2011

Command Prompt Disappears in Win7

I had this issue for last 6 months. Command prompt window used to disappear immediately after launch. This link was very useful to solve the issue.

As suggested in the answer, You have to delete the AutoRun value set as Exit in the Registry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor).

Happy Learning!!

.NET App Developer Notes

Last couple of weeks I have been busy trying out my new project in VS2010 / C#. Couple of basic exercises for my learning purpose are listed below. Please modify the code to make it work.
Tip #1
  • Working on Folder Open and Browse Dialog for a Windows FormsApp
  • Best option is to reuse codeplex code. Link 
Tip #2
  • Working with Threads
  • Below is a Simple Threadpool (For sum of two numbers). Try it out as a Forms app so see how operations are performed parallely.
using System;
using System.Threading;
using System.Windows.Forms;
class InputNumbers
{
    public int a { get; set; }
     public int b { get; set; }
}
class Example
{
    public Example()
    {
      // Declare a new argument object.
      InputNumbers IS = new InputNumbers();
      IS.a = 10;
      IS.b = 20;
      for(int i = 0; i<100 ; i++)
      {
            IS.a = i;
            IS.b = i+2;
            // Send the custom object to the threaded method.
            ThreadPool.QueueUserWorkItem(new WaitCallback(AddNumbers), InputNumbers);
    }

    private void AddNumbers(object a)
    {
      InputNumbers IS = a as InputNumbers;
      Messagebox.show((IS.a+IS.b).ToString());
    }
}

Tip #3

To keep methods seperate, DB Layer, Web Methods and UI Layer, I decided to keep them in different classes. This question was useful for my learning for this tip. Below is a simple example.
Class A
Class B
ProgramFile.cs
All classes in different file

classA.cs
using System;
namespace class_A
{
    class classA
    {
        public void methodA()
        {
            Console.WriteLine("In Method A");
        }
    }
}

classB.cs
using System;
namespace class_B
{
    class classB
    {
        public void methodB()
        {
            Console.WriteLine("In Method B");
        }
    }
}

program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using class_A;
using class_B;
namespace ClassExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            classA A = new classA();
            classB B = new classB();
            A.methodA();
            B.methodB();
            Console.ReadLine();
        }
    }
}

Tip #4
  • Working with Log4Net
  • The following two posts link1, link2 were useful to get started.
  • Below is simple Windows Forms App
  • Add the Log4Net DLL in project references
 LogHelper.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using log4net.Config;
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
[assembly: log4net.Config.Repository()]
namespace loggingns
{
    public class Loghelper
    {
        #region Data Members
        public static readonly ILog testLogger = LogManager.GetLogger("log4NetExample");
        #endregion
    }
}

Program.cs
Invoke the following method to log entries . Use the namespace loggingns in Form1.cs.

using log4net;
using log4net.Config;
using log4net.Core;
using loggingns;

Sample Test method

        public void testMethod()
        {
            Loghelper.testLogger.Debug("Debug Log");
            Loghelper.testLogger.Info("Info Log");
        }
App.config file entry
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
      <configSections>
            <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
      </configSections>
      <appSettings file="" >
            <clear/>
             <add key="log4net.Internal.Debug" value="false"/>
      </appSettings>
      <!-- This section contains the log4net configuration settings -->
      <log4net debug="true">
            <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
                  <layout type="log4net.Layout.XMLLayout" /> -->
                  <param name="File" value="TestLoggerExample.log"/>
                  <param name="AppendToFile" value="false" />
                  <layout type="log4net.Layout.PatternLayout">
                        <header type="log4net.Util.PatternString" value="[START LOG] %newline" />
                        <footer type="log4net.Util.PatternString" value="[END LOG] %newline" />
                        <conversionPattern value="%d [%t] %-5p - %m%n"/>
                  </layout>
                  <filter type="log4net.Filter.LevelRangeFilter">
                        <param name="LevelMin" value="INFO"/>
                        <param name="LevelMax" value="INFO"/>
                  </filter>
            </appender>
            <!-- Setup the root category, add the appenders and set the default level -->
            <root>
                  <level value="ALL" />
                  <appender-ref ref="LogFileAppender" />
            </root>
            <!-- Specify the level for some specific categories -->
            <logger name="log4NetExample">
                  <!-- <appender-ref ref="B" /> -->
                  <level value="ALL" />
                  <appender-ref ref="LogFileAppender" />
            </logger>
      </log4net>
</configuration>

I hope these tips would help for future reference.

More Reads
N-Tier Architecture Best Practices, Part 1: 2-Tier Architecture with just a Data
N-Tier Architecture Best Practices, Part 2: 3-Tier Architecture with interfaces and a Data Tier


Happy Learning!!

November 02, 2011

NuoDB – ACID Compliant, Scalable Cloud Database


I have been learning / working on MSSQL (2005/2008) on 

  • Database Development
  • High-availability (Replication / Log Shipping / Mirroring / Clustering)
  • Performance Tuning (Index Tuning, Partitioning)
  • Performance Testing (To validate Peak Load performance, Web Service response at peak loads)
Last night I attended Technical Overview Session on NuoDB. The Session was very impressive. Outcome of Session is NuoDB has the potential to become dominant player in Cloud based Database Platform. I have prepared a Table comparing NuoDB features against MSSQL.  






Feature
MSSQL
SQL Azure
NuoDB
Comments






Processing
Parse, Execute, Cache. Transaction manager is invisible to the enduser. Rows, Pages, Extents are basics on Data Storage.
Parse, Execute, Cache. Transaction manager is invisible to the enduser. Rows, Pages, Extents are basics on Data Storage. Maximum Size is 50GB Limit.
Transaction Manager and Archive manager are core components of the system. Everything in DB is an ATOM






Database Scale out Architecture
Every Version has number of processors, RAM support. Based on the performance you can add /remove additional hardware physically
Not Mentioned. I am still checking MSDN
Add / Remove Transaction Manager, Archive Manager based on Need
Add / Remove Transaction and Archive Managers based on Need. During Holiday season scale out and in normal days reduce the AM/TM. NuoDB is scaleable. NuoDB Scales out immediately






Free Version
Express Edition free with 10GB data limit
1 GB Trial Edition for 90 days
One Transaction manager and Archive manager Free






Failover
Clustering, Mirroring, Logshipping
Replication, Mirroring – Not Supported
Multiple Archive Managers, Transaction Managers geographically distributed. All are peers. Data Distributed across all TM, DM
NuoDB is highly resilient, highly redundant. When there is no Archive Manager, Transaction Manager only then System will be down. This possibility requires lot of effort bring down all the data centres across the globe. Geo-Distribution (Active - Active Configuration). Database running in multiple places






Index Support
Clustered, Non-Clustered indexes
Clustered, Non-Clustered indexes
Supports B Tree based Indexes






Stored Procedures
Supported
Supported
Supported






Partitioning, Data Caching, Virtualization Support
Partitioning Supported, Caching - NA, Virtualization - Supported
Partitioning Not Supported, Caching - NA, Virtualization - Supported
Transaction manager has many characteristics of cache. Leverages deep knowledge of transaction. , Virtualization - Supported, Partitioning not supported






Migrating from MSSQL
NA
NA
90% SQL standards are applicable in NuoDB as well. There might be 10% additional work to be checked for migrating to NuoDB






BI
PDW, SSIS, SSAS, SSRS
Currently no BI support in Version 1. NuoDB is best supported for Mixed workloads. Long running queries, Short running queries both work independently






Locking / Blocking, Versioning
Isolation levels defined. They define how locks are assigned. Version need to be enabled (RCSI)
Isolation levels defined. They define how locks are assigned. Version need to be enabled (RCSI)
MVCC based architecture for versions. Data is never deleted.
I am not too sure about this architecture for NuoDB. Need to check further

I need to deep dive on specific aspects to write / expand further on above listed topics. To Summarize  

  • NuoDB is 100% ACID Compliant, Scaleable Database
  • ACID compliance makes it Ahead of NOSQL DB
  • NuoDB Scalability, High Availability Support makes it a potential dominant player for Cloud Database Platform
I would urge readers to install / Try Beta Version of NuoDB

Happy Learning!!