SlideShare a Scribd company logo
Developing Apps and Integrating with
GlusterFS
Justin Clift, GlusterFS Integration
Open Source and Standards team @ Red Hat
Gluster Community Day London 2013
#whoami
● Previously an experienced SysAdmin
(Solaris and Linux) for many, many years
● Now works on GlusterFS integration
● Mostly worked on Mission Critical
systems in corporate/enterprise
environments (eg. Telco, banking,
Insurance)
● Has been helping build Open Source
Communities after hours for many years
(PostgreSQL, OpenOffice back in the day)
● Joined Red Hat mid 2010
jclift@redhat.com
September 2013 - Niels de Vos
Agenda
● Options for Gluster Application development
● What is Libgfapi?
● Pros & Cons
● Libgfapi example
● Rapid Prototyping GlusterFS Translators
● Translator example
● Contact Me
The old way: access through FUSE
libgfapi: access through library
Pros: Why use Libgfapi?
● Improved speed and latency
● Eliminate the FUSE and kernel VFS layer from
GlusterFS volume access
● Examples:
– qemu storage layer
– Samba VFS plugin
Cons: Downsides
● Existing applications need to be extended
– Not a drop in replacement for POSIX based filesystem
access
● Client side API only available for C and
Python so far
Python and C API
● The C API is fairly comprehensive
– 87 callable C functions. Eg:
● glfs_creat()
● glfs_open()
● glfs_close()
● glfs_seekdir()
● glfs_stat()
● glfs_chmod()
● The Python API is only 19 functions so far
– Just the most used ones, more coming
Python API – Volume operations
● set_logging(path, level)
● mount()
● creat(path, flags, mode)
● getxattr(path, key, maxlen)
● listxattr(path)
● lstat(path)
● mkdir(path)
● open(path, flags)
● opendir(path)
● rename(old_path, new_path)
● rmdir(path)
● setxattr(path, key, value, vlen)
● unlink(path)
Python API – File operations
● fsync()
● read(buflen, flags)
● read_buffer(buf, flags)
● write(data, flags)
● fallocate(mode, offset, len)
● discard(offset, len)
Libgfapi example
Example Python code:
# Import Python libgfapi library (required)
from gluster import gfapi
# Mount the volume
vol = gfapi.Volume('f19laptop', 'playground')
vol.mount()
# Create a file
import os
myfile = vol.creat('somefile.txt', os.O_RDWR, 0o640)
Libgfapi example (continued)
# Write to the file
bytes_written = myfile.write('This is some data')
print bytes_written
# Seek back to the start of the file
myfile.seek(0, os.SEEK_SET)
# Read from the file
file_data = myfile.read(5)
print file_data
# Rename the file
vol.rename('somefile.txt', 'someotherfile.txt')
# Delete the file
vol.unlink('someotherfile.txt')
Rapid Prototyping GlusterFS
Translators
● Uses the Python Gluster “Glupy” library
● Easy to write translators, compared to C
● Not as fast to execute as C based translators, but can
still fire off over 1,000 times per second
Trivial “helloworld” example
import sys
from gluster_glupy import *
class xlator (Translator):
def __init__(self, c_this):
Translator.__init__(self, c_this)
def lookup_fop(self, frame, this, loc, xdata):
print "Python xlator: Hello!"
dl.wind_lookup(frame, POINTER(xlator_t)(), loc, xdata)
return 0
def lookup_cbk(self, frame, cookie, this, op_ret, op_errno, inode, buf, xdata, postparent):
print "Python xlator: Hello again!"
dl.unwind_lookup(frame, cookie, this, op_ret, op_errno, inode, buf, xdata, postparent)
return 0
Helloworld translator demo
[Run through the helloworld demo here]
Real world example
● GlusterFlow translator:
https://forge.gluster.org/glusterflow/glusterflow/blobs/master/json/glus
terflowclient.py
● Fires off 1,600 times per second on my laptop in a F19 VM
● Can be re-written in C if that's not fast enough
Questions?
● User questions and experiences
– gluster-users@gluster.org
– #gluster on Freenode IRC
● Developer questions and discussions
– gluster-devel@nongnu.org
– #gluster-dev on Freenode IRC
● Announcements mailing list
– announce@gluster.org
Contact me
● Happy for people to email me about any of this
stuff:
Justin Clift
● Work email: jclift@redhat.com
● Personal email: justin@postgresql.org
● Twitter: @realjustinclift

More Related Content

