I am a Senior Consultant, Application Developer at Thoughtworks with more than 7 years of experience in building highly efficient and scalable applications using agile methodologies, clean coding and best practices for large enterprises. I develop applications using micro-services and event driven architecture, consult companies on OO Design, patterns, testing techniques and development methodologies. Passionate about XP and agile
Technical Lead
Avalara TechnologiesSenior Application Developer
Thoughtworks TechnologiesSenior Research Engineer
Hyundai MobisPostgreSQL
AWS (Amazon Web Services)
Java
Apache Kafka
Azure Cosmos DB
Docker
Java 11
Java 8
Spring Cloud
Spring Boot
Azure Pipelines
GitHub
IntelliJ IDEA
Azure Active Directory
New Relic
Grafana
Splunk
Cucumber
Jenkins
REST API
Web API
AWS
Azure
MySQL
Restful API
Kafka
Kubernetes
Gradle
Maven
Postgres
MongoDB
CosmosDB
Nomad
Rio
Amazon EKS
PCF
Maven
Azure DevOps
Azure Cloud
AWS Cloud
Consul
Datadog
Github
Yeah. Hi. Uh, this is Akash. Yeah. So I'm a Java back end engineer having total years of experience, um, into microservices, APIs, RESTful APIs, uh, and cloud native applications. I've used cloud like AWS, Azure Azure DevOps Platform for our development. And, uh, worked on ecommerce domain mainly, little bit of health care domain experience, and also currently working for banking project. So that's a brief about me in terms of tech stack. I use Java, Spring Boot Microservices, RESTful APIs, Kafka, um, Azure, AWS. And in development, we follow all the XP practices like clean coding, pairing, refactoring, and test driven development. Yeah. That's all.
Okay. To architect a Java based, um, microservices, um, to be scalable and maintainable on cloud, such as AWS. Uh, so, basically, the architecture would be something like, uh, a basic unit or system which we develop, uh, which can be easily hosted on, uh, AWS. Uh, to make it scalable, uh, we can make it design efficient, uh, such that it can, uh, can be less tightly coupled. It can be, you know, having less lesser depend interdependencies. Uh, we can design in such a way that it can basically a domain oriented design. So let's say, for example, a hospital system, it has got, uh, patient management. Uh, let's say, doctor management or medicine management, just for an example. So when we are architecting it, basically, making it a microservices, then we can split it domain wise so that, you know, uh, each microservice can handle a separate department rather than, you know, having cross cross, uh, concerning services, which would lead to a title a tight coupling between the systems. Uh, so that way, whenever the cloud it will be deployed on cloud, it can be easily scalable and will not impact the business other business part. So, basically, try to minimize the overlap between the microservices. And in terms of technology, we are building, uh, one microservice. We can try to use a modern or an a modern tech stack, uh, which can make it cloud friendly and it can be easily deployed. Well, um, and also choosing database, uh, which can help in, uh, scalability. Um, like, uh, if you are going for a horizontal scalable, then choosing NoSQL database would be better than having a SQL database. Uh, if it's more right, uh, read efficient, and then, of course, NoSQL would be helpful in that. Yeah. That those are some basic parameters we can take in consideration while designing, uh, microservices for cloud native. Environment. Yeah.
Cool. So if we have to identify or debug a performance issue in a cloud application, such as, uh, Spring Boot Java Service, We can have a first in a we can have some observability and monitoring, uh, platform set up for our application so that uh, all the crashes or any crashes or any, um, helpful logs, we can easily monitor on our dashboard. So we usually use when in tools such as Splunk or Datadog or New Relic where we can, you know, monitor our performance of the application. Uh, the logs are, I think, would be the first insight, you know, first, uh, place to check whether or what. So, basically, you usually have dashboards for an application, which, you know, gives the you can track the health of your service. But in case if you observe any, uh, issues in the health or in the, you know, error rate, basically, so you go and check your, uh, logging application if you have set up any. If not, we are logging if you're not using any logging application, then maybe, uh, the the server where we have deployed our application, um, they could have a console for our Java application, which would, uh, basically would be providing those logs. So, yeah, I think logs would be the first step to know know what exactly what is the failure and why that service is failing. So in terms of perform if this is a performance issue, maybe we can look at, uh, what database like, if that issue is really because of database. So, usually, we see that and due to database performance, the data rights are slower because in general, Java applications are quite fast enough if if it is logic is being processed internally. But if it is talking to other applications, our network or it has DP. So DP could be one important area where, uh, the issues could be occurring. Uh, we could see if you can improve the performance of database, by changing its design, or maybe we can implement their, uh, if as per the need, the the changes I mean, we need caching mechanism, then we can implement caching at, uh, all the layers, uh, in the entire flow at database layer or maybe at API level itself, we can add caching so that the performances can be improved.
What considerations are vital when scaling a job application on AWS utilizing both SQL and SQL databases? So when we are looking for scaling a Java application, um, basically, at the design part of it, uh, becomes critical here. Uh, designing as in, again, we'll divide the microservice in such a way that, uh, there are lesser overlaps with the other, uh, other services, basically reducing the tight coupling between microservices. Uh, and if we are utilizing both, so for NoSQL, maybe, uh, like, we can improve it having uh, you know, for SQL, uh, maybe we can utilize some pattern like CQRS, wherein the different database are handling commands and queries, and, uh, the other database or the other replicas are handling the, uh, read read requests so that the overall performance is improved. And in NoSQL as well, I think, uh, adding caching mechanism can improve the performance. So, yeah, when overall performance is improving, scaling becomes easier. So choosing NoSQL for horizontal scaling comes as a recommended practice And, um, where a lot of pattern is observed, like, in term even we have, uh, you know, in database where the tight coupling, uh, between the domain is, you know, not avoidable, uh, so we need fixed, um, schemas, basically, for our application. So we go for SQL databases. And in that, uh, if you want to make it scalable, then I think vertical scaling for SQL databases becomes important. So, yeah, like I told, uh, SQLs pattern or, uh, master slave pattern becomes important for, uh, SQL designing when we go for scaling in SQL. And for NoSQL, usually, it, uh, helps in horizontal scaling. Adding caching mechanisms, can improve the performance if you're going for a scaling.
How do you prevent any provisioning of resources when the the application in AWS. I'm not very sure how to prevent the overprovisioning, but what I understand is, uh, maybe, uh, we can know what what limit or what resources my application is consuming initially, uh, before deploying itself or maybe if we have any lower environments where we can see how what is the actual utilization resource utilization. And, um, if we know what if you could predict or know how much load on my application is or service is going to have, maybe we can allocate that much amount of load for the, um, for the production environment or the real actual environment so that we not we do not unnecessarily create a space or we not unnecessarily overprovision the resources for, you know, for our application. Um, in terms of intra, I'm really not sure how exactly that would be done on AWS, but that's a initial point to consider.
To optimize query performance for SQL and NoSQL yeah. So for NoSQL, if you want to optimize, uh, maybe we can introduce so if if so it's example, if it is a document based database, so, uh, we would be querying document based on certain fields. For example, we can, uh, have indexes added for that document. So for that field, particularly, we can implement indexing. And for SQL databases, again, indexing helps, but maybe we can optimize the design by having caching for SQL databases. Or maybe if we follow patterns such as my master slave pattern or CQRS pattern wherein, um, the read the read and writes are basically separated. So, um, the overhead or the performance bottleneck does not happen in the database. Yeah. So that way, I think, query requests and then eventually having, uh, consistency between both the database. Uh, in terms of SQL database, this, can improve the performance of oral application.
So this is a recursive function, which is taking the number and trying to return the Fibonacci. Um, okay. So one quick improvement is the if else block that is unnecessary unnecessary, uh, else statement because if inside if execution if you are already returning, so else part need not be added another branching. It will automatically go to return. Yeah. The one branching can be improved. And what else? Other way could be if Other improvement from terms of performance could be you could store the results, for example, for any intermediate numbers if we have already we already know the result, so we can have some memoization where a reference table we can use. For example, for 5, if it is, uh, it would find out the Fibonacci for 5 then for 4 because because we are 4321, uh, in, you know, decreasing order because we are doing Fibonacci of n minus 1 and n minus 2. So if we would have already computed the, uh, Fibonacci value for 3 or 2 as an intermediate value, then we can, uh, store that result in some table or map, which we could refer to improve the performance. Because, uh, in this pattern, if we go on and see, we could find there would be repeated calculation or computation of Fibonacci value. So as an improvement, we can we can avoid the repeated calculation of intermediate Fibonacci numbers.
I think we can if it is, uh, non thread safe, uh, if it is not thread safe, we can have atomic references for a singleton instance in this class so that, um, at threat level, if multiple resource if multiple instances are trying to access this instance, they would always get the same ins they would always, uh, get the same instance. And, uh, yeah, I think the private constructor is private, so there is no issue in that. Uh, static singleton get instance instance double equals numb. This is new singleton. It could be possible that initially the instances none and 2 thirds are trying to call cat instance and both of them would try to create the same static instance. So, yeah, at get instance level, uh, we can implement synchronization, uh, so that one thread only, uh, gets the chance to create a singleton instance and return.
Any job application having high traffic on AWS, we can implement or we can integrate, uh, monitoring tools such as Neuralink, Refundr, or Datadog, which can which can take the logs and or the API metrics, basically, and, uh, we can build dashboards to see what are how the API is performing, uh, need to make it scalable. Again, certain design approaches, just, uh, caching at various levels, uh, database designs, microservices architecture in terms of how we are breaking the microservice. And, yeah, I think these are some basic parameters which we can consider, uh, to make the application scalable, ready, and also handle high traffic.
Um, never, uh, worked on AB testing, but I think testing you then we can move that way.
I have worked on system, but I'm not yeah. So far, applying dependency inversion and solid patterns, uh, solid patterns are like in general principles which we follow while designing or having low level implementation. So we try to make the system, um, very much aligned to real world objects. Right? And where we see that classes are not, uh, designed in right way, which are open for modification, but open for extension but closed for modification or having single responsibility. And the inversion part, uh, like, framework is being asked to provide the dependency rather than the caller trying to maintain the dependency and, uh, not having too many interfaces and, uh, subclass being substitutable for super classes. So I think these are all, uh, pointers in a solid pattern. So, yeah, for designing an ecommerce system, in my experience, we have tried to utilize these patterns as much as as closely as possible. We are in wherever as wherever, uh, it was possible, we have applied it. Uh, and also depends on version, I think for in version, we would use my Spring Boot microservices, which Spring Boot based microservices. So Spring Boot Spring Boot framework internally gives us beans and injection mechanisms, which wherein we create the dependency of components and use wherever it is, uh, necessary rather than, uh, manually handling all the dependencies and usage. So does there the framework helps in achieving the dependency inversion principle.