SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Heap Off Memory

          WTF ??

Reducing Heap memory stress
Abstract
* Java memory fundamental

* heap off memory principles

* heap-off cache with Apache DirectMemory
/me
Olivier Lamy

* Open Source Architect @Talend Apache Team
* Apache Member : Maven, Archiva, Tomcat,
DirectMemory, Build Infra, etc..
* Jenkins
* Add bugs in various OpenSource projects
* twitter.com/olamy olamy.blogspot.com
Java Memory Fundamental
Java Memory Fundamental

                The cool part

* Automatic memory allocation (do you remember
when you used malloc)

* Garbage collector (GC) (no more free)
Java Memory Fundamental

                  The bad part

* stop-the-world mode

* proportionnal to memory's size

* unpredictable unresponsive application :
complicated with tight SLA
Heap Off Memory


Not in the Heap process

   Limited GC stop

 « Unlimited storage »
Heap Off Memory
              How to use that ?
           Native libraries with JNA
          https://github.com/twall/jna

        ByteBuffer @since 1.4 with nio
    ByteBuffer.allocate( size ) (not off heap)
        ByteBuffer.allocateDirect( size )

You can use sun.misc.Unsafe but can cause issue
               and not portable
Heap Off Memory
              How to use that ?

You can manipulate only Buffer (ByteBuffer byte[]
                    etc..) !

   So you must serialize/deserialize your datas

Maximum size with -XX:MaxDirectMemorySize=
Our use case : Cache


       RAM : 10-60 ns
 Network : 10000-30000 ns
SSD Disk : 70000-120000 ns
Disk : 3000000-10000000 ns

 Cache must use memory !
On-Heap Cache


           Objects stored by reference (no
                   de/serialisation)

GC storm effect when refreshing/removing objects!
Off-Heap Cache


 de/serialisation overhead (hopefully some very
       performant libraries exist for that)

Cache objects payload no more affecting GC
Solutions :


* Terracotta BigMemory (off-heap storage on
top of ehcache)

* Infinispan (by Jboss)

* Huge collections

* Apache DirectMemory
Apache Direct Memory


                    Goals :
Apache Direct Memory is a multi layered cache
   implementation featuring off-heap memory
storage to enable caching of java objects without
          degrading jvm performance.
Apache Direct Memory


Joined Apache Incubator end 2011
12 developpers ATM
Under development :
  Memory allocation service just rewrite
  APIs are subject to be changed and bugs to be
   found !
Design & principles


ByteBuffer.allocateDirect is the foundation of the
 cache
ByteBuffers are allocated in big chunk and
 splitted for internal use
Design & principles
Build on layers
  CachingService : serialize object (pluggable)

  MemoryManagerService: Compute
   ByteBuffer access

  ByteBufferAllocatorService: Eventually deals
   with ByteBuffer
ByteBuffers Allocation
Merging Strategy
  No memory wasted
  Suffers from fragmentation
  Need synchronization at de/allocation


Fixed Size buffers allocation
  Memory wasted if size not correctly configured
  No fragmentation
Use case (1)
Multi layers cache
Most used objects are cached on heap, the rest
 off-heap (maybe overflow to disk)
Sounds like ehcache with BigMemory
Hard coded class to use :
 net.sf.ehcache.store.offheap.OffHeapStore
