April 9, 2017

From Francesco Marchioni book “MongoDB for Java Developers”

when we talk about NoSQL databases, or,generally, if we are designing distributed systems, we might have to look beyond the
traditional ACID properties. As stated by the CAP theorem, coined by Eric Brewer,the following set of requirements are truly essential when designing applications for distributed architectures:
• Consistency: This means the database mostly remains adherent to its rules
(constraints, triggers, and so on) after the execution of each
operation and that any future transaction will see the effects of the
earlier transactions committed. For example, after executing an
update, all the clients see the same data.
• Availability: Each operation is guaranteed a response—a successful or
failed execution. This, in practice, means no downtime.
• Partition tolerance: This means the system continues to function even if
the communication among the servers is temporarily unreliable (for
example, the servers involved in the transaction may be partitioned
into multiple groups,which cannot communicate with one another).
In practice, as it is theoretically impossible to have all three
requirements met, a combination of two must be chosen and this is
usually the deciding factor in what technology is used, as shown in
the following figure:
If you are designing a typical web application that uses a SQL database, most likely, you are in the CA part of the diagram. This is because a traditional RDBMS is typically transaction-based (C) and it can be highly available (A). However, it cannot be Partition Tolerance (P) because SQL databases tend to run on single nodes. MongoDB, on the other hand, is consistent by default (C). This means if you perform a write on the database followed by a read, you will be able to read the same data (assuming that the write was successful). Besides consistency, MongoDB leverages Partition Tolerance (P) by means of replica sets. In a replica set, there exists a single primary node that accepts writes, and asynchronously replicates a log of its operations to other secondary databases.

However, not all NoSQL databases are built with the same focus. An example of
this is CouchDB. Just like MongoDB, it is document oriented and has been built to scale across multiple nodes easily; on the other hand, while MongoDB (CP) favors consistency, CouchDB favors availability (AP) in spite of consistency. CouchDB uses
a replication model called Eventual Consistency. In this model, clients can write data to one database node without waiting for acknowledgment from other nodes.The system takes care to copy document changes between nodes, so that


can you add million number executor service fixed thread pool(5)

April 8, 2017

can you increase the number to million number to executor service fixed thread pool(5) when the number is 5
what will happen?

static blocks has 2 instances created

April 7, 2017

static blocks has 2 instances created inside of it, so when the class is loaded and when new instances are created then how many instances are created?

Spring Boot Advantages

March 20, 2017


  • Environment Based Configuration-Using these properties, you can pass into the application which environment you are using{enviornment}. Spring will then load up the subsequent application properties file at (application-{environment}.properties) after loading up the main application properties file.

12 Factor App

March 19, 2017


1. There should be a one-to-one association between a versioned codebase (for example, an IT repository) and a deployed service. The same codebase is used for many deployments.

2. Services should explicitly declare all dependencies, and should not rely on the presence of system-level tools or libraries. Chapter 1. Overview 3 3. Configuration that varies between deployment environments should be stored in the environment (specifically in environment variables).

4. All backing services are treated as attached resources, which are managed (attached and detached) by the execution environment.

5. The delivery pipeline should have strictly separate stages: Build, release, and run. 6. Applications should be deployed as one or more stateless processes. Specifically, transient processes must be stateless and share nothing. Persisted data should be stored in an appropriate backing service.

7. Self-contained services should make themselves available to other services by listening on a specified port.

8. Concurrency is achieved by scaling individual processes (horizontal scaling).

9. Processes must be disposable: Fast startup and graceful shutdown behaviors lead to a more robust and resilient system.

10.All environments, from local development to production, should be as similar as possible.

11.Applications should produce logs as event streams (for example, writing to stdout and stderr), and trust the execution environment to aggregate streams.

12.If admin tasks are needed, they should be kept in source control and packaged along


1. CodeBase * Codebase must be tracked in version control * One codebase per app * Extract libraries for common code used in different codebases 2 Dependency * Never rely on system wide package * Declare and isolate dependency 3 Configuration * Config which is varries across deploys * config should be separate from app 4 Back Services […]

via 12 factor App — praveenatc42

Jwt, why soap vs rest, 2 way ssl

March 19, 2017

Idempotent why you should not update data in GET

March 19, 2017


March 14, 2017

GIT commands

February 25, 2017

Lambda Expression, Streams API, Default Methods and Method References. and Repeating Annotations

February 15, 2017
  • what is lambda expression? It is an anonymous function that allows you to pass methods as arguments or simply, a mechanism that helps you remove a lot of boilerplate code.They have no access modifier(private, public or protected), no return type declaration and no name

Java 8 Default Methods

In order to work around situations like this,We will have to provide implementation for sayHi() method in the class MyClass therefore overriding both methods in InterfaceA and InterfaceB.