ODP
Scale out backups-with_bareos_and_gluster
ODP
Kkeithley ufonfs-gluster summit
PDF
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
ODP
Gluster intro-tdose
ODP
20160130 Gluster-roadmap
PDF
Gluster d2
PDF
Gluster intro-tdose
ODP
Join the super_colony_-_feb2013
Scale out backups-with_bareos_and_gluster
Kkeithley ufonfs-gluster summit
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
Gluster intro-tdose
20160130 Gluster-roadmap
Gluster d2
Gluster intro-tdose
Join the super_colony_-_feb2013

What's hot (20)

PDF
Integrating gluster fs,_qemu_and_ovirt-vijay_bellur-linuxcon_eu_2013
ODP
20160401 Gluster-roadmap
PDF
20160401 guster-roadmap
PDF
State of the_gluster_-_lceu
ODP
Introduction to highly_availablenfs_server_on_scale-out_storage_systems_based...
ODP
GlusterFs Architecture & Roadmap - LinuxCon EU 2013
PDF
Gluster fs current_features_and_roadmap
ODP
Gluster technical overview
PDF
Sdc 2012-challenges
ODP
Lcna example-2012
ODP
Lisa 2015-gluster fs-introduction
ODP
Accessing gluster ufo_-_eco_willson
ODP
Gluster fs hadoop_fifth-elephant
ODP
GlusterFS Containers
ODP
Leases and-caching final
ODP
Gluster d thread_synchronization_using_urcu_lca2016
PDF
Smb gluster devmar2013
ODP
Gdeploy 2.0
ODP
Tiering barcelona
ODP
GlusterD 2.0 - Managing Distributed File System Using a Centralized Store
Integrating gluster fs,_qemu_and_ovirt-vijay_bellur-linuxcon_eu_2013
20160401 Gluster-roadmap
20160401 guster-roadmap
State of the_gluster_-_lceu
Introduction to highly_availablenfs_server_on_scale-out_storage_systems_based...
GlusterFs Architecture & Roadmap - LinuxCon EU 2013
Gluster fs current_features_and_roadmap
Gluster technical overview
Sdc 2012-challenges
Lcna example-2012
Lisa 2015-gluster fs-introduction
Accessing gluster ufo_-_eco_willson
Gluster fs hadoop_fifth-elephant
GlusterFS Containers
Leases and-caching final
Gluster d thread_synchronization_using_urcu_lca2016
Smb gluster devmar2013
Gdeploy 2.0
Tiering barcelona
GlusterD 2.0 - Managing Distributed File System Using a Centralized Store
Ad

Viewers also liked (17)

PDF
Debugging with-wireshark-niels-de-vos
ODP
Integrating gluster fs,_qemu_and_ovirt-vijay_bellur-linuxcon_eu_2013
ODP
Gsummit apis-2013
ODP
Dedupe nmamit
ODP
Introduction to Open Source
PDF
Disperse xlator ramon_datalab
ODP
PDF
Gluster fs current_features_and_roadmap
ODP
Glusterfs for sysadmins-justin_clift
ODP
Dustin Black - Red Hat Storage Server Administration Deep Dive
ODP
Software defined storage
PDF
レッドハット グラスター ストレージ Red Hat Gluster Storage (Japanese)
ODP
YDAL Barcelona
PDF
On demand file-caching_-_gustavo_brand
ODP
Sdc challenges-2012
PDF
Gluster wireshark niels_de_vos
ODP
Bug triage in_gluster
Debugging with-wireshark-niels-de-vos
Integrating gluster fs,_qemu_and_ovirt-vijay_bellur-linuxcon_eu_2013
Gsummit apis-2013
Dedupe nmamit
Introduction to Open Source
Disperse xlator ramon_datalab
Gluster fs current_features_and_roadmap
Glusterfs for sysadmins-justin_clift
Dustin Black - Red Hat Storage Server Administration Deep Dive
Software defined storage
レッドハット グラスター ストレージ Red Hat Gluster Storage (Japanese)
YDAL Barcelona
On demand file-caching_-_gustavo_brand
Sdc challenges-2012
Gluster wireshark niels_de_vos
Bug triage in_gluster
Ad

Similar to Developing apps and_integrating_with_gluster_fs_-_libgfapi (20)

PDF
Gsummit apis-2012
PDF
GlusterFS Presentation FOSSCOMM2013 HUA, Athens, GR
PDF
GlusterFS as a DFS
PDF
GlusterFS : un file system open source per i big data di oggi e domani - Robe...
PDF
GlusterFs: a scalable file system for today's and tomorrow's big data
PDF
Gluster dev session #3 xlator interface
PDF
Glusterfs session #2 1 layer above disk filesystems
PDF
Sergi Álvarez + Roi Martín - radare2: From forensics to bindiffing [RootedCON...
PDF
Lcna 2012-example
ODP
Lcna tutorial-2012
PDF
Lcna 2012-tutorial
PDF
GlusterFS Update and OpenStack Integration
PPTX
Improving hyperconverged performance
PDF
The Ring programming language version 1.5.1 book - Part 44 of 180
PDF
GlusterFS w/ Tiered XFS
PPT
Integrity and Security in Filesystems
PDF
Codemotion Rome 2015. GlusterFS
PDF
Gluster FS a filesistem for Big Data | Roberto Franchini - Codemotion Rome 2015
PDF
Glusterfs session #5 inode t, fd-t lifecycles
PDF
Filesystem Abstraction with Flysystem
Gsummit apis-2012
GlusterFS Presentation FOSSCOMM2013 HUA, Athens, GR
GlusterFS as a DFS
GlusterFS : un file system open source per i big data di oggi e domani - Robe...
GlusterFs: a scalable file system for today's and tomorrow's big data
Gluster dev session #3 xlator interface
Glusterfs session #2 1 layer above disk filesystems
Sergi Álvarez + Roi Martín - radare2: From forensics to bindiffing [RootedCON...
Lcna 2012-example
Lcna tutorial-2012
Lcna 2012-tutorial
GlusterFS Update and OpenStack Integration
Improving hyperconverged performance
The Ring programming language version 1.5.1 book - Part 44 of 180
GlusterFS w/ Tiered XFS
Integrity and Security in Filesystems
Codemotion Rome 2015. GlusterFS
Gluster FS a filesistem for Big Data | Roberto Franchini - Codemotion Rome 2015
Glusterfs session #5 inode t, fd-t lifecycles
Filesystem Abstraction with Flysystem

More from Gluster.org (20)

PDF
Automating Gluster @ Facebook - Shreyas Siravara
PDF
nfusr: a new userspace NFS client based on libnfs - Shreyas Siravara
PDF
Facebook’s upstream approach to GlusterFS - David Hasson
PDF
Throttling Traffic at Facebook Scale
PDF
Gluster Metrics: why they are crucial for running stable deployments of all s...
PDF
Up and Running with Glusto & Glusto-Tests in 5 Minutes (or less)
PDF
Data Reduction for Gluster with VDO
PDF
Releases: What are contributors responsible for
PDF
RIO Distribution: Reconstructing the onion - Shyamsundar Ranganathan
PDF
Gluster and Kubernetes
PDF
Native Clients, more the merrier with GFProxy!
PDF
Gluster: a SWOT Analysis
PDF
GlusterD-2.0: What's Happening? - Kaushal Madappa
PDF
Scalability and Performance of CNS 3.6
PDF
What Makes Us Fail
PDF
Gluster as Native Storage for Containers - past, present and future
PDF
Heketi Functionality into Glusterd2
PDF
Hands On Gluster with Jeff Darcy
PDF
Architecture of the High Availability Solution for Ganesha and Samba with Kal...
PDF
Challenges with Gluster and Persistent Memory with Dan Lambright
Automating Gluster @ Facebook - Shreyas Siravara
nfusr: a new userspace NFS client based on libnfs - Shreyas Siravara
Facebook’s upstream approach to GlusterFS - David Hasson
Throttling Traffic at Facebook Scale
Gluster Metrics: why they are crucial for running stable deployments of all s...
Up and Running with Glusto & Glusto-Tests in 5 Minutes (or less)
Data Reduction for Gluster with VDO
Releases: What are contributors responsible for
RIO Distribution: Reconstructing the onion - Shyamsundar Ranganathan
Gluster and Kubernetes
Native Clients, more the merrier with GFProxy!
Gluster: a SWOT Analysis
GlusterD-2.0: What's Happening? - Kaushal Madappa
Scalability and Performance of CNS 3.6
What Makes Us Fail
Gluster as Native Storage for Containers - past, present and future
Heketi Functionality into Glusterd2
Hands On Gluster with Jeff Darcy
Architecture of the High Availability Solution for Ganesha and Samba with Kal...
Challenges with Gluster and Persistent Memory with Dan Lambright

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Cloud computing and distributed systems.
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Encapsulation theory and applications.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPT
Teaching material agriculture food technology
Chapter 3 Spatial Domain Image Processing.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Diabetes mellitus diagnosis method based random forest with bat algorithm
Digital-Transformation-Roadmap-for-Companies.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Understanding_Digital_Forensics_Presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Network Security Unit 5.pdf for BCA BBA.
Machine learning based COVID-19 study performance prediction
Cloud computing and distributed systems.
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Encapsulation theory and applications.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
The AUB Centre for AI in Media Proposal.docx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Teaching material agriculture food technology

Developing apps and_integrating_with_gluster_fs_-_libgfapi

  • 1. Developing Apps and Integrating with GlusterFS Justin Clift, GlusterFS Integration Open Source and Standards team @ Red Hat Gluster Community Day London 2013
  • 2. #whoami ● Previously an experienced SysAdmin (Solaris and Linux) for many, many years ● Now works on GlusterFS integration ● Mostly worked on Mission Critical systems in corporate/enterprise environments (eg. Telco, banking, Insurance) ● Has been helping build Open Source Communities after hours for many years (PostgreSQL, OpenOffice back in the day) ● Joined Red Hat mid 2010 jclift@redhat.com
  • 3. September 2013 - Niels de Vos Agenda ● Options for Gluster Application development ● What is Libgfapi? ● Pros & Cons ● Libgfapi example ● Rapid Prototyping GlusterFS Translators ● Translator example ● Contact Me
  • 4. The old way: access through FUSE
  • 6. Pros: Why use Libgfapi? ● Improved speed and latency ● Eliminate the FUSE and kernel VFS layer from GlusterFS volume access ● Examples: – qemu storage layer – Samba VFS plugin
  • 7. Cons: Downsides ● Existing applications need to be extended – Not a drop in replacement for POSIX based filesystem access ● Client side API only available for C and Python so far
  • 8. Python and C API ● The C API is fairly comprehensive – 87 callable C functions. Eg: ● glfs_creat() ● glfs_open() ● glfs_close() ● glfs_seekdir() ● glfs_stat() ● glfs_chmod() ● The Python API is only 19 functions so far – Just the most used ones, more coming
  • 9. Python API – Volume operations ● set_logging(path, level) ● mount() ● creat(path, flags, mode) ● getxattr(path, key, maxlen) ● listxattr(path) ● lstat(path) ● mkdir(path) ● open(path, flags) ● opendir(path) ● rename(old_path, new_path) ● rmdir(path) ● setxattr(path, key, value, vlen) ● unlink(path)
  • 10. Python API – File operations ● fsync() ● read(buflen, flags) ● read_buffer(buf, flags) ● write(data, flags) ● fallocate(mode, offset, len) ● discard(offset, len)
  • 11. Libgfapi example Example Python code: # Import Python libgfapi library (required) from gluster import gfapi # Mount the volume vol = gfapi.Volume('f19laptop', 'playground') vol.mount() # Create a file import os myfile = vol.creat('somefile.txt', os.O_RDWR, 0o640)
  • 12. Libgfapi example (continued) # Write to the file bytes_written = myfile.write('This is some data') print bytes_written # Seek back to the start of the file myfile.seek(0, os.SEEK_SET) # Read from the file file_data = myfile.read(5) print file_data # Rename the file vol.rename('somefile.txt', 'someotherfile.txt') # Delete the file vol.unlink('someotherfile.txt')
  • 13. Rapid Prototyping GlusterFS Translators ● Uses the Python Gluster “Glupy” library ● Easy to write translators, compared to C ● Not as fast to execute as C based translators, but can still fire off over 1,000 times per second
  • 14. Trivial “helloworld” example import sys from gluster_glupy import * class xlator (Translator): def __init__(self, c_this): Translator.__init__(self, c_this) def lookup_fop(self, frame, this, loc, xdata): print "Python xlator: Hello!" dl.wind_lookup(frame, POINTER(xlator_t)(), loc, xdata) return 0 def lookup_cbk(self, frame, cookie, this, op_ret, op_errno, inode, buf, xdata, postparent): print "Python xlator: Hello again!" dl.unwind_lookup(frame, cookie, this, op_ret, op_errno, inode, buf, xdata, postparent) return 0
  • 15. Helloworld translator demo [Run through the helloworld demo here]
  • 16. Real world example ● GlusterFlow translator: https://forge.gluster.org/glusterflow/glusterflow/blobs/master/json/glus terflowclient.py ● Fires off 1,600 times per second on my laptop in a F19 VM ● Can be re-written in C if that's not fast enough
  • 17. Questions? ● User questions and experiences – gluster-users@gluster.org – #gluster on Freenode IRC ● Developer questions and discussions – gluster-devel@nongnu.org – #gluster-dev on Freenode IRC ● Announcements mailing list – announce@gluster.org
  • 18. Contact me ● Happy for people to email me about any of this stuff: Justin Clift ● Work email: jclift@redhat.com ● Personal email: justin@postgresql.org ● Twitter: @realjustinclift