Modern functional applications architecture requires slew of silo pieces working collectively in harmony  based on “PnP (Plug n Play)” architecture. Enterprise leans towards fluid, functional and scalable applications paradigm utilizing  “Micro Service Architecture (MSA)”. MSA implementations help  break large monolothic application tiers into smaller and manageable services. Each MSA have it’s own dedicated and non-blocking process ,communicate over REST and can contain mix-bag of multiple languages with each performing it’s own allocated tasks. One service failure have no impact on others.

Micro-Services Characteristics:

  1.   Developed and deployed independently of other.
  2.   Communicate using REST.
  3.  Each service can be written in different programming languages.
  4.  Each service can use different data storage technologies.
  5.  Ideally each service should perform only one task.

[! MSA approach is influenced by SOA framework benefits and  SOA short falls.]

Benefits :


Divide application into small  manageable modules based on functionality. This enables better code refactoring, sharing, scalability and less risk prone.


Deployment ans changes in any service doesn’t affect other services. This help contains any bugs/issues contain within a service and not impacting others.Each service act like individual specialist working in a manufacturing assembly line.


Under monolithic any version upgrades or related bugs impacts entire application. It also required more maintenance and other non-productive over heads.

Drawbacks :


To improve modularity, micro services work as a distributed system so performance may slow and may bear risk of failure.In order to work as a distributed system micro-services use asynchronous programming  that is hard to get right and much harder to debug.

Sometimes Not Consistence

As we know , micro-services work as distributed system and can communicate different 2 data store there may be case you are storing/updating something but that doesn’t update for some moments but after it updated. Reason behind it only decentralized data management.In the other hand, with a monolith, you can update a bunch of things together in a single transaction.

So now, developers need to be aware of this type of consistency issues, and figure out how to detect when things are out of sync before doing anything the code will regret.

Lastly, creating a micro-services based application framework requires deep knowledge of assigned application functionality. Plus upfront time allocation to create logical blueprints for entire application which can be time and resource consuming without showcasing any upfront tangible benefits to end consumers. But this approach is worth once successfully implemented.

Example: Micro-Service based architecture to enable multiple Data Base interfaces



Let’s create a simple micro-service  using Play with Scala which fetch a user details based on provided parameters.

Step 1: Create a case class

case class User(id: Int,name: String, description: String)

Now time to perform inert operation using any database with any database query
language.Here,you can perform this task  easily so we Leave this for you.

def insert(user:User): User = {
  //TODO: Put your code to store user using any database query language for any Database
Now to fetch list of user from DB,you can use any database query language but for 
for now,we have hard coded list of user.
def list: List[User] = {
 //TODO: Put your code to fetch data from database
 List(User(2000, "Akshay", "Play"),
      User(2001, "Anand", "Spark"),
      User(2002, "Supriya", "Spark-GraphX"),
      User(2003, "Himanshu", "Elastic Search"))
According to our user's class ,we created a userForm taking three field
id,name and description like this:
  * user form
val userForm = Form(
    "id" -> number,
    "name" -> nonEmptyText,
    "description" -> nonEmptyText

In controller, after validate all value is coming as per our form then we can create insert method like this:

  * Insert a new user.
def insert() = Action { implicit request =>
    form => BadRequest(views.html.createForm(form)),
    user => {
      Redirect(routes.Application.list).flashing("success" -> Messages("User has been inserted", user.name))
You can see all code on Github Click it.

In second part we would see how microservices communicate with each other, till then run it as http://localhost:9000/.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s