So same package class name in Apache
 DirectMemory
 (https://jira.terracotta.org/jira/browse/EHC-940)
                       Demo
Use case (2)
Cache Server
« à la » memcache tru http(s)
But with a REST Api and written in Java
Client API available
Demo
> PUT /dm/cache/bordeaux HTTP/1.1
> Content-Type:text/plain
{"millesime":"2003","description":"so good so
 good"}
< HTTP/1.1 200 OK
< X-DirectMemory-SerializeSize: 58
< Content-Length: 0
> GET /dm/cache/bordeaux HTTP/1.1
> Accept:text/plain
< HTTP/1.1 200 OK
< Content-Type: text/plain
< Content-Length: 51
{"millesime":"2003","description":"so good so
 good"}
> DELETE /dm/cache/foo HTTP/1.1
Next Steps

JSR 107 ?
Benchmarks
Components Integration (Cassandra, Tomcat etc..)
Dynamic cache size modification
Management/Monitoring
Links
http://incubator.apache.org/directmemory/
https://issues.apache.org/jira/browse/DIRECTMEMORY
Demo project : https://bitbucket.org/olamy/heap-off-memory-
 wtf
Slides : http://www.slideshare.net/olamy
Thanks
  &&
Questions

Weitere ähnliche Inhalte

Was ist angesagt?

Caching Data For Performance
Caching Data For PerformanceCaching Data For Performance
Caching Data For PerformanceDave Ross
 
CHI - YAPC NA 2012
CHI - YAPC NA 2012CHI - YAPC NA 2012
CHI - YAPC NA 2012jonswar
 
Cache all the things - A guide to caching Drupal
Cache all the things - A guide to caching DrupalCache all the things - A guide to caching Drupal
Cache all the things - A guide to caching Drupaldigital006
 
MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011Graham Weldon
 
Memcached Presentation
Memcached PresentationMemcached Presentation
Memcached PresentationAsif Ali
 
High Performance Wordpress
High Performance WordpressHigh Performance Wordpress
High Performance WordpressGareth Davies
 
Building Scalable Web Apps - LVL.UP KL
Building Scalable Web Apps - LVL.UP KLBuilding Scalable Web Apps - LVL.UP KL
Building Scalable Web Apps - LVL.UP KLGareth Davies
 
Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and ScalabilityMediacurrent
 
Storage based snapshots for KVM VMs in CloudStack
Storage based snapshots for KVM VMs in CloudStackStorage based snapshots for KVM VMs in CloudStack
Storage based snapshots for KVM VMs in CloudStackShapeBlue
 
Varnish Configuration Step by Step
Varnish Configuration Step by StepVarnish Configuration Step by Step
Varnish Configuration Step by StepKim Stefan Lindholm
 
Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Justin Foell
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The SnailMarcus Deglos
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized DevelopmentAdam Culp
 
Travel with your mock server
Travel with your mock serverTravel with your mock server
Travel with your mock serverJorge Ortiz
 
Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77chhorn
 

Was ist angesagt? (20)

Caching Data For Performance
Caching Data For PerformanceCaching Data For Performance
Caching Data For Performance
 
CHI - YAPC NA 2012
CHI - YAPC NA 2012CHI - YAPC NA 2012
CHI - YAPC NA 2012
 
Cache all the things - A guide to caching Drupal
Cache all the things - A guide to caching DrupalCache all the things - A guide to caching Drupal
Cache all the things - A guide to caching Drupal
 
Tools for Metaspace
Tools for MetaspaceTools for Metaspace
Tools for Metaspace
 
MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011MySQL Performance - SydPHP October 2011
MySQL Performance - SydPHP October 2011
 
Memcached Presentation
Memcached PresentationMemcached Presentation
Memcached Presentation
 
High Performance Wordpress
High Performance WordpressHigh Performance Wordpress
High Performance Wordpress
 
Building Scalable Web Apps - LVL.UP KL
Building Scalable Web Apps - LVL.UP KLBuilding Scalable Web Apps - LVL.UP KL
Building Scalable Web Apps - LVL.UP KL
 
Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and Scalability
 
Storage based snapshots for KVM VMs in CloudStack
Storage based snapshots for KVM VMs in CloudStackStorage based snapshots for KVM VMs in CloudStack
Storage based snapshots for KVM VMs in CloudStack
 
Varnish Configuration Step by Step
Varnish Configuration Step by StepVarnish Configuration Step by Step
Varnish Configuration Step by Step
 
Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)
 
The SPDY Protocol
The SPDY ProtocolThe SPDY Protocol
The SPDY Protocol
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The Snail
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized Development
 
Travel with your mock server
Travel with your mock serverTravel with your mock server
Travel with your mock server
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale EnvironmentsCobbler, Func and Puppet: Tools for Large Scale Environments
Cobbler, Func and Puppet: Tools for Large Scale Environments
 
Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77Using cobbler in a not so small environment 1.77
Using cobbler in a not so small environment 1.77
 
Memcached
MemcachedMemcached
Memcached
 
Optimize drupal
Optimize drupalOptimize drupal
Optimize drupal
 

Andere mochten auch

Portfolio PlusAnimations 2009 NL
Portfolio PlusAnimations 2009 NLPortfolio PlusAnimations 2009 NL
Portfolio PlusAnimations 2009 NLrogiervanmeeuwen
 
Building a Mega Community with PressWork
Building a Mega Community with PressWorkBuilding a Mega Community with PressWork
Building a Mega Community with PressWorkBrendan Sera-Shriar
 
ISoLA 2010: SADI Taverna plug-in
ISoLA 2010:  SADI Taverna plug-inISoLA 2010:  SADI Taverna plug-in
ISoLA 2010: SADI Taverna plug-inMark Wilkinson
 
Semana de la biblioteca 2011 final
Semana de la biblioteca 2011 finalSemana de la biblioteca 2011 final
Semana de la biblioteca 2011 finalPaola Padilla
 
SWAT4LS 2011: SADI Knowledge Explorer Plug-in
SWAT4LS 2011: SADI Knowledge Explorer Plug-inSWAT4LS 2011: SADI Knowledge Explorer Plug-in
SWAT4LS 2011: SADI Knowledge Explorer Plug-inMark Wilkinson
 
Design Studio
Design StudioDesign Studio
Design Studiomilarepa1
 
How SADI & SHARE help restore the Scientific Method to in silico science
How SADI & SHARE help restore the Scientific Method to in silico scienceHow SADI & SHARE help restore the Scientific Method to in silico science
How SADI & SHARE help restore the Scientific Method to in silico scienceMark Wilkinson
 
Leveraging trade associations
Leveraging trade associationsLeveraging trade associations
Leveraging trade associationsSmartBrief
 
The Evolution of Live Preview Environment Design
The Evolution of Live Preview Environment DesignThe Evolution of Live Preview Environment Design
The Evolution of Live Preview Environment DesignBrendan Sera-Shriar
 
2007 11 07 Presentazione Ir In Asm
2007 11 07 Presentazione Ir In Asm2007 11 07 Presentazione Ir In Asm
2007 11 07 Presentazione Ir In Asmguest1201f4b
 
Cs For Mk Brochure[1]
Cs For Mk Brochure[1]Cs For Mk Brochure[1]
Cs For Mk Brochure[1]Jodi1269
 
¡LA BELLEZA DE LOS ARBOLES!
¡LA BELLEZA DE LOS ARBOLES!¡LA BELLEZA DE LOS ARBOLES!
¡LA BELLEZA DE LOS ARBOLES!pipis397
 
Glanz Industries, Inc.
Glanz Industries, Inc.Glanz Industries, Inc.
Glanz Industries, Inc.guest200ab0
 
Internet Protocol
Internet ProtocolInternet Protocol
Internet Protocolguesta8dc1
 

Andere mochten auch (20)

Portfolio PlusAnimations 2009 NL
Portfolio PlusAnimations 2009 NLPortfolio PlusAnimations 2009 NL
Portfolio PlusAnimations 2009 NL
 
PAPER 2 2010
PAPER 2 2010PAPER 2 2010
PAPER 2 2010
 
Building a Mega Community with PressWork
Building a Mega Community with PressWorkBuilding a Mega Community with PressWork
Building a Mega Community with PressWork
 
ISoLA 2010: SADI Taverna plug-in
ISoLA 2010:  SADI Taverna plug-inISoLA 2010:  SADI Taverna plug-in
ISoLA 2010: SADI Taverna plug-in
 
Gitools
GitoolsGitools
Gitools
 
Semana de la biblioteca 2011 final
Semana de la biblioteca 2011 finalSemana de la biblioteca 2011 final
Semana de la biblioteca 2011 final
 
SWAT4LS 2011: SADI Knowledge Explorer Plug-in
SWAT4LS 2011: SADI Knowledge Explorer Plug-inSWAT4LS 2011: SADI Knowledge Explorer Plug-in
SWAT4LS 2011: SADI Knowledge Explorer Plug-in
 
Design Studio
Design StudioDesign Studio
Design Studio
 
How SADI & SHARE help restore the Scientific Method to in silico science
How SADI & SHARE help restore the Scientific Method to in silico scienceHow SADI & SHARE help restore the Scientific Method to in silico science
How SADI & SHARE help restore the Scientific Method to in silico science
 
Tumor Type Search
Tumor Type SearchTumor Type Search
Tumor Type Search
 
Sin ropa
Sin ropaSin ropa
Sin ropa
 
Leveraging trade associations
Leveraging trade associationsLeveraging trade associations
Leveraging trade associations
 
Tutorial 1.1 - Import Intogen tumor types
Tutorial 1.1 - Import Intogen tumor typesTutorial 1.1 - Import Intogen tumor types
Tutorial 1.1 - Import Intogen tumor types
 
The Evolution of Live Preview Environment Design
The Evolution of Live Preview Environment DesignThe Evolution of Live Preview Environment Design
The Evolution of Live Preview Environment Design
 
2007 11 07 Presentazione Ir In Asm
2007 11 07 Presentazione Ir In Asm2007 11 07 Presentazione Ir In Asm
2007 11 07 Presentazione Ir In Asm
 
Cs For Mk Brochure[1]
Cs For Mk Brochure[1]Cs For Mk Brochure[1]
Cs For Mk Brochure[1]
 
Gene Search
Gene SearchGene Search
Gene Search
 
¡LA BELLEZA DE LOS ARBOLES!
¡LA BELLEZA DE LOS ARBOLES!¡LA BELLEZA DE LOS ARBOLES!
¡LA BELLEZA DE LOS ARBOLES!
 
Glanz Industries, Inc.
Glanz Industries, Inc.Glanz Industries, Inc.
Glanz Industries, Inc.
 
Internet Protocol
Internet ProtocolInternet Protocol
Internet Protocol
 

Ähnlich wie Heapoff memory wtf

Jug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsJug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsDavide Carnevali
 
Scale ColdFusion with Terracotta Distributed Caching for Ehchache
Scale ColdFusion with Terracotta Distributed Caching for EhchacheScale ColdFusion with Terracotta Distributed Caching for Ehchache
Scale ColdFusion with Terracotta Distributed Caching for EhchacheColdFusionConference
 
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionAdvanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionColdFusionConference
 
Caching technology comparison
Caching technology comparisonCaching technology comparison
Caching technology comparisonRohit Kelapure
 
Java and cgroups eng
Java and cgroups engJava and cgroups eng
Java and cgroups engRalf Ernst
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APCBen Ramsey
 
HBase: Extreme Makeover
HBase: Extreme MakeoverHBase: Extreme Makeover
HBase: Extreme MakeoverHBaseCon
 
Caching principles-solutions
Caching principles-solutionsCaching principles-solutions
Caching principles-solutionspmanvi
 
Java programing considering performance
Java programing considering performanceJava programing considering performance
Java programing considering performanceRoger Xia
 
Caching technology comparison
Caching technology comparisonCaching technology comparison
Caching technology comparisonRohit Kelapure
 
Inside The Java Virtual Machine
Inside The Java Virtual MachineInside The Java Virtual Machine
Inside The Java Virtual Machineelliando dias
 
Developing High Performance and Scalable ColdFusion Application Using Terraco...
Developing High Performance and Scalable ColdFusion Application Using Terraco...Developing High Performance and Scalable ColdFusion Application Using Terraco...
Developing High Performance and Scalable ColdFusion Application Using Terraco...ColdFusionConference
 
Developing High Performance and Scalable ColdFusion Applications Using Terrac...
Developing High Performance and Scalable ColdFusion Applications Using Terrac...Developing High Performance and Scalable ColdFusion Applications Using Terrac...
Developing High Performance and Scalable ColdFusion Applications Using Terrac...Shailendra Prasad
 
Exploring .NET memory management - JetBrains webinar
Exploring .NET memory management - JetBrains webinarExploring .NET memory management - JetBrains webinar
Exploring .NET memory management - JetBrains webinarMaarten Balliauw
 
OOPs, OOMs, oh my! Containerizing JVM apps
OOPs, OOMs, oh my! Containerizing JVM appsOOPs, OOMs, oh my! Containerizing JVM apps
OOPs, OOMs, oh my! Containerizing JVM appsSematext Group, Inc.
 

Ähnlich wie Heapoff memory wtf (20)

Jug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsJug Lugano - Scale over the limits
Jug Lugano - Scale over the limits
 
Scale ColdFusion with Terracotta Distributed Caching for Ehchache
Scale ColdFusion with Terracotta Distributed Caching for EhchacheScale ColdFusion with Terracotta Distributed Caching for Ehchache
Scale ColdFusion with Terracotta Distributed Caching for Ehchache
 
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionAdvanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
 
Caching technology comparison
Caching technology comparisonCaching technology comparison
Caching technology comparison
 
Java and cgroups eng
Java and cgroups engJava and cgroups eng
Java and cgroups eng
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APC
 
HBase: Extreme Makeover
HBase: Extreme MakeoverHBase: Extreme Makeover
HBase: Extreme Makeover
 
Mini-Training: To cache or not to cache
Mini-Training: To cache or not to cacheMini-Training: To cache or not to cache
Mini-Training: To cache or not to cache
 
My Old Friend Malloc
My Old Friend MallocMy Old Friend Malloc
My Old Friend Malloc
 
Caching principles-solutions
Caching principles-solutionsCaching principles-solutions
Caching principles-solutions
 
Java programing considering performance
Java programing considering performanceJava programing considering performance
Java programing considering performance
 
Caching technology comparison
Caching technology comparisonCaching technology comparison
Caching technology comparison
 
Inside The Java Virtual Machine
Inside The Java Virtual MachineInside The Java Virtual Machine
Inside The Java Virtual Machine
 
Developing High Performance and Scalable ColdFusion Application Using Terraco...
Developing High Performance and Scalable ColdFusion Application Using Terraco...Developing High Performance and Scalable ColdFusion Application Using Terraco...
Developing High Performance and Scalable ColdFusion Application Using Terraco...
 
Developing High Performance and Scalable ColdFusion Applications Using Terrac...
Developing High Performance and Scalable ColdFusion Applications Using Terrac...Developing High Performance and Scalable ColdFusion Applications Using Terrac...
Developing High Performance and Scalable ColdFusion Applications Using Terrac...
 
Rails caching
Rails cachingRails caching
Rails caching
 
Exploring .NET memory management - JetBrains webinar
Exploring .NET memory management - JetBrains webinarExploring .NET memory management - JetBrains webinar
Exploring .NET memory management - JetBrains webinar
 
Javasession10
Javasession10Javasession10
Javasession10
 
JBUG.be Infinispan
JBUG.be InfinispanJBUG.be Infinispan
JBUG.be Infinispan
 
OOPs, OOMs, oh my! Containerizing JVM apps
OOPs, OOMs, oh my! Containerizing JVM appsOOPs, OOMs, oh my! Containerizing JVM apps
OOPs, OOMs, oh my! Containerizing JVM apps
 

Mehr von Olivier Lamy

Maven university-course
Maven university-courseMaven university-course
Maven university-courseOlivier Lamy
 
The Apache Way olamy
The Apache Way olamyThe Apache Way olamy
The Apache Way olamyOlivier Lamy
 
Juc paris olivier lamy talk
Juc paris olivier lamy talkJuc paris olivier lamy talk
Juc paris olivier lamy talkOlivier Lamy
 
Direct memory @ devoxxfr
Direct memory @ devoxxfrDirect memory @ devoxxfr
Direct memory @ devoxxfrOlivier Lamy
 
Tomcat Maven Plugin
Tomcat Maven PluginTomcat Maven Plugin
Tomcat Maven PluginOlivier Lamy
 

Mehr von Olivier Lamy (6)

Apache sirona
Apache sironaApache sirona
Apache sirona
 
Maven university-course
Maven university-courseMaven university-course
Maven university-course
 
The Apache Way olamy
The Apache Way olamyThe Apache Way olamy
The Apache Way olamy
 
Juc paris olivier lamy talk
Juc paris olivier lamy talkJuc paris olivier lamy talk
Juc paris olivier lamy talk
 
Direct memory @ devoxxfr
Direct memory @ devoxxfrDirect memory @ devoxxfr
Direct memory @ devoxxfr
 
Tomcat Maven Plugin
Tomcat Maven PluginTomcat Maven Plugin
Tomcat Maven Plugin
 

Kürzlich hochgeladen

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 

Kürzlich hochgeladen (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 

Heapoff memory wtf

  • 1. Heap Off Memory WTF ?? Reducing Heap memory stress
  • 2. Abstract * Java memory fundamental * heap off memory principles * heap-off cache with Apache DirectMemory
  • 3. /me Olivier Lamy * Open Source Architect @Talend Apache Team * Apache Member : Maven, Archiva, Tomcat, DirectMemory, Build Infra, etc.. * Jenkins * Add bugs in various OpenSource projects * twitter.com/olamy olamy.blogspot.com
  • 5. Java Memory Fundamental The cool part * Automatic memory allocation (do you remember when you used malloc) * Garbage collector (GC) (no more free)
  • 6. Java Memory Fundamental The bad part * stop-the-world mode * proportionnal to memory's size * unpredictable unresponsive application : complicated with tight SLA
  • 7. Heap Off Memory Not in the Heap process Limited GC stop « Unlimited storage »
  • 8. Heap Off Memory How to use that ? Native libraries with JNA https://github.com/twall/jna ByteBuffer @since 1.4 with nio ByteBuffer.allocate( size ) (not off heap) ByteBuffer.allocateDirect( size ) You can use sun.misc.Unsafe but can cause issue and not portable
  • 9. Heap Off Memory How to use that ? You can manipulate only Buffer (ByteBuffer byte[] etc..) ! So you must serialize/deserialize your datas Maximum size with -XX:MaxDirectMemorySize=
  • 10. Our use case : Cache RAM : 10-60 ns Network : 10000-30000 ns SSD Disk : 70000-120000 ns Disk : 3000000-10000000 ns Cache must use memory !
  • 11. On-Heap Cache Objects stored by reference (no de/serialisation) GC storm effect when refreshing/removing objects!
  • 12. Off-Heap Cache de/serialisation overhead (hopefully some very performant libraries exist for that) Cache objects payload no more affecting GC
  • 13. Solutions : * Terracotta BigMemory (off-heap storage on top of ehcache) * Infinispan (by Jboss) * Huge collections * Apache DirectMemory
  • 14. Apache Direct Memory Goals : Apache Direct Memory is a multi layered cache implementation featuring off-heap memory storage to enable caching of java objects without degrading jvm performance.
  • 15. Apache Direct Memory Joined Apache Incubator end 2011 12 developpers ATM Under development : Memory allocation service just rewrite APIs are subject to be changed and bugs to be found !
  • 16. Design & principles ByteBuffer.allocateDirect is the foundation of the cache ByteBuffers are allocated in big chunk and splitted for internal use
  • 17. Design & principles Build on layers CachingService : serialize object (pluggable) MemoryManagerService: Compute ByteBuffer access ByteBufferAllocatorService: Eventually deals with ByteBuffer
  • 18. ByteBuffers Allocation Merging Strategy No memory wasted Suffers from fragmentation Need synchronization at de/allocation Fixed Size buffers allocation Memory wasted if size not correctly configured No fragmentation
  • 19. Use case (1) Multi layers cache Most used objects are cached on heap, the rest off-heap (maybe overflow to disk) Sounds like ehcache with BigMemory Hard coded class to use : net.sf.ehcache.store.offheap.OffHeapStore So same package class name in Apache DirectMemory (https://jira.terracotta.org/jira/browse/EHC-940) Demo
  • 20. Use case (2) Cache Server « à la » memcache tru http(s) But with a REST Api and written in Java Client API available Demo
  • 21. > PUT /dm/cache/bordeaux HTTP/1.1 > Content-Type:text/plain {"millesime":"2003","description":"so good so good"} < HTTP/1.1 200 OK < X-DirectMemory-SerializeSize: 58 < Content-Length: 0 > GET /dm/cache/bordeaux HTTP/1.1 > Accept:text/plain < HTTP/1.1 200 OK < Content-Type: text/plain < Content-Length: 51 {"millesime":"2003","description":"so good so good"} > DELETE /dm/cache/foo HTTP/1.1
  • 22. Next Steps JSR 107 ? Benchmarks Components Integration (Cassandra, Tomcat etc..) Dynamic cache size modification Management/Monitoring
  • 23. Links http://incubator.apache.org/directmemory/ https://issues.apache.org/jira/browse/DIRECTMEMORY Demo project : https://bitbucket.org/olamy/heap-off-memory- wtf Slides : http://www.slideshare.net/olamy