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

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 

Kürzlich hochgeladen (20)

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 

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