Tuesday, March 4, 2014

Heap Memory Demystified

Memory pool

Memory Pool in JVM is divided into two main areas:
1. Heap Memory
2. Non-Heap Memory

Heap memory

The heap memory is the runtime data area from which the Java VM allocates memory for all class instances and arrays. The heap may be of a fixed or variable size. The garbage collector is an automatic memory management system that reclaims heap memory for objects.
  • Eden Space: The pool from which memory is initially allocated for most objects.
  • Survivor Space (Young Generation): The pool containing objects that have survived the garbage collection of the Eden space.
  • Tenured Generation (Old Generation): The pool containing objects that have existed for some time in the survivor space.

Non-heap memory

Non-heap memory includes a method area shared among all threads and memory required for the internal processing or optimization for the Java VM. It stores per-class structures such as a runtime constant pool, field and method data, and the code for methods and constructors. The method area is logically part of the heap but, depending on the implementation, a Java VM may not garbage collect or compact it. Like the heap memory, the method area may be of a fixed or variable size. The memory for the method area does not need to be contiguous.
  • Permanent Generation: The pool containing all the reflective data of the virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas.
  • Code Cache: The HotSpot Java VM also includes a code cache, containing memory that is used for compilation and storage of native code.

Thursday, January 23, 2014

Coherence Web Cache in webshphere

Coherence*Web is an HTTP session management module dedicated to managing session state in clustered environments. Built on top of Coherence, Coherence*Web: brings Coherence data grid’s data scalability, availability, reliability, and performance to in-memory session management and storage; allows storage of session data outside of the Java EE application server, freeing application server heap space and enabling server restarts without session data loss; enables session sharing and management across different Web applications, domains and application servers. More information can be found in the post Setting-up a WebLogic Cluster that uses Coherence.
ActiveCache is employed by applications running on WebLogic Server and provides replicated and distributed caching services that make an application’s data available to servers in a Coherence data cluster. ActiveCache provides direct access by applications to data caches, either through resource injection or component-based JNDI lookup, and lets us display, monitor, create, and configure Coherence clusters using the WebLogic Server Administration Console and WLST.
- See more at: http://middlewaremagic.com/weblogic/?p=8351#sthash.mus5EgxS.dpuf

UDP (User Datagram Protocol)vs TCP

UDP (User Datagram Protocol) is a communications protocol that offers a limited amount of service when messages are exchanged between computers in a network that uses the Internet Protocol (IP). UDP is an alternative to the Transmission Control Protocol (TCP) and, together with IP, is sometimes referred to as UDP/IP. Like the Transmission Control Protocol, UDP uses the Internet Protocol to actually get a data unit (called a datagram) from one computer to another. Unlike TCP, however, UDP does not provide the service of dividing a message into packets (datagrams) and reassembling it at the other end. Specifically, UDP doesn't provide sequencing of the packets that the data arrives in. This means that the application program that uses UDP must be able to make sure that the entire message has arrived and is in the right order. Network applications that want to save processing time because they have very small data units to exchange (and therefore very little message reassembling to do) may prefer UDP to TCP. The Trivial File Transfer Protocol (TFTP) uses UDP instead of TCP.
UDP provides two services not provided by the IP layer. It provides port numbers to help distinguish different user requests and, optionally, a checksum capability to verify that the data arrived intact.