Virtual Threads: A Definite Advantage

It’s great to explore the world of virtual threads, a powerful feature in Java that promises to revolutionize multi-threaded applications. In this article, we’ll delve into how virtual threads can enhance your application’s performance and scalability, all while keeping thread management overhead very minimal. Let’s embark on this journey to harness the full potential of virtual threads!

In order to prove this use case, we will create one million platform threads and virtual threads. After generating these threads, we will analyze their heap and thread behavior with HeapHero and fastThread tools. Through this exploration, we aim to highlight the distinctions in performance between platform threads and virtual threads.

Garbage Collection Analysis: OpenJDK and GraalVM

In this article, we are going to compare the performance of the Garbage Collection(GC) of OpenJDK and  GraalVM. GraalVM is a popular open-source JVM implementation in Java with the capability to run applications as native images. Apart from that, it has got other functionalities such as fast loading time, compacted memory usage, etc.

In this article, we will compare the garbage collection details of GraalVM and OpenJDK.

Parallel Sort

Everyone knows about what sorting is. There are so many computer algorithms that have emerged to support sorting. Some of the well-known algorithms are quick sort, heap sort, merge sort, etc.

All these sorting algorithms work based on sequential sorting. This means a single thread is used to perform the complete sorting operation. However, this approach is quite useful when the requirement is to handle low to medium levels of data. For a huge dataset (in billions), sequential sorting does not scale well. This is where we need to use ‘Parallel sort.’

Parallelism in ConcurrentHashMap

ConcurrentHashMap is used extensively in multi-threaded applications. Examples of multi-threaded applications are online gaming applications and chat applications, which add the benefit of concurrency to the application. To make the application more concurrent in nature, ConcurrentHashMap introduces a concept called ‘Parallelism.’ 

In this article, we will learn more about parallelism in Concurrent Hashmaps.

A Simple HTTP Server in Java

Do you want to implement an HTTP server, but do you not want to take any risk of writing a full-fledged HTTP server? Developing an HTTP server with full capability is not a trivial task. But Java has got a solution to this kind of problem. Java supports an in-built HTTP server. By just writing 100 lines of code, we can develop a somewhat-decent HTTP server that can handle HTTP GET and POST requests. We can also leverage it to handle other HTTP commands as well.

HTTPServer class

Java SDK provides an in-built server called HttpServer. This class belongs to com.sun.net   package.