Distributed In-Memory JVM Cache
Distributed In-Memory JVM Cache
ISSN: 2321-8169
Volume: 4 Issue: 4
72 - 75
___________________________________________________________________________________________________________________
__________________________________________________*****_________________________________________________
I. INTRODUCTION
Consider a database table which we want to load into java
memory. This table is huge consisting of a large number of
rows and 50 columns. Since this whole table won't fit into a
single Java Virtual Machine's memory we would like to divide
it into small partitions and load them in multiple Java Virtual
Machines situated on different machines. Since we are now
relying on multiple machines we need to introduce replication
of these partitions so that failure cases are handled. We can
follow the HDFS concepts of name node and data nodes.
72
IJRITCC | April 2016, Available @ http://www.ijritcc.org
____________________________________________________________________________________________________
C. HDFS architecture
Level and number
of rows
Level 0 (1 row)
Level 1 (50 rows)
Number of
mappers/reducers
1 reducer
1 mapper, 1
reducer
2 mappers, 2
reducers
4 mappers
Number of threads
to be spawned
1 thread
1 thread for each
pair
2 threads
Level 2 (1500
rows)
Level 3 (15 lac
4 threads
rows)
Total 8 threads are required for executing a rollup of a user.
Observations:
2 GB
2 GB
JVM mode
Server
JDK
1.6.0.27- 64 bit
DataCube Information:
No. of dimensions
1
No. of measures
[numeric, string,
string]
Figure II-6: 3 user rollup
73
____________________________________________________________________________________________________
Storage:
The blocks of data are stored on off heap. The on-heap store
refers to objects that will be present in the Java heap (and also
subject to GC). On the other hand, the off-heap store refers to
(serialized) objects, but stored outside the heap (and also not
subject to GC). As the off-heap store continues to be managed
in memory, it is slightly slower than the on-heap store, but still
faster than the disk store. Off heap memory is represented as
buckets which contain pages. There could be memory holes
(Internal defragmentation). Internal fragmentation occurs when
extra space is left empty inside of a block of memory that has
been allocated for a client. This usually happens because the
processors design stipulates that memory must be cut into
blocks of certain sizes -- for example, blocks may be required
to be evenly be divided by four, eight or 16 bytes. When this
occurs, a client that needs 57 bytes of memory, for example,
may be allocated a block that contains 60 bytes, or even 64.
The extra bytes that the client doesnt need go to waste, and
over time these tiny chunks of unused memory can build up
and create large quantities of memory that cant be put to use
by the allocator. Because all of these useless bytes are inside
larger memory blocks, the fragmentation is considered internal.
III. DESIGN
Communication between nodes:
The communication between nodes is achieved using netty.
[3]Netty is an asynchronous event-driven network application
framework for rapid development of maintainable high
performance protocol servers & clients. It greatly simplifies
and streamlines network programming such as TCP and UDP
socket server. It has a unified API for various transport types blocking and non-blocking socket. The communication is
passing of events over the wire using Kryonet. KryoNet is a
Java library that provides a clean and simple API for efficient
TCP and UDP client/server network communication using
NIO. KryoNet uses the [4]Kryo serialization library to
automatically and efficiently transfer object graphs across the
network. Each event has a handler which handles the particular
event. The communicator has a queue of events which are to be
processed. These events are executed in a global eventexecutor
which is a fixed/scheduled thread pool. This thread pool
contains a limited number of threads. Events for example on
NameNode can be
DATA_NODE_REGISTRATION,
HEARTBEAT,
LOCATE_BLOCK,
ADD_BLOCK,
CHECK_REPLICATION.
Asynchronous
event
when
submitted a Future object[5] is returned and hence the current
thread is not blocked. A Future represents the result of an
asynchronous computation. Methods are provided to check if
____________________________________________________________________________________________________
75
IJRITCC | April 2016, Available @ http://www.ijritcc.org
____________________________________________________________________________________________________