Alejandro G. Carlstein Ramos Mejia Blog



 icon-arrow-left Microservices: Brownfield: Transactions

The support reporting for our micro-services architecture system can be a little complex. At difference to a monolithic architecture where you may have a few databases to report from, in the micro-services architecture system, you will have a tons of databases to report from since each micro-service will have its own database.

The report of the data will come from the be split across multiple micro-services and since there is no a central database where you could extract this information you may need to join data across databases. Also, in the micro-service architecture system, reporting can be slow. 

One way to facilitate the reporting is to have a dedicated reporting micro-service which calls all our micro-services and takes care of collecting and consolidate the data. The only disadvantage is when we are reporting large volumes of data or we wish to obtain a report in real-time.

Share

 icon-arrow-left Microservices: Brownfield: Migration: Database | Microservices: Brownfield: Reporting icon-arrow-right 

When moving from a monolithic system to a micro-service architectured system, we need a different approach when dealing with transactions.

Transactions are useful:

  • They ensure data integrity.
  • They allow us to updates several records as part of one transaction.
  • If one or more updates (and/or creates) fails, we can roll the entire transaction back.

In monolithic transactions are simple. We can have one process which is updating and creating records. These records are part of the transaction; therefore, the same process can either commit the transaction or roll it back if there are any issues.

Share

After watching some TED’s presentations, I decided to follow some of the ideas presented. I am going to experiment with positivity.

For a month, I will do one or more of the following actions per day:

  • Write down three things I am grateful
  • Journal one positive thing that happens to me inside the 24 hours
  • Exercise to teach myself that behavior matters
  • Meditate to help with the ADD that this society has created.
    ( I do yoga so this part is cover Wink )
  • Perform random act of kindness such as writing a positive email or message to my social network

The idea is that we improve our lives plus exercise our brains to know how to keep begin positive. Plus, there seems to be research showing that positive thinking improve performance and quality of life.

Share

Facts

  • The Ford-Fulkerson method (G,S,t) is iterative
  • This method depends on three ideas:
    • Augmenting paths
    • Residual networks
    • Cuts
  • Simplified Pseudo-code:
    initialize flow f to 0
    while there exist an augmenting path p
        do augmented flow f along p
    return f

Augmenting Paths

  • An augmenting path p is a simple path from source S to sing t in the residual network
  • Each path have alternative free and matched edges in such way that begins and ends with free vertices.

Residual networks

  • Definition: Each edge (u,v) on an augmenting path admits some additional positive flow u to v without violating the capacity constrain on the edge.
    Ford_fulkerson_Residual_Flow
  • Example:
    Ford_Fulkerson_Transformation

Cuts

Share

Note: Remember. JavaScript is a prototype-based language.

var Module  = (function() {
    // declare private variables and/or functions
    var private_variable = "private variable content";
  
    var private_method = function(){
        console.log("private_method()");
        console.log("-> private method content");     
    }
    return {
        // declare public variables and/or functions     
        public_variable: "public variable content",
        public_method: function(){
            console.log("public_method()");
            console.log("->" + private_variable);     
        }
    };
})();
  
// Execution
console.log(Module.public_variable);
Module.public_method();
console.log("------------------------------");
console.log(Module.private_variable);
console.log(Module.private_method());
 
// Output
public variable content
public_method()
-> private variable content
------------------------------
undefined
Uncaught TypeError: Module.private_method is not a function

 

Share

I was ask to do some JavaScript tutoring; however, I am quite busy at the moment doing interviews. Therefore, I will just list some great sources of JavaScript for those who wish to learn or improve using language.

Share

As you may know, Microsoft is getting into the open source community with the ASP.NET and DNX with the mono project.
The .NET Execution Environment (DNX) is a software development kit which allows you to run .NET applications on Windows, Mac, and Linux using different frameworks such as .NET framework, .NET Core, and Mono. However, everything are not roses. There are many incomplete libraries, incompatibilities, lack of documentation, and most of the examples such as doing SQL or SOAP do not work depending on which the library targets you are planning to code for. Therefore, I decided to test the basics on all the library targets. I am starting with DNX451.

The dynamic keyword seems to be working fine in DNX451 with C#. Below is a code example for those who wish to play with it.

Program.cs

using System;

namespace ConsoleApp1 {
	
	public class Program {
		
		public void Main(string[] args){			
			Console.WriteLine("Main()");
			
			displayWhichDnxIsCompilingOn();
						
			new DynamicKeywordExample.DynamicKeywordExample();
			
		}
		
		private void displayWhichDnxIsCompilingOn(){
			#if DNX451
			Console.WriteLine("Compiled on DNX451: .NET Framework");
			#endif
			
			#if DNXCORE50
			Console.WriteLine("Compiled on DNXCORE50: .NET Core 5");
			#endif						
		}
		
	}
	
}
DynamicKeywordExample.cs

Share