SlideShare a Scribd company logo
1 of 20
Download to read offline
Usha Upadhyayula & Piotr Balcer
Intel Data Center Group
SPDK, PMDK & Vtune™ Summit
Agenda
• Why Use Persistent Memory as Volatile
• How to Create Volatile Region over
Persistent Memory
▪ libmemkind
▪ libvmemcache
2
SPDK, PMDK & Intel® VTune™ Amplifier Summit 3
ModesataGlance
• Memory Mode (volatile Memory)
• Data Placement
• Application does not have control
over data placement between
DRAM and Intel Persistent
Memory
• Ease of adoption: No Code Changes
• Performance slower than DRAM
• App Direct Mode (persistent memory)
• Data Placement
• Application has control over data
placement between DRAM and Intel
Persistent Memory
• Ease of Adoption: Need to Re-architect
Application
• Performance at Native hardware latencies
APPLICATION
VOLATILE MEMORY POOL
O P T A N E P E R S I S T E N T M E M O R Y
D R A M A S C A C H E
APPLICATION
OPTANE PERSISTENT
MEMORY
DRAM
SPDK, PMDK & Intel® VTune™ Amplifier Summit 4
Motivation
• Application Controlled Data Placement
• Has Different Tiers of Data
• Opportunity to use Bigger and Cheaper Volatile Memory than DRAM
• Persistence not Required
• Reduce Development Effort
SPDK, PMDK & Vtune™ Summit 5
Whatislibmemkind
DRAM
Unified Memory Management
High BW
Memory
Intel® Optane™ DC
Persistent Memory
Distros
Allocator Familiar API
stdlib like API
Availability
https://github.com/memkindJeMalloc 5.0
SPDK, PMDK & Intel® VTune™ Amplifier Summit 6
HowDoesitWORK
• pmem kind is file-backed
• Temp file created on DAX-enabled
filesystem
• Temp file is memory mapped into
application virtual address space
• Temp file deleted when application
terminates
• Jemalloc manages memory allocation from
this address space
libmemkind is a Wrapper; Jemalloc Manages Heap
SPDK, PMDK & Intel® VTune™ Amplifier Summit 7
MemkindAPI
Heap Management API
• void *memkind_malloc(memkind_t kind, size_t size )
• void *memkind_calloc(memkind_t kind, size_t num, size_t size )
• void *memkind_realloc(memkind_t kind, void *ptr, size_t size )
• void memkind_free(memkind_t kind, void *ptr )
• memkind_t memkind_detect_kind(void *ptr )
Persistent Memory API
• int memkind_create_pmem(const char *dir , size_t max_size , memkind_t *kind
• int memkind_destroy_kind(memkind_t kind )
SPDK, PMDK & Intel® VTune™ Amplifier Summit 8
int main(int argc, char *argv[])
{
struct memkind *pmem_kind = NULL;
memkind_create_pmem(“/mnt/pmem”, 0, &pmem_kind);
char * ptr_default = (char *)memkind_malloc(MEMKIND_DEFAULT, size); //allocate in DRAM
char * ptr_pmem = (char *)memkind_malloc(pmem_kind, size); //allocate in PMEM
memkind_free(MEMKIND_DEFAULT, ptr_default);
memkind_free(pmem_kind, ptr_pmem);
memkind_destroy_kind(pmem_kind);
return 0;
}
Example-allocationtoDRAMandPMEM
SPDK, PMDK & Intel® VTune™ Amplifier Summit 9
• Manage Fragmentation with Memory Usage Policy
• void memkind_config_set_memory_usage_policy(struct memkind_config *cfg,
memkind_mem_usage_policy policy )
• MEMKIND_MEM_USAGE_POLICY_DEFAULT – default memory usage policy
• MEMKIND_MEM_USAGE_POLICY_CONSERVATIVE – prioritize memory usage at cost of
performance
ManagingFragmentation
Trade off between Memory Usage vs CPU Utilization
SPDK, PMDK & Intel® VTune™ Amplifier Summit 10
Fragmentation
0.5
2.5
4.5
6.5
8.5
10.5
12.5
14.5
1
4…
9…
1…
1…
2…
2…
3…
3…
4…
4…
5…
5…
6…
6…
7…
7…
8…
8…
9…
9…
1…
1…
1…
1…
1…
1…
1…
1…
1…
1…
1…
1…
1…
1…
1…
1…
Fragmentationpercentage
Number of allocations
Fragmentation
MEMKIND_MEM_USAGE_POLICY_DEFAULT MEMKIND_MEM_USAGE_POLICY_CONSERVATIVE
SPDK, PMDK & Intel® VTune™ Amplifier Summit 11
Summary
• libmemkind Provides
• Unified memory management across different “kinds of memory”
• Familiar API to manage different kinds of memory
• Tutorial and Code Samples
• https://software.intel.com/en-us/articles/use-memkind-to-manage-volatile-
memory-on-intel-optane-persistent-memory
• https://github.com/memkind/memkind/tree/master/examples
https://github.com/memkind
libvmemcachePiotr Balcer
<piotr.balcer@intel.com>
Intel® Data Center Group
SPDK, PMDK & Vtune™ Summit
Problemstatement
Local LRU cache
Support for large capacities available with persistent memory (many terabytes per server)
Lightweight, efficient and embeddable
In-memory
Scalable
13
SPDK, PMDK & Vtune™ Summit
Existingsolutions
In-memory databases tend to rely on malloc() in some form for allocating memory for
entries
▪ Which means allocating anonymous memory
Persistent Memory is exposed by the operating system through normal file-system
operations
▪ Which means allocating byte-addressable PMEM needs to use file memory mapping
(fsdax).
We could modify the allocator of an existing in-memory database and be done with it,
right? ☺
14
SPDK, PMDK & Vtune™ Summit 15
Fragmentation
Manual dynamic memory management a’la
dlmalloc/jemalloc/tcmalloc/palloc causes
fragmentation
Applications with substantial expected
runtime durations need a way to combat this
problem
▪ Compacting GC (Java, .NET)
▪ Defragmentation (Redis, Apache Ignite)
▪ Slab allocation (memcached)
Especially so if there’s substantial expected
variety in allocated sizes
SPDK, PMDK & Vtune™ Summit 16
Extentallocation
If fragmentation is unavoidable, and
defragmentation/compacting is CPU and
memory bandwidth intensive, let’s embrace it!
Usually only done in relatively large blocks in
file-systems.
But on PMEM, we are no longer restricted by
large transfer units (sectors, pages etc)
SPDK, PMDK & Vtune™ Summit 17
Scalablereplacementpolicy
Performance of libvmemcache was
bottlenecked by naïve implementation of
LRU based on a doubly-linked list.
With 100st of threads, most of the time of
any request was spent
waiting on a list lock…
Locking per-node doesn’t solve the
problem…
SPDK, PMDK & Vtune™ Summit 18
BufferedLRU
Our solution was quite simple.
We’ve added a non-blocking ring-buffer
which buffers the list-move operations
This way, the list only needs to get locked
during eviction or when the ring-buffer is
full.
SPDK, PMDK & Vtune™ Summit
Lightweight,embeddable,in-memorycaching
https://github.com/pmem/vmemcache
VMEMcache *cache = vmemcache_new("/tmp", VMEMCACHE_MIN_POOL,
VMEMCACHE_MIN_EXTENT, VMEMCACHE_REPLACEMENT_LRU);
const char *key = "foo";
vmemcache_put(cache, key, strlen(key), "bar", sizeof("bar"));
char buf[128];
ssize_t len = vmemcache_get(cache, key, strlen(key),
buf, sizeof(buf), 0, NULL);
vmemcache_delete(cache);
libvmemcache has normal get/put APIs, optional replacement policy, and configurable extent
size. Works with terabyte-sized in-memory workloads without a sweat, with very high space
utilization. Also works on regular DRAM.
19
Volatile Uses for Persistent Memory

More Related Content

What's hot

Ceph Day Shanghai - Recovery Erasure Coding and Cache Tiering
Ceph Day Shanghai - Recovery Erasure Coding and Cache TieringCeph Day Shanghai - Recovery Erasure Coding and Cache Tiering
Ceph Day Shanghai - Recovery Erasure Coding and Cache Tiering
Ceph Community
 

What's hot (18)

Create C++ Applications with the Persistent Memory Development Kit
Create C++ Applications with the Persistent Memory Development KitCreate C++ Applications with the Persistent Memory Development Kit
Create C++ Applications with the Persistent Memory Development Kit
 
Ceph Day Beijing - SPDK for Ceph
Ceph Day Beijing - SPDK for CephCeph Day Beijing - SPDK for Ceph
Ceph Day Beijing - SPDK for Ceph
 
Ceph Day Beijing - Our journey to high performance large scale Ceph cluster a...
Ceph Day Beijing - Our journey to high performance large scale Ceph cluster a...Ceph Day Beijing - Our journey to high performance large scale Ceph cluster a...
Ceph Day Beijing - Our journey to high performance large scale Ceph cluster a...
 
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack CloudJourney to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
 
Ceph Day Beijing - Ceph All-Flash Array Design Based on NUMA Architecture
Ceph Day Beijing - Ceph All-Flash Array Design Based on NUMA ArchitectureCeph Day Beijing - Ceph All-Flash Array Design Based on NUMA Architecture
Ceph Day Beijing - Ceph All-Flash Array Design Based on NUMA Architecture
 
IMCSummit 2015 - Day 1 Developer Session - The Science and Engineering Behind...
IMCSummit 2015 - Day 1 Developer Session - The Science and Engineering Behind...IMCSummit 2015 - Day 1 Developer Session - The Science and Engineering Behind...
IMCSummit 2015 - Day 1 Developer Session - The Science and Engineering Behind...
 
Revisiting CephFS MDS and mClock QoS Scheduler
Revisiting CephFS MDS and mClock QoS SchedulerRevisiting CephFS MDS and mClock QoS Scheduler
Revisiting CephFS MDS and mClock QoS Scheduler
 
Ceph Day Beijing - Ceph RDMA Update
Ceph Day Beijing - Ceph RDMA UpdateCeph Day Beijing - Ceph RDMA Update
Ceph Day Beijing - Ceph RDMA Update
 
MySQL Head-to-Head
MySQL Head-to-HeadMySQL Head-to-Head
MySQL Head-to-Head
 
Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph
 
Ceph Day Shanghai - Recovery Erasure Coding and Cache Tiering
Ceph Day Shanghai - Recovery Erasure Coding and Cache TieringCeph Day Shanghai - Recovery Erasure Coding and Cache Tiering
Ceph Day Shanghai - Recovery Erasure Coding and Cache Tiering
 
Using Recently Published Ceph Reference Architectures to Select Your Ceph Con...
Using Recently Published Ceph Reference Architectures to Select Your Ceph Con...Using Recently Published Ceph Reference Architectures to Select Your Ceph Con...
Using Recently Published Ceph Reference Architectures to Select Your Ceph Con...
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4
 
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDS
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDSAccelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDS
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDS
 
JetStor portfolio update final_2020-2021
JetStor portfolio update final_2020-2021JetStor portfolio update final_2020-2021
JetStor portfolio update final_2020-2021
 
optimizing_ceph_flash
optimizing_ceph_flashoptimizing_ceph_flash
optimizing_ceph_flash
 
Linux internals for Database administrators at Linux Piter 2016
Linux internals for Database administrators at Linux Piter 2016Linux internals for Database administrators at Linux Piter 2016
Linux internals for Database administrators at Linux Piter 2016
 
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
 

Similar to Volatile Uses for Persistent Memory

Accelerate Your Apache Spark with Intel Optane DC Persistent Memory
Accelerate Your Apache Spark with Intel Optane DC Persistent MemoryAccelerate Your Apache Spark with Intel Optane DC Persistent Memory
Accelerate Your Apache Spark with Intel Optane DC Persistent Memory
Databricks
 
DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI ConvergenceDAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
inside-BigData.com
 
SOUG_SDM_OracleDB_V3
SOUG_SDM_OracleDB_V3SOUG_SDM_OracleDB_V3
SOUG_SDM_OracleDB_V3
UniFabric
 
Apache Spark At Scale in the Cloud
Apache Spark At Scale in the CloudApache Spark At Scale in the Cloud
Apache Spark At Scale in the Cloud
Databricks
 
Apache Spark At Scale in the Cloud
Apache Spark At Scale in the CloudApache Spark At Scale in the Cloud
Apache Spark At Scale in the Cloud
Rose Toomey
 
computer system embedded system volume1.ppt
computer system embedded system volume1.pptcomputer system embedded system volume1.ppt
computer system embedded system volume1.ppt
mshanajoel6
 

Similar to Volatile Uses for Persistent Memory (20)

AMD EPYC™ Microprocessor Architecture
AMD EPYC™ Microprocessor ArchitectureAMD EPYC™ Microprocessor Architecture
AMD EPYC™ Microprocessor Architecture
 
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...
 
C++ Programming and the Persistent Memory Developers Kit
C++ Programming and the Persistent Memory Developers KitC++ Programming and the Persistent Memory Developers Kit
C++ Programming and the Persistent Memory Developers Kit
 
SanDisk: Persistent Memory and Cassandra
SanDisk: Persistent Memory and CassandraSanDisk: Persistent Memory and Cassandra
SanDisk: Persistent Memory and Cassandra
 
eMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overvieweMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overview
 
Accelerate Your Apache Spark with Intel Optane DC Persistent Memory
Accelerate Your Apache Spark with Intel Optane DC Persistent MemoryAccelerate Your Apache Spark with Intel Optane DC Persistent Memory
Accelerate Your Apache Spark with Intel Optane DC Persistent Memory
 
Towards Software Defined Persistent Memory
Towards Software Defined Persistent MemoryTowards Software Defined Persistent Memory
Towards Software Defined Persistent Memory
 
Live Data: For When Data is Greater than Memory
Live Data: For When Data is Greater than MemoryLive Data: For When Data is Greater than Memory
Live Data: For When Data is Greater than Memory
 
Coa presentation3
Coa presentation3Coa presentation3
Coa presentation3
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark faster
 
DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI ConvergenceDAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
 
SOUG_SDM_OracleDB_V3
SOUG_SDM_OracleDB_V3SOUG_SDM_OracleDB_V3
SOUG_SDM_OracleDB_V3
 
Q4.11: Introduction to eMMC
Q4.11: Introduction to eMMCQ4.11: Introduction to eMMC
Q4.11: Introduction to eMMC
 
Apache Spark At Scale in the Cloud
Apache Spark At Scale in the CloudApache Spark At Scale in the Cloud
Apache Spark At Scale in the Cloud
 
Apache Spark At Scale in the Cloud
Apache Spark At Scale in the CloudApache Spark At Scale in the Cloud
Apache Spark At Scale in the Cloud
 
UNIT 3.docx
UNIT 3.docxUNIT 3.docx
UNIT 3.docx
 
Virtualization for Emerging Memory Devices
Virtualization for Emerging Memory DevicesVirtualization for Emerging Memory Devices
Virtualization for Emerging Memory Devices
 
computer system embedded system volume1.ppt
computer system embedded system volume1.pptcomputer system embedded system volume1.ppt
computer system embedded system volume1.ppt
 
Accelerate and Scale Big Data Analytics with Disaggregated Compute and Storage
Accelerate and Scale Big Data Analytics with Disaggregated Compute and StorageAccelerate and Scale Big Data Analytics with Disaggregated Compute and Storage
Accelerate and Scale Big Data Analytics with Disaggregated Compute and Storage
 
Reimagining HPC Compute and Storage Architecture with Intel Optane Technology
Reimagining HPC Compute and Storage Architecture with Intel Optane TechnologyReimagining HPC Compute and Storage Architecture with Intel Optane Technology
Reimagining HPC Compute and Storage Architecture with Intel Optane Technology
 

More from Intel® Software

More from Intel® Software (20)

AI for All: Biology is eating the world & AI is eating Biology
AI for All: Biology is eating the world & AI is eating Biology AI for All: Biology is eating the world & AI is eating Biology
AI for All: Biology is eating the world & AI is eating Biology
 
Python Data Science and Machine Learning at Scale with Intel and Anaconda
Python Data Science and Machine Learning at Scale with Intel and AnacondaPython Data Science and Machine Learning at Scale with Intel and Anaconda
Python Data Science and Machine Learning at Scale with Intel and Anaconda
 
Streamline End-to-End AI Pipelines with Intel, Databricks, and OmniSci
Streamline End-to-End AI Pipelines with Intel, Databricks, and OmniSciStreamline End-to-End AI Pipelines with Intel, Databricks, and OmniSci
Streamline End-to-End AI Pipelines with Intel, Databricks, and OmniSci
 
AI for good: Scaling AI in science, healthcare, and more.
AI for good: Scaling AI in science, healthcare, and more.AI for good: Scaling AI in science, healthcare, and more.
AI for good: Scaling AI in science, healthcare, and more.
 
Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...
Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...
Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...
 
Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...
Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...
Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...
 
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...
 
AWS & Intel Webinar Series - Accelerating AI Research
AWS & Intel Webinar Series - Accelerating AI ResearchAWS & Intel Webinar Series - Accelerating AI Research
AWS & Intel Webinar Series - Accelerating AI Research
 
Intel Developer Program
Intel Developer ProgramIntel Developer Program
Intel Developer Program
 
Intel AIDC Houston Summit - Overview Slides
Intel AIDC Houston Summit - Overview SlidesIntel AIDC Houston Summit - Overview Slides
Intel AIDC Houston Summit - Overview Slides
 
AIDC NY: BODO AI Presentation - 09.19.2019
AIDC NY: BODO AI Presentation - 09.19.2019AIDC NY: BODO AI Presentation - 09.19.2019
AIDC NY: BODO AI Presentation - 09.19.2019
 
AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019
AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019
AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019
 
Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...
Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...
Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...
 
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...
 
Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...
Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...
Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...
 
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
 
AIDC India - AI on IA
AIDC India  - AI on IAAIDC India  - AI on IA
AIDC India - AI on IA
 
AIDC India - Intel Movidius / Open Vino Slides
AIDC India - Intel Movidius / Open Vino SlidesAIDC India - Intel Movidius / Open Vino Slides
AIDC India - Intel Movidius / Open Vino Slides
 
AIDC India - AI Vision Slides
AIDC India - AI Vision SlidesAIDC India - AI Vision Slides
AIDC India - AI Vision Slides
 
Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...
Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...
Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 

Volatile Uses for Persistent Memory

  • 1. Usha Upadhyayula & Piotr Balcer Intel Data Center Group
  • 2. SPDK, PMDK & Vtune™ Summit Agenda • Why Use Persistent Memory as Volatile • How to Create Volatile Region over Persistent Memory ▪ libmemkind ▪ libvmemcache 2
  • 3. SPDK, PMDK & Intel® VTune™ Amplifier Summit 3 ModesataGlance • Memory Mode (volatile Memory) • Data Placement • Application does not have control over data placement between DRAM and Intel Persistent Memory • Ease of adoption: No Code Changes • Performance slower than DRAM • App Direct Mode (persistent memory) • Data Placement • Application has control over data placement between DRAM and Intel Persistent Memory • Ease of Adoption: Need to Re-architect Application • Performance at Native hardware latencies APPLICATION VOLATILE MEMORY POOL O P T A N E P E R S I S T E N T M E M O R Y D R A M A S C A C H E APPLICATION OPTANE PERSISTENT MEMORY DRAM
  • 4. SPDK, PMDK & Intel® VTune™ Amplifier Summit 4 Motivation • Application Controlled Data Placement • Has Different Tiers of Data • Opportunity to use Bigger and Cheaper Volatile Memory than DRAM • Persistence not Required • Reduce Development Effort
  • 5. SPDK, PMDK & Vtune™ Summit 5 Whatislibmemkind DRAM Unified Memory Management High BW Memory Intel® Optane™ DC Persistent Memory Distros Allocator Familiar API stdlib like API Availability https://github.com/memkindJeMalloc 5.0
  • 6. SPDK, PMDK & Intel® VTune™ Amplifier Summit 6 HowDoesitWORK • pmem kind is file-backed • Temp file created on DAX-enabled filesystem • Temp file is memory mapped into application virtual address space • Temp file deleted when application terminates • Jemalloc manages memory allocation from this address space libmemkind is a Wrapper; Jemalloc Manages Heap
  • 7. SPDK, PMDK & Intel® VTune™ Amplifier Summit 7 MemkindAPI Heap Management API • void *memkind_malloc(memkind_t kind, size_t size ) • void *memkind_calloc(memkind_t kind, size_t num, size_t size ) • void *memkind_realloc(memkind_t kind, void *ptr, size_t size ) • void memkind_free(memkind_t kind, void *ptr ) • memkind_t memkind_detect_kind(void *ptr ) Persistent Memory API • int memkind_create_pmem(const char *dir , size_t max_size , memkind_t *kind • int memkind_destroy_kind(memkind_t kind )
  • 8. SPDK, PMDK & Intel® VTune™ Amplifier Summit 8 int main(int argc, char *argv[]) { struct memkind *pmem_kind = NULL; memkind_create_pmem(“/mnt/pmem”, 0, &pmem_kind); char * ptr_default = (char *)memkind_malloc(MEMKIND_DEFAULT, size); //allocate in DRAM char * ptr_pmem = (char *)memkind_malloc(pmem_kind, size); //allocate in PMEM memkind_free(MEMKIND_DEFAULT, ptr_default); memkind_free(pmem_kind, ptr_pmem); memkind_destroy_kind(pmem_kind); return 0; } Example-allocationtoDRAMandPMEM
  • 9. SPDK, PMDK & Intel® VTune™ Amplifier Summit 9 • Manage Fragmentation with Memory Usage Policy • void memkind_config_set_memory_usage_policy(struct memkind_config *cfg, memkind_mem_usage_policy policy ) • MEMKIND_MEM_USAGE_POLICY_DEFAULT – default memory usage policy • MEMKIND_MEM_USAGE_POLICY_CONSERVATIVE – prioritize memory usage at cost of performance ManagingFragmentation Trade off between Memory Usage vs CPU Utilization
  • 10. SPDK, PMDK & Intel® VTune™ Amplifier Summit 10 Fragmentation 0.5 2.5 4.5 6.5 8.5 10.5 12.5 14.5 1 4… 9… 1… 1… 2… 2… 3… 3… 4… 4… 5… 5… 6… 6… 7… 7… 8… 8… 9… 9… 1… 1… 1… 1… 1… 1… 1… 1… 1… 1… 1… 1… 1… 1… 1… 1… Fragmentationpercentage Number of allocations Fragmentation MEMKIND_MEM_USAGE_POLICY_DEFAULT MEMKIND_MEM_USAGE_POLICY_CONSERVATIVE
  • 11. SPDK, PMDK & Intel® VTune™ Amplifier Summit 11 Summary • libmemkind Provides • Unified memory management across different “kinds of memory” • Familiar API to manage different kinds of memory • Tutorial and Code Samples • https://software.intel.com/en-us/articles/use-memkind-to-manage-volatile- memory-on-intel-optane-persistent-memory • https://github.com/memkind/memkind/tree/master/examples https://github.com/memkind
  • 13. SPDK, PMDK & Vtune™ Summit Problemstatement Local LRU cache Support for large capacities available with persistent memory (many terabytes per server) Lightweight, efficient and embeddable In-memory Scalable 13
  • 14. SPDK, PMDK & Vtune™ Summit Existingsolutions In-memory databases tend to rely on malloc() in some form for allocating memory for entries ▪ Which means allocating anonymous memory Persistent Memory is exposed by the operating system through normal file-system operations ▪ Which means allocating byte-addressable PMEM needs to use file memory mapping (fsdax). We could modify the allocator of an existing in-memory database and be done with it, right? ☺ 14
  • 15. SPDK, PMDK & Vtune™ Summit 15 Fragmentation Manual dynamic memory management a’la dlmalloc/jemalloc/tcmalloc/palloc causes fragmentation Applications with substantial expected runtime durations need a way to combat this problem ▪ Compacting GC (Java, .NET) ▪ Defragmentation (Redis, Apache Ignite) ▪ Slab allocation (memcached) Especially so if there’s substantial expected variety in allocated sizes
  • 16. SPDK, PMDK & Vtune™ Summit 16 Extentallocation If fragmentation is unavoidable, and defragmentation/compacting is CPU and memory bandwidth intensive, let’s embrace it! Usually only done in relatively large blocks in file-systems. But on PMEM, we are no longer restricted by large transfer units (sectors, pages etc)
  • 17. SPDK, PMDK & Vtune™ Summit 17 Scalablereplacementpolicy Performance of libvmemcache was bottlenecked by naïve implementation of LRU based on a doubly-linked list. With 100st of threads, most of the time of any request was spent waiting on a list lock… Locking per-node doesn’t solve the problem…
  • 18. SPDK, PMDK & Vtune™ Summit 18 BufferedLRU Our solution was quite simple. We’ve added a non-blocking ring-buffer which buffers the list-move operations This way, the list only needs to get locked during eviction or when the ring-buffer is full.
  • 19. SPDK, PMDK & Vtune™ Summit Lightweight,embeddable,in-memorycaching https://github.com/pmem/vmemcache VMEMcache *cache = vmemcache_new("/tmp", VMEMCACHE_MIN_POOL, VMEMCACHE_MIN_EXTENT, VMEMCACHE_REPLACEMENT_LRU); const char *key = "foo"; vmemcache_put(cache, key, strlen(key), "bar", sizeof("bar")); char buf[128]; ssize_t len = vmemcache_get(cache, key, strlen(key), buf, sizeof(buf), 0, NULL); vmemcache_delete(cache); libvmemcache has normal get/put APIs, optional replacement policy, and configurable extent size. Works with terabyte-sized in-memory workloads without a sweat, with very high space utilization. Also works on regular DRAM. 19