Benefits of Setting Initial and Maximum Memory Size to the Same Value

When we launch applications, we specify the initial memory size and maximum memory size. For the applications that run on JVM (Java Virtual Machine), initial and maximum memory size is specified through "-Xms" and "-Xmx" arguments. If Java applications are running on containers, it’s specified through "-XX: InitialRAMPercentage" and "-XX: MaxRAMPercentage" arguments. Most enterprises set the initial memory size to a lower value than the maximum memory size. As opposed to this commonly accepted practice, setting the initial memory size the same as the maximum memory size has certain "cool" advantages. Let’s discuss them in this post.

1. Availability

Suppose you are launching your application with the initial heap size to be 2GB and the maximum heap size to be 24GB. This means when the application starts, the operating system will allocate 2GB of memory to your application. From that point, as the application starts to process new requests, additional memory will be allocated until a maximum of 24GB is reached. 

Memory Leak Due To Improper Exception Handling

In this post, let’s discuss an interesting memory problem we confronted in the production environment and how we went about solving it. This application would take traffic for a few hours after that it would become unresponsive. It wasn’t clear what was causing the unresponsiveness in the application.

Technology Stack

This application was running on AWS cloud in r5a.2xlarge EC2 instances. It was a Java application running on an Apache Tomcat server using the Spring framework. It was also using other AWS services like S3 and Elastic Beanstalk. This application had a large heap size (i.e. -Xmx): 48GB.

How Many Millions of Dollars Do Enterprises Waste Due to Garbage Collection?

We truly believe enterprises are wasting millions of dollars in garbage collection. We equally believe enterprises are wasting these many millions of dollars even without knowing they are wasting. The intent of this post is to bring visibility to how several millions of dollars are wasted due to garbage collection.

What is Garbage?

All applications have a finite amount of memory. When a new request comes, the application creates objects to service the request. Once a request is processed, all the objects created to service that request are no longer needed. In other terms those objects become garbage. They have to be evicted/removed from the memory so that room is created to service new incoming requests.

Key Performance Measurements for App Servers: Cause, Impact, and Resolution

Below are some of the key metrics that need to be monitored during performance testing:

  • CPU utilization
  • Heap memory utilization
  • Number of active/daemon threads
  • Number of classes loaded
  • Server page faults/second
  • Cache hit ratio
  • Active total sessions
  • SSL transactions/second
  • Active/total DB pool connections
  • Application log
  • Load balancing
  • Requests/second

Let's take a look at some of the causes of negative impacts on performance testing and some quick resolutions that will help smooth everything out.

Best Practices: Java Memory Arguments for Containers

When running your Java application in physical servers, you would have been using ‘-Xmx’ JVM argument to specify the Java heap size. If you are porting your application to Containers, you might be wondering how to configure Java heap size in the container’s world? Are there any best practices? In this article, we will discuss the possible JVM arguments that can be used to specify the Java heap size and the best option to choose. 

There are 3 different options to specify the maximum Java heap size in containers. They are:

3 GC Techniques to Improve Application Performance

Automated garbage collection (along with the JIT HotSpot Compiler) is one of the most advanced and most valued components of the JVM, but many developers and engineers are far less familiar with Garbage Collection (GC), how it works and how it impacts application performance.

First, what is GC even for? Garbage collection is the memory management process for objects in the heap. As objects are allocated to the heap, they run through a few collection phases – usually rather quickly as the majority of objects in the heap have short lifespans.

Java Performance Optimization

Getting Java apps to run is one thing. But getting them to run fast is another. Performance is a tricky beast in any object-oriented environment, but the complexity of the JVM adds a whole new level of performance-tweaking trickiness — and opportunity. This Refcard covers garbage collection monitoring and tuning, memory leaks, object caching, concurrency, and more.

Memory Leak: Bit-Wise and Member-wise Copy in C++

Earlier versions of C++ (prior to release 1.2) implemented assignment between objects through bit-wise copy of the source to the destination. Consider the following example that illustrates a bit-wise copy.

C++


The main program has two objects of class MyString.

Understanding Types of References in Java

Learn more about the different types of references in Java.

There are four types of references in Java. And for each of them, the garbage collector behaves a little bit differently.

Below, I will try to explain each type of reference's characteristics and possible use cases, specifically strongweaksoft, and phantom references.

Why Global Variables Shouldn’t Be Very Global

One of the biggest blunders a JS developer can do make while writing code is declaring unnecessary global variables. Global variables are extremely helpful for programmers, but if they are not used carefully, they can rob the speed and efficiency of any browser.

Short Note

There are mainly two types of variables that are used in JS: local and global. Local variables are defined and used within a function, whereas global variables are defined for the function window. In short, until the code doesn’t terminate, global variables will be present, lurking in the background.