Saturday, February 17, 2024

Interview Questions : What are the things you will consider in System Design or Microservices System Design?

 When it comes to Microservices system design,


  1. The first and foremost thing we should consider is not technical split, it is split of business capabilities
  2. We have to clearly define the business/functional boundaries of microservices (each microservices application) 



Friday, September 16, 2022

Basic Questions From Java and MySQL

 


MySQL

What is INDEX?

What INDEX do you use much, How will you create INDEX?\

What is Pessimistic and Optimistic locking?


Java

What is StringBuffer and StrinBuilder?\


Friday, July 1, 2022

SAGA Pattern: Design, Implementation Path

 Choreography Or Orchestration

Steps (Microservices and Persistent Layer)

Events 

States

Bounded Contexts

Actors

Compensating Transactions

Eventual Completion (Happy Path/ Unhappy Path)



Pivot Transaction - Once commit, then next transactions must complete until end. If payment is done, must complete the Seat Allocation. 

Retry able Transaction - Transactions followed by Pivot transaction. If the Seat allocation done, next ones will be processed.

List of Idempotent transactions - Identify


  • compensating transactions must be idempotent, commutative, and they cannot abort (they must be retried indefinitely or resolved through manual intervention when necessary).


Saturday, June 18, 2022

Using Java for Date, Time, Duration

 We have been using the below packages and the classes for Data Time for long time. But after Java 8 release there is big relief for developers and they can do date, time manipulations with lesser code. 

We will compare them. 

java.util.* - Old date, time package

java.sql.* - Implements the classes from above package java.util.*

java.time.* - The new Java 8 package with lot of convenient features.

joda time api - Which was fulfilling the gaps in java.util packages.

Monday, June 6, 2022

Spring Boot, Jenkins, Docker on AWS ECS

 Without the Kubernetes, how can we manage and orchestrate cluster of containers in AWS.

AWS Beanstalk: Quicker way to move applications to AWS Cloud

 AWS Beanstalk :

Do you want to deploy your applications (Java, .NET, Node JS) in AWS cloud easily? Then the best way is to go for Beanstalk.

Just upload your application like JAR file if Java application, and create application. Beanstalk automatically provision all required resources and deploy them, and provides the URI to access the application. It is very fast deployment without struggling defining your EC2, Scaling, Load balancing configuration and you can have full control on created resources like EC2 instances etc., 

Deploy via AWS Console: 

Pre-requisites: 

  1. Have your application built and ready. In my case a simple Spring Boot application with REST API end points. Please do-not provide SERVER.PORT:8080 and leave it to default. 
  2. Test your application locally using, java -jar app.jar and test it is working fine.
  3. Have your AWS account and credentials. Login to AWS Console. 
  4. Check if you have VPC ready, if you do not have, please create a default VPC. 

Step to Deployment: 

  1. Login to AWS Console, Search for Elastic Beanstalk and click.
  2. Click the create environment button. 
  3. Choose web server environment as our app is web API, and click SELECT button.4
  4.  In the application details page
    1. Fill Application Name : example java-balaji-api
    2. Fill Environment Name : example: java-balaji-api-dev
    3. Provide description 
    4. Choose Platform, here in our case it is Java Spring Boot based API so selected Java
    5. Choose Platform Branch :  My app is built using OpenJDK 11, so I selected "Corretto 11 running on 64 bit Amazon Linux2"
    6. Platform Version : I chosen default Recommended
    7. Application Code Tab: Select Upload your code. 
    8. Fill Version and Choose Local file, and upload the jar from local folder location.
  5. Configure More Options
    1. Click Software and Edit button
    2. In Environment properties, please add new variable and value SERVER_PORT and value 5000.
    3. Then click Save button
  6. Then Click create application. 

It will provision EC2 for compute S3 for code (jar file) and deploy and start the application and provide the URL. 

Test from Postman: 

From post man replace the localhost:8080 with the above URL and test your application. 
In my case : 



Terminate and Remove: 

If you want to terminate the application, please choose and terminate. It will terminate only the EC2 instance. But to remove your application from S3, please click application and click "Delete" button.