Download - JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk
![Page 1: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/1.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 1
![Page 2: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/2.jpg)
Use your current wisely Harvey Raja Oracle
Chris Neal Pegasus
![Page 3: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/3.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 3
§ Senior Engineer
§ Oracle Coherence
Introduction
Harvey Raja
![Page 4: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/4.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 4
§ Systems Architect
§ Pegasus Solutions
Introduction
Chris Neal
![Page 5: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/5.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 5 5 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
![Page 6: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/6.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 6
What’s all this about?
§ Big Data / Big Memory on a transistor diet
§ Applications and conceived concerns
§ Object Profiling
§ Elastic Data
§ Improvements
![Page 7: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/7.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 7
Heap me up
§ JVM manages our objects
§ Understands Live Data – References – Free Lists
new Object()
![Page 8: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/8.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 8
Heap me up
§ Two distinct regions of data locality – Young Generation – Old Generation
§ Allows conscious distinction between: – Long living objects – Short lived objects
![Page 9: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/9.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 9
Heap me up
§ All memory allocations are against the same resource
§ Why would it be any different?
§ Provides means to access – off-heap memory – File Descriptors a.k.a. any resource
![Page 10: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/10.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 10
Heap me up
JVM
100% 0%
0%
![Page 11: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/11.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 11
Applications & Their Objects
§ Every application has very different uses of objects – Size – Scope
§ Structures / Containers – Structures {Containers} – Containers {Structures}
![Page 12: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/12.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 12
Application Object Profiles
§ Ye olde faithful… Pet Store
§ Short-lived objects – Search Results
§ Long-living objects – Popular items
JEE Pet Store
JEE Pet Store
JEE Pet Store
JEE Pet Store
Pet Store
![Page 13: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/13.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 13
Application Object Profiles
§ Foreign Exchange Position Keeping
§ Aggregate Trades Values per currency pair
§ Some currencies are a ‘busier’
§ Currencies may have varying SLAs
FX Position Keeping
T
T
T
T
USD-GBP
USD-EUR
T
T T
T
T
T
T
T
T
T
T
T
![Page 14: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/14.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 14
What we know about applications?
§ The application understands more about each object than the JVM – Frequency – Size
§ Keeping everything in RAM is possible but is it efficient?
§ Huge Leap between Object on heap & stored in DB
- Recency - Custom characteristics of the object
![Page 15: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/15.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 15
Can the JVM just make the right choice?
§ The JVM would have to span multiple devices
§ Non-Heap must be serialized
§ Applications are diverse therefore to make generic decisions on object usage would likely lead to false-positives
§ Down to the application or a layer above the JVM allowing users to define resource assignment policies
![Page 16: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/16.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 16
Municipality
§ The application deems its own usage of each resource
§ JVM provides primitives to load & store to these devices
§ May be useful to have an API that performs this storage appropriate to the device:
– Routing stores to appropriate device – Handle concerns of multiple applications on the same JVM
![Page 17: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/17.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 17
CPU Architectures
§ As latency increases so does capacity
§ Data fetched as required by instructions
§ Data is demoted as well as writes to shared data rippling through the caches
![Page 18: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/18.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 18
CPU Architectures Speed Capacity
Registry 1ns 0.00
L1 Cache 2-5ns 2x32KB
L2 Cache 5ns 256KB
L3 Cache 20ns 8MB
Main Memory 20-60ns 16GB
Neh
alem
2G
HZ
pr
oces
sor
Mayfair
Kensington
Camden
Wimbledon
Manchester
§ Perhaps we should charge our objects rental premiums?
![Page 19: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/19.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 19
Blank Canvas
£600pcm
£1800pcm
£2400pcm
£100000pcm £100
Per TimeUnit £500
Per TimeUnit
£250 Per TimeUnit
£1000 Per TimeUnit
![Page 20: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/20.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 20
How do you choose the right property?
§ How do you select the right property: – How often are you in the office? – How long does it take you to get into the
office? – How much space do you occupy in the
office? – How do you get to the office?
– MFU – Device latency
– Object size
– Every device has its own
quirks
![Page 21: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/21.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 21
Translated to memory
USD -> GBP
USD-> JMD
Heap RAM (off heap)
Disk
GBP -> MUR
Usage
Pet store example
Pedigree Chum
Orijen
Dog Ugg boots
![Page 22: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/22.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 22
Translated to memory
§ Objects held on heap are: – Structures (Containers) – Containers (Structures)
§ Similar to a file descriptor, each object has its own metadata: – Access Time – Modified Time
§ With ((Map) Containers) we already have a location to store metadata
- Size - Touch Count
![Page 23: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/23.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 23
Translated to memory
CPU
Heap
NIO
Flash
Mechanical Disk
§ Each object has metadata
§ Some policy can manage these objects
§ Demoted & promoted to the various media types
§ Big jump from heap to NIO
![Page 24: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/24.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 24
Brainstorm Summary
§ Cherish your high commodity investments
§ Reduce the regularity of going to a highly contended foreign resource
§ Would be ideal to have objects float between high latency resources
using a telepathic API – Having some metadata could drive our decision for data locality
§ Map provides a nice abstraction for objects that should ripple
![Page 25: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/25.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 25
Challenges
§ Serialization cost
§ Generally interactions are performed against the object form
§ False Positives
§ Device type peculiarities
§ A handle to the object (key) and metadata must be held on heap
![Page 26: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/26.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 26
Elastic Data
§ A Feature in Coherence
§ Store binary key and value objects in RAM or Disk
§ Overflow from RAM to Disk
§ RAM can be configured as NIO
store(byte[] key, byte[] val)load(byte[] key)erase(byte[] key)
RAM
Flash
![Page 27: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/27.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 27
Elastic Data
§ Its simply writing a number of bytes to some stream?
§ How do you maintain handles?
§ Need a pointer to the written data?
§ How about updates, seek & replace?
Easy Peasy
![Page 28: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/28.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 28
Elastic Data
§ Require a compact structure to hold handles (keys) to device pointers
§ Journal writes to the file system
§ Consistent API regardless of write to RAM, NIO, Flash or Mechanical Disk
§ Buffer writes with thread dedicated to writing
Implementation Details
![Page 29: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/29.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 29
Elastic Data
FlashJournal
RAMJournal
CollectorOverflow
Preparer
Writer
Binary Key Pointer
0011010100111001001011
...
...Serialize
110101
LFU
Collector
Store Index
Object deemed unworthy of Heap
store(key, value)Pointer returned
Create
![Page 30: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/30.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 30
Elastic Data
FlashJournal
RAMJournal
CollectorOverflow
Preparer
Writer
Binary Key Pointer
0011010100111001001011
...
...
Collector
Store Index
Deserialize110101
Deserialized object returned
load(pointer)binary value
The binary key provides the physical location of the stored
item
Read
![Page 31: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/31.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 31
Elastic Data
Elastic Data
100% 100%
100%
Utilization
![Page 32: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/32.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 32
Elastic Data
§ RAM Journal can be used with NIO ByteBuffers – Memory managed using same mechanisms between RAM & Flash
§ Consider device specifics prior to use and design components / interactions accordingly
§ Multi-threaded clients
§ Flash vs Mechanical
More Features
![Page 33: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/33.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 33
Elastic Data
§ Several platters & reading / writing heads
§ Faraday & Lorentz
§ Seek time + Rotational Latency = L
§ Can not get to the same speeds as the disk controllers
Mechanical Media
![Page 34: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/34.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 34
Elastic Data
§ NAND gates
§ MLC
§ Write in pages erase in blocks
§ No Seek Time or Rotational Latency
Flash Media
![Page 35: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/35.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 35
Elastic Data
JVM handle *handle *handle *handle *handle *
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
01110111001101101010111010110100110101
handle *(disk pointer)
HARRIET *HARVEY *HILARY *HILTON *
Handles are stored in process
Number of handles constrains amount of
data that can be stored
Key Management
![Page 36: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/36.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 36
Elastic Data H
AR
RIET VEY
IL
ARY TON
HARRIETHARVEYHILARYHILTON
1 2 4 8Tickets:
§ Data structure to hold handles is a Binary Radix Tree
– allows sharing of common denominators
§ Handles (keys) are stored in serialized form
§ Benefit increases as common bytes increase and less heap memory is used
![Page 37: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/37.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 37
Elastic Data
§ Writes are journalled
§ Erase is a logical removal
§ Update = erase + write § Avoids seek time or cascading pointer
changes
write write
write
APPEND
APPEND
APPEND
erase
100111010100111100010111001101111010
100111010100111100010111001101111010
100111010100111100010111001101111010
100111010100111100010111001101111010
100111010100111100
100111010100111100010111001101111010
100111010100111100010111001101111010
100111010100111100010111001101111010
100111010100111100
100111010100111100010111001101111010
100111010100111100010111001101111010
100111010100111100010111001101111010
100111010100111100010111001101111010
100111010100111100
File 1
File 2
File 3
![Page 38: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/38.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 38
Elastic Data
§ Require a Journal Garbage Collector – Reclaim unreferenced memory
§ Evacuation process for each file
§ Eviction logically removes from Journal File
§ May enter an exhaustive mode – Synonymous to Full GC
1001110100111100010111001101111010100111101110011000
1001110100111100010111001101111010100111101110011000
1001110100111100010111001101111010100111101110011000
1001110100111100010111001101111010100111101110011000
1001110100111100010111001101111010100111101110011000
1001110100111100010111001101111010100111101110011000
1001110100111100010111001101111010100111101110011000
JournalCollector
sort
evacuate(exhaustive-
mode)
![Page 39: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/39.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 39
Elastic Data
§ Dedicated threads to unblock writes – Tuned to device type
§ Client write appears to be as fast as heap write
§ Overwhelming number of writes will result in push back to the client
Preparer Buffer
Writer
![Page 40: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/40.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 40
Who am I?
§ Chris Neal, Systems Architect § Started with Pegasus in 1994 § Worked with Coherence since 3.3.1 in 2007 § Participate in Coherence CAB
![Page 41: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/41.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 41
Who is Pegasus Solutions?
§ Founded in 1988 § Provide technology and services to hotels and travel distributors § Three main service areas:
– Representation Services – Distribution Services – Central Reservation Services (CRS)
![Page 42: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/42.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 42
Distribution Services
– Connects hotel systems with distribution partners. – 100,000 hotels connected to all major distributors (Expedia, Orbitz, Hotwire, Travelocity, etc) – Cheaper and easier than a direct connect – If you book a hotel online, chances are your transaction goes through Pegasus. – Pegasus processes roughly 8 billion transactions per month… sustained ~3000TPS @200ms
latency or less.
![Page 43: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/43.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 43
Why do we need a cache?
§ In travel agent days, “Look to book” ratios were 3:1 § At internet scale, they are roughly 4200:1
– Travel aggregators like Sidestep, Kayak, Mobissimo, etc burst this to >100,000:1
§ Looks are the most expensive transaction from systems processing perspective. § We make no money on “looks”, so saving resources by not processing these
transactions is important to both Pegasus and the downstream hotel systems. § …Hello Coherence….
![Page 44: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/44.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 44
Distribution Services and Coherence Physical deployment: – Production cluster consists of 6 servers, 144GB RAM each. – Each server runs 3 storage enabled JVMs – Servers run Solaris x64 – Each Hotspot JVM is 32GB – Using CMS collector, and having no GC pauses – The vast majority of the storage space is for AvailibilityCache (22GB) to service the “looks” Client Applications – ~120 storage disabled clients either in containers or stand alone – Backing store is so large that NearCache is disabled
![Page 45: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/45.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 45
The problem…
§ The cache is too small. Empty to full in ~3 hours. § Evicting valuable, usable data § Cache hit rate is too low
![Page 46: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/46.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 46
The Challenge….
§ Increase the cache size on the current servers from 20M to 200M § Spend as little money as possible § Do it by EOY
![Page 47: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/47.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 47
The Process…
§ “spend as little as possible” means adding servers to reach 200M is not possible, which means no more RAM.
§ Enter ElasticData § In terms of $, RAM > SSD > SATA, but is SATA fast enough?
![Page 48: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/48.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 48
iozone
§ Reads and writes a file to a filesystem as fast as it can § Compare SSD to SATA with regards to throughput § We know SSD is faster, but will SATA do?
www.iozone.org - Filesystem benchmark tool
![Page 49: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/49.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 49
SSD benchmark results
![Page 50: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/50.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 50
SATA benchmark results, part 1
![Page 51: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/51.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 51
SATA benchmark results, part 2
![Page 52: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/52.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 52
Elastic Data Hardware configuration
![Page 53: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/53.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 53
What we observe
§ At production volumes in RAM: – Avg get/put times ~2ms
§ At production volumes on SATA: – Avg put times ~3ms – Avg get times ~10ms
Benchmark data through the application
![Page 54: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/54.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 54
Hurdles We Have Overcome § Configuring the heap size:
– Enough room to store keys for 1.6TB of objects, so that Full GCs do not occur
– Enough room to store puts() while partitions are being evicted – 64GB (up to 72GB with G1)
§ Eviction killing throughput. Eviction process was reading the values from disk at it evicted (for indexes and listeners). Behavior was changed with BlindCompactSerializationCache.
§ Stopping a JVM: Transferring full partitions. Instead, drop the data, then transfer (DropContentPartitionListener)
§ Starting a JVM: Rebalancing partitions to the new JVM. (DropContentPartitionListener)
![Page 55: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/55.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 55
Configuring Coherence for Elastic Data § Operational overrides: <journaling-config> <ramjournal-manager> <minimum-load-factor>.4</minimum-load-factor> <maximum-size>8GB</maximum-size> </ramjournal-manager> <flashjournal-manager> <minimum-load-factor>.7</minimum-load-factor> <!-- 3.6TB filesystem size total / 2 JVMs is 1843GB each VM --> <!-- That gives 511 files @ 3690MB each per JVM --> <maximum-file-size>3690MB</maximum-file-size> <collector-timeout>30m</collector-timeout> <!-- 1600GB to force a more aggressive prune (same as high-units) --> <high-journal-size>1600GB</high-journal-size> </flashjournal-manager> </journaling-config>
![Page 56: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/56.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 56
Configuring Coherence for Elastic Data § Cache-config.xml <distributed-scheme> <backup-count>0</backup-count> <partition-listener> <class-name>com.tangosol.net.partition.DropContentPartitionListener</class-name> </partition-listener> <backing-map-scheme> <ramjournal-scheme> <class-name>com.tangosol.net.cache.BlindCompactSerializationCache</class-name> <high-units>1600KB</high-units> <low-units>1400KB</low-units> <unit-calculator>Binary</unit-calculator> <unit-factor>1048576</unit-factor> </ramjournal-scheme>
</backing-map-scheme> </distributed-scheme>
![Page 57: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/57.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 57
Garbage Collection settings argv[12]: -XX:+UseG1GC argv[13]: -XX:MaxGCPauseMillis=800 argv[14]: -XX:ConcGCThreads=10 argv[15]: -XX:ParallelGCThreads=10 argv[16]: -XX:InitiatingHeapOccupancyPercent=25 argv[17]: -XX:NewRatio=16
![Page 58: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/58.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 58
Did we meet our goals
§ Goal: 500M cached objects – Actual: 1.6B cached objects
§ Goal: Spend as little as possible – Actual: Spent 1400/machine (8640 total), 84x more objects
§ Goal: Do it by EOY – Actual: On track for production release before EOY
So far, so good…
![Page 59: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/59.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 59
Graphic Section Divider
![Page 60: JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap or Even on Disk](https://reader038.vdocuments.site/reader038/viewer/2022110308/5580fb77d8b42a9d198b4c5f/html5/thumbnails/60.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 60