Home » Author Archives: Ashkrit Sharma

Author Archives: Ashkrit Sharma

Pragmatic software developer who loves practice that makes software development fun and likes to develop high performance & low latency system.

Lazy evaluation

java-interview-questions-answers

Recently i was writing log4j appender and wanted to use logger in it to log some diagnostic details during custom appender creation, but log4j initialization completes only after appender instance are created, so message logged during this phase are ignored. I felt the need for lazy initialization in custom appender and started to look at options. In this blog i will ...

Read More »

Java Arrays Sort decoded

java-logo

Sorting is one the first algorithm that we learn in computer science. Sorting is such an interesting area that it has around 20+ algorithm and it is always difficult to decided which one is best. Sorting algorithm efficiency is measured in terms of time taken & space required. Some time bubble sort is best because it has no space requirement and for ...

Read More »

Wrap around design pattern in java8

java-logo

Wrap around pattern is not listed in in GOF book but is very useful for problem like below: Loop construct for e.g do while/while/for loop Stopwatch around some code. Wrap checked exception with run time exception Initialization and cleanup for eg Threadpool creation/destruction or file open/close etc Adding context info to threads for eg request context info for logging or ...

Read More »

Efficiency with Algorithms

software-development-2-logo

Recently had look at excellent talk on Efficiency with Algorithms, Performance with Data Structures , this talk has really some good content on performance. In this blog i will share some of ideas from above talk and few things that i have learned. Pre processing This is very common trick, this is trade off between processing required when actual requests comes ...

Read More »

Factory Without IF-ELSE

java-logo

Object Oriented Language has very powerful feature of Polymorphism, it is used to remove if/else or switch case in code. Code without condition is easy to read. There are some places where you have to put them and one of such example is Factory/ServiceProvider class. I am sure you have seen factory class with IF-ELSEIF which keeps on getting big. ...

Read More »

Off Heap concurrent counter

software-development-2-logo

Concurrent counter are part of almost every system, it is used to collect data, thread synchronization etc. Java has good support of heap based counter. There could be use case when you need counter that can be shared between processor.           How to build inter process counters Database This is first option that comes to mind, ...

Read More »

Scalable Counters For Multi Core

java-logo

Counters are required everywhere , for e.g. to find key KPI of application, load on application, total number of request served, some KPI for finding throughput of application & many more. With all these requirement complexity of concurrency is also added & that makes this problem interesting. How to implement concurrent counter     Synchronized – This was the only ...

Read More »

Which memory is faster Heap or ByteBuffer or Direct ?

java-logo

Java is becoming new C/C++ , it is extensively used in developing High Performance System. Good for millions of Java developer like me! In this blog i will share my experiment with different types of memory allocation that can be done in java and what type of benefit you get with that. Memory Allocation In Java What type of support ...

Read More »

ArrayList Using Memory Mapped File

java-logo

Introduction In-Memory computing is picking up due to affordable hardware, most of the data is kept in RAM to meet latency and throughput goal, but keeping data in RAM create Garbage Collector overhead especially if you don’t pre allocate. So effectively we need garbage less/free approach to avoid GC hiccups Garbage free/less data structure There are couple of option to achieve ...

Read More »

Lock Less Java Object Pool

java-logo

It has been a while since I wrote anything, I have been busy with my new job that involves doing some interesting work on performance tuning. One of the challenges is to reduce object creation during the critical part of the application. Garbage Collection hiccups has been a main pain point in java for some time, although java has improved over time the ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns