SlideShare a Scribd company logo
1 of 31
Download to read offline
Object and Class Versions
In GemStone/S
James Foster
Director of Operations
ESUG
22 August 2016
Agenda
• Introduction
• Architecture
• Objects
– Lookup (Object Table)
– Versions (Commit Records)
• Classes
– Lookup (Namespaces)
– Versions
• Questions
2
Limitations of traditional Smalltalks
• Object space (image) must fit in (virtual) RAM
• Object space visible to only one VM
• Sharing objects between VMs is difficult
– Convert to non-object format (binary, XML, SQL)
– No built-in object identity for multiple exports
• Object state is lost when VM exits
3
Welcome to the magical
world of GemStone
• Object space limited by
disk, not RAM
• Object space shared
across multiple VMs on
multiple hosts
• Transactional
persistence
• Image from
http://www.flickr.com/photos/laffy4k/182219003/
• Creative Commons License
http://creativecommons.org/licenses/by-sa/2.0/ 4
Agenda
• Introduction
• Architecture
• Objects
– Lookup (Object Table)
– Versions (Commit Records)
• Classes
– Lookup (Namespaces)
– Versions
• Questions
5
GemStone/S Architecture
• Repository
– Disk-based “image” holds objects and other data
– Made up of extents (files or raw partitions)
– Objects are on 16k pages
• Gem Process(s)
– Single Smalltalk virtual machine
• Stone Process
– Manages concurrency
• Shared Page Cache
– Fast cache of pages from repository
– Managed by SPC Monitor process
• Other Processes
– GC Gems, Symbol Gem, AIO Page Server, Free Frame Server, …
22 August 2016 6
Repository
Gem
Stone
SPC
SPC
Monitor
Detailed Component List with Logs
22 August 2016 7
Repository and Extent(s)
• Holds persistent GemStone objects (i.e., the “image”)
• Made up of 1 to 255 extents of up to 32 terabytes each
– On-demand grow
– Pre-grow to maximum size
• Each extent is composed of 16 KB pages
– Root Pages
– Object Table Pages
– Data Pages
– Commit Record Pages
– Free OID List
– Free Page List
• Page ID designates extent and offset
22 August 2016 8
Repository
Shared Page Cache
• Typical database challenge: disk is slow
– In-RAM cache of pages from repository
• Cache is divided into page-sized 'Frames'
– Frame may be free, clean, or dirty
• Free Frame List
– Processes take frame(s) from free list
– Might scan for clean frame (very rare)
• Async IO Page Server(s) write to repository
– State changes from dirty to clean (but not free)
– Max 1 per extent
• Free Frame Server(s) scan for clean frames
– Add to Free Frame List
– Complex algorithm to identify least recently used
22 August 2016 9
Repository
SPC
16 KB
Frame
Frame #5
Frame #7
Frame #8
Free Frame List
Gem
• Represents a single logged-in database session
• Configurable fixed-size memory allocation
• Executes Smalltalk code
– Serves most functions of 'Virtual Machine' in other Smalltalks
• Reads objects from Repository
– Reads pages into SPC, then copies objects to persistent object
memory
• Creates and modifies objects
– New values in temporary object memory
– Objects are copied to pages in SPC
– Commit process coordinated with Stone
– Transaction written to transaction log
– Pages are written to repository by Stone's AIO Page Servers
22 August 2016 10
Agenda
• Introduction
• Architecture
• Objects
– Lookup (Object Table)
– Versions (Commit Records)
• Classes
– Lookup (Namespaces)
– Versions
• Questions
11
Object Identifier
• Objects are (generally) referenced by an identifier, not a
location
– Object can move (edits, GC compaction)
– Different versions based on changes in a transaction
• old values still visible
– Allows two-way #’become:’ without object-space scan
– OID (wrongly) called OOP (object-oriented pointer)
– Exception is possible within a VM
22 August 2016 12
Object Table
• Object Table maps object identifier (OID or OOP) to page
identifier
– Page identifies an extent (file) and offset of 16 KB page
• Each page has its own object index of offset within page
– Each new/modified object is on a fresh page
– Each transaction creates a new OT to point to current
version of an object
22 August 2016 13
Object Table (OT) - 2
• A new (virtual) Object Table is created by each
transaction
– A database "view" includes a unique OT
– Optimizations are used to reduce duplication
• Object Table takes space
– In Repository
– In Shared Page Cache
22 August 2016 14
Object Lookup
• Reference from an in-Gem-memory object instvar
– Pointer if already mapped to an in-memory object
– Otherwise an OID
• Lookup process
– Check for already-loaded objects (OID to address)
– Use object-table to determine page
– Look for page in Shared Page Cache
– If not present, find a free frame and read from disk
– Copy from SPC to local Gem memory
15
Agenda
• Introduction
• Architecture
• Objects
– Lookup (Object Table)
– Versions (Commit Records)
• Classes
– Lookup (Namespaces)
– Versions
• Questions
16
Database View and Commit Record
• On login, Gem has a database view
• Object Table
– Object ID (OID) == Object Oriented Pointer (OOP)
– Map to Page (offset in an Extent)
– Each view is based on a single Object Table
• Each commit creates a Commit Record
– Reference to unique Object Table
– List of modified objects (Write Set)
– List of Shadowed Pages
22 August 2016 17
Object Table Reference
Write Sets
Shadowed Pages
Commit Records
• There is always at least one database view, or Commit Record (CR)
• On login, a Gem is given the most recently created Commit Record
• Other Gems can share the same Commit Record (login or abort)
• Each (non-empty) commit creates a new Commit Record
• An abort moves a Gem to the latest Commit Record
• Oldest CR may be disposed of if it is not referenced
• Another commit creates another Commit Record
22 August 2016 18
Gem1
CR1 CR2 CR3
Gem2
login login
commitabort commit
Commit Record Backlog
• Here we have two Gems and two Commit Records
• Additional commits create more Commit Records (maybe many!)
• Intermediate CRs cannot be disposed of if older CR is referenced
– This can be a major performance issue
• Problems with excess Commit Records
– They take space in SharedPageCache and/or Repository
– They slow down new commit processing
– They delay garbage collection
22 August 2016 19
Gem1
CR2 CR3
Gem2
CRn
commit
…….
Agenda
• Introduction
• Architecture
• Objects
– Lookup (Object Table)
– Versions (Commit Records)
• Classes
– Lookup (Namespaces)
– Versions
• Questions
20
Typical Smalltalk Name Lookup
• Root: a single Dictionary (subclass) instance
• Lookup at method compile time
– Compiled method binds to an Association
• Global name -> object (typically a class name)
• Lookup at runtime
– (Smalltalk at: #’Array’) new
• Replacing Association value substitutes new object (class)
– Recompile class’s methods when schema changes
– References to Association get new value at runtime
21
GemStone/S Name Lookup: Root
• Root: an instance of UserProfileSet (AllUsers)
– UserProfile (name, privileges, groups, symbolList)
– SymbolList: Array of SymbolDictionary instances
– SymbolDictionary: keys constrained to Symbols
• Each user has a unique SymbolList (namespace)
– SymbolLists may share SymbolDictionaries
• Globals and Published are typically shared
• UserGlobals are typically unique
22
Name Lookup: Compile Time
• Compiler accepts an instance of SymbolList
– Search SymbolDictionary instances in order
– Bind to first discovered Association
• Default is user session’s current symbolList
– Set at login to symbolList referenced by UserProfile
• Tools (IDE) may provide another SymbolList
– Effectively a unique Dictionary
– Opportunity for exploration of tools (packages?)
23
SymbolLists
• System myUserProfile ==
GsSession currentSession userProfile
• System myUserProfile symbolList ~~
GsSession currentSession symbolList
• System myUserProfile symbolList first ==
GsSession currentSession symbolList first “at login”
24
Name Lookup: Runtime
• (System myUserProfile symbolList objectNamed:
#’Array’) new.
• (Globals at: #’Array’) new.
• (UserGlobals at: #’Array’) new.
– Could be same or different from one in Globals!
25
Agenda
• Introduction
• Architecture
• Objects
– Lookup (Object Table)
– Versions (Commit Records)
• Classes
– Lookup (Namespaces)
– Versions
• Questions
26
Changing a Class Schema
• Traditional Smalltalks do an atomic operation
– Edit class definition
– Find and migrate all instances
– No control over migration process (drop inst vars)
• GemStone does not (usually) migrate instances
– Repository may be large and finding would be slow
– Other sessions may have view or edit of instances
– Modifying session might not have security
• GS Tools may offer immediate migrate instances
27
Class History (Versions)
• Editing a class schema creates a new class
– Prior class’s methods are compiled into new class
– New class is added to ClassHistory
– New class replaces old class in SymbolDictionary
– Existing instances of old class are unchanged
• Execute methods in old class!
• ClassHistory
– Each class references a ClassHistory
– Each class is referenced by a ClassHistory
– Provides guidance for migration
28
Object Migration
• Requires explicit operation
– Object>>#’migrate’
– Object>>#’migrateFrom:’
– Object>>#’migrateFrom:instVarMap:’
– Class>>#’migrateInstances:to:’
– Class>>#’migrateInstancesTo:’
• Migration creates new instance and swaps identity
– Old instance version remain visible from old views
– Old instance GCed when no longer visible
29
Agenda
• Introduction
• Architecture
• Objects
– Lookup (Object Table)
– Versions (Commit Records)
• Classes
– Lookup (Namespaces)
– Versions
• Questions
30
Questions?
31
GemTalk Systems LLC
15220 NW Greenbrier Pkwy., Suite 240
Beaverton, Oregon, 97006
Voice & Fax: +1 503 766 4714
james.foster@gemtalksystems.com
James G. Foster
Director	of	Operations
www.gemtalksystems.com
®

More Related Content

What's hot

Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLEDB
 
MongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
MongoDB .local Toronto 2019: Tips and Tricks for Effective IndexingMongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
MongoDB .local Toronto 2019: Tips and Tricks for Effective IndexingMongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMike Dirolf
 
Redshift at Lightspeed: How to continuously optimize and modify Redshift sche...
Redshift at Lightspeed: How to continuously optimize and modify Redshift sche...Redshift at Lightspeed: How to continuously optimize and modify Redshift sche...
Redshift at Lightspeed: How to continuously optimize and modify Redshift sche...Amazon Web Services
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redisTanu Siwag
 
Conceptual database design
Conceptual database designConceptual database design
Conceptual database designUmair Shakir
 
Database Management Systems
Database Management SystemsDatabase Management Systems
Database Management SystemsSURBHI SAROHA
 
Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASSJon Dean
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis IntroductionAlex Su
 
File systems versus a dbms
File systems versus a dbmsFile systems versus a dbms
File systems versus a dbmsRituBhargava7
 

What's hot (20)

The PostgreSQL Query Planner
The PostgreSQL Query PlannerThe PostgreSQL Query Planner
The PostgreSQL Query Planner
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQL
 
MongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
MongoDB .local Toronto 2019: Tips and Tricks for Effective IndexingMongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
MongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Redshift at Lightspeed: How to continuously optimize and modify Redshift sche...
Redshift at Lightspeed: How to continuously optimize and modify Redshift sche...Redshift at Lightspeed: How to continuously optimize and modify Redshift sche...
Redshift at Lightspeed: How to continuously optimize and modify Redshift sche...
 
Spark Workshop
Spark WorkshopSpark Workshop
Spark Workshop
 
Database design
Database designDatabase design
Database design
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Mongo db
Mongo dbMongo db
Mongo db
 
Conceptual database design
Conceptual database designConceptual database design
Conceptual database design
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Data recovery
Data recoveryData recovery
Data recovery
 
Redis 101
Redis 101Redis 101
Redis 101
 
Database Management Systems
Database Management SystemsDatabase Management Systems
Database Management Systems
 
Normalization
NormalizationNormalization
Normalization
 
Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASS
 
Key-Value NoSQL Database
Key-Value NoSQL DatabaseKey-Value NoSQL Database
Key-Value NoSQL Database
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
 
File systems versus a dbms
File systems versus a dbmsFile systems versus a dbms
File systems versus a dbms
 

Similar to Intro to GemStone/S

SQL Queries on Smalltalk Objects
SQL Queries on Smalltalk ObjectsSQL Queries on Smalltalk Objects
SQL Queries on Smalltalk ObjectsESUG
 
Things I wish I knew about GemStone
Things I wish I knew about GemStoneThings I wish I knew about GemStone
Things I wish I knew about GemStoneESUG
 
Flexible search in Apache Jackrabbit Oak
Flexible search in Apache Jackrabbit OakFlexible search in Apache Jackrabbit Oak
Flexible search in Apache Jackrabbit OakTommaso Teofili
 
OSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache SlingOSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache SlingCarsten Ziegeler
 
JCR - Java Content Repositories
JCR - Java Content RepositoriesJCR - Java Content Repositories
JCR - Java Content RepositoriesCarsten Ziegeler
 
hibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdfhibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdfPatiento Del Mar
 
Rackspace: Email's Solution for Indexing 50K Documents per Second: Presented ...
Rackspace: Email's Solution for Indexing 50K Documents per Second: Presented ...Rackspace: Email's Solution for Indexing 50K Documents per Second: Presented ...
Rackspace: Email's Solution for Indexing 50K Documents per Second: Presented ...Lucidworks
 
Skillwise - Enhancing dotnet app
Skillwise - Enhancing dotnet appSkillwise - Enhancing dotnet app
Skillwise - Enhancing dotnet appSkillwise Group
 
Not Just ORM: Powerful Hibernate ORM Features and Capabilities
Not Just ORM: Powerful Hibernate ORM Features and CapabilitiesNot Just ORM: Powerful Hibernate ORM Features and Capabilities
Not Just ORM: Powerful Hibernate ORM Features and CapabilitiesBrett Meyer
 
Spider进化论
Spider进化论Spider进化论
Spider进化论cjhacker
 
What's New in Lucene/Solr Presented by Grant Ingersoll at SolrExchage DC
What's New  in Lucene/Solr Presented by Grant Ingersoll at SolrExchage DCWhat's New  in Lucene/Solr Presented by Grant Ingersoll at SolrExchage DC
What's New in Lucene/Solr Presented by Grant Ingersoll at SolrExchage DCLucidworks (Archived)
 
Ugif 10 2012 beauty ofifmxdiskstructs ugif
Ugif 10 2012 beauty ofifmxdiskstructs ugifUgif 10 2012 beauty ofifmxdiskstructs ugif
Ugif 10 2012 beauty ofifmxdiskstructs ugifUGIF
 
ModeShape 3 overview
ModeShape 3 overviewModeShape 3 overview
ModeShape 3 overviewRandall Hauch
 
Decima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero DawnDecima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero DawnGuerrilla
 
Roaring with elastic search sangam2018
Roaring with elastic search sangam2018Roaring with elastic search sangam2018
Roaring with elastic search sangam2018Vinay Kumar
 

Similar to Intro to GemStone/S (20)

SQL Queries on Smalltalk Objects
SQL Queries on Smalltalk ObjectsSQL Queries on Smalltalk Objects
SQL Queries on Smalltalk Objects
 
Things I wish I knew about GemStone
Things I wish I knew about GemStoneThings I wish I knew about GemStone
Things I wish I knew about GemStone
 
Flexible search in Apache Jackrabbit Oak
Flexible search in Apache Jackrabbit OakFlexible search in Apache Jackrabbit Oak
Flexible search in Apache Jackrabbit Oak
 
OSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache SlingOSGi, Scripting and REST, Building Webapps With Apache Sling
OSGi, Scripting and REST, Building Webapps With Apache Sling
 
JCR - Java Content Repositories
JCR - Java Content RepositoriesJCR - Java Content Repositories
JCR - Java Content Repositories
 
Curious Case of SQLi
Curious Case of SQLiCurious Case of SQLi
Curious Case of SQLi
 
Solr
SolrSolr
Solr
 
hibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdfhibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdf
 
Jakarta EE 8 on JDK17
Jakarta EE 8 on JDK17Jakarta EE 8 on JDK17
Jakarta EE 8 on JDK17
 
Rackspace: Email's Solution for Indexing 50K Documents per Second: Presented ...
Rackspace: Email's Solution for Indexing 50K Documents per Second: Presented ...Rackspace: Email's Solution for Indexing 50K Documents per Second: Presented ...
Rackspace: Email's Solution for Indexing 50K Documents per Second: Presented ...
 
Skillwise - Enhancing dotnet app
Skillwise - Enhancing dotnet appSkillwise - Enhancing dotnet app
Skillwise - Enhancing dotnet app
 
Not Just ORM: Powerful Hibernate ORM Features and Capabilities
Not Just ORM: Powerful Hibernate ORM Features and CapabilitiesNot Just ORM: Powerful Hibernate ORM Features and Capabilities
Not Just ORM: Powerful Hibernate ORM Features and Capabilities
 
Spider进化论
Spider进化论Spider进化论
Spider进化论
 
Wot’s in a name
Wot’s in a nameWot’s in a name
Wot’s in a name
 
What's New in Lucene/Solr Presented by Grant Ingersoll at SolrExchage DC
What's New  in Lucene/Solr Presented by Grant Ingersoll at SolrExchage DCWhat's New  in Lucene/Solr Presented by Grant Ingersoll at SolrExchage DC
What's New in Lucene/Solr Presented by Grant Ingersoll at SolrExchage DC
 
Drop acid
Drop acidDrop acid
Drop acid
 
Ugif 10 2012 beauty ofifmxdiskstructs ugif
Ugif 10 2012 beauty ofifmxdiskstructs ugifUgif 10 2012 beauty ofifmxdiskstructs ugif
Ugif 10 2012 beauty ofifmxdiskstructs ugif
 
ModeShape 3 overview
ModeShape 3 overviewModeShape 3 overview
ModeShape 3 overview
 
Decima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero DawnDecima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero Dawn
 
Roaring with elastic search sangam2018
Roaring with elastic search sangam2018Roaring with elastic search sangam2018
Roaring with elastic search sangam2018
 

More from ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

More from ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Recently uploaded

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
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
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
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
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 

Recently uploaded (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
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...
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
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
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
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)
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 

Intro to GemStone/S

  • 1. Object and Class Versions In GemStone/S James Foster Director of Operations ESUG 22 August 2016
  • 2. Agenda • Introduction • Architecture • Objects – Lookup (Object Table) – Versions (Commit Records) • Classes – Lookup (Namespaces) – Versions • Questions 2
  • 3. Limitations of traditional Smalltalks • Object space (image) must fit in (virtual) RAM • Object space visible to only one VM • Sharing objects between VMs is difficult – Convert to non-object format (binary, XML, SQL) – No built-in object identity for multiple exports • Object state is lost when VM exits 3
  • 4. Welcome to the magical world of GemStone • Object space limited by disk, not RAM • Object space shared across multiple VMs on multiple hosts • Transactional persistence • Image from http://www.flickr.com/photos/laffy4k/182219003/ • Creative Commons License http://creativecommons.org/licenses/by-sa/2.0/ 4
  • 5. Agenda • Introduction • Architecture • Objects – Lookup (Object Table) – Versions (Commit Records) • Classes – Lookup (Namespaces) – Versions • Questions 5
  • 6. GemStone/S Architecture • Repository – Disk-based “image” holds objects and other data – Made up of extents (files or raw partitions) – Objects are on 16k pages • Gem Process(s) – Single Smalltalk virtual machine • Stone Process – Manages concurrency • Shared Page Cache – Fast cache of pages from repository – Managed by SPC Monitor process • Other Processes – GC Gems, Symbol Gem, AIO Page Server, Free Frame Server, … 22 August 2016 6 Repository Gem Stone SPC SPC Monitor
  • 7. Detailed Component List with Logs 22 August 2016 7
  • 8. Repository and Extent(s) • Holds persistent GemStone objects (i.e., the “image”) • Made up of 1 to 255 extents of up to 32 terabytes each – On-demand grow – Pre-grow to maximum size • Each extent is composed of 16 KB pages – Root Pages – Object Table Pages – Data Pages – Commit Record Pages – Free OID List – Free Page List • Page ID designates extent and offset 22 August 2016 8 Repository
  • 9. Shared Page Cache • Typical database challenge: disk is slow – In-RAM cache of pages from repository • Cache is divided into page-sized 'Frames' – Frame may be free, clean, or dirty • Free Frame List – Processes take frame(s) from free list – Might scan for clean frame (very rare) • Async IO Page Server(s) write to repository – State changes from dirty to clean (but not free) – Max 1 per extent • Free Frame Server(s) scan for clean frames – Add to Free Frame List – Complex algorithm to identify least recently used 22 August 2016 9 Repository SPC 16 KB Frame Frame #5 Frame #7 Frame #8 Free Frame List
  • 10. Gem • Represents a single logged-in database session • Configurable fixed-size memory allocation • Executes Smalltalk code – Serves most functions of 'Virtual Machine' in other Smalltalks • Reads objects from Repository – Reads pages into SPC, then copies objects to persistent object memory • Creates and modifies objects – New values in temporary object memory – Objects are copied to pages in SPC – Commit process coordinated with Stone – Transaction written to transaction log – Pages are written to repository by Stone's AIO Page Servers 22 August 2016 10
  • 11. Agenda • Introduction • Architecture • Objects – Lookup (Object Table) – Versions (Commit Records) • Classes – Lookup (Namespaces) – Versions • Questions 11
  • 12. Object Identifier • Objects are (generally) referenced by an identifier, not a location – Object can move (edits, GC compaction) – Different versions based on changes in a transaction • old values still visible – Allows two-way #’become:’ without object-space scan – OID (wrongly) called OOP (object-oriented pointer) – Exception is possible within a VM 22 August 2016 12
  • 13. Object Table • Object Table maps object identifier (OID or OOP) to page identifier – Page identifies an extent (file) and offset of 16 KB page • Each page has its own object index of offset within page – Each new/modified object is on a fresh page – Each transaction creates a new OT to point to current version of an object 22 August 2016 13
  • 14. Object Table (OT) - 2 • A new (virtual) Object Table is created by each transaction – A database "view" includes a unique OT – Optimizations are used to reduce duplication • Object Table takes space – In Repository – In Shared Page Cache 22 August 2016 14
  • 15. Object Lookup • Reference from an in-Gem-memory object instvar – Pointer if already mapped to an in-memory object – Otherwise an OID • Lookup process – Check for already-loaded objects (OID to address) – Use object-table to determine page – Look for page in Shared Page Cache – If not present, find a free frame and read from disk – Copy from SPC to local Gem memory 15
  • 16. Agenda • Introduction • Architecture • Objects – Lookup (Object Table) – Versions (Commit Records) • Classes – Lookup (Namespaces) – Versions • Questions 16
  • 17. Database View and Commit Record • On login, Gem has a database view • Object Table – Object ID (OID) == Object Oriented Pointer (OOP) – Map to Page (offset in an Extent) – Each view is based on a single Object Table • Each commit creates a Commit Record – Reference to unique Object Table – List of modified objects (Write Set) – List of Shadowed Pages 22 August 2016 17 Object Table Reference Write Sets Shadowed Pages
  • 18. Commit Records • There is always at least one database view, or Commit Record (CR) • On login, a Gem is given the most recently created Commit Record • Other Gems can share the same Commit Record (login or abort) • Each (non-empty) commit creates a new Commit Record • An abort moves a Gem to the latest Commit Record • Oldest CR may be disposed of if it is not referenced • Another commit creates another Commit Record 22 August 2016 18 Gem1 CR1 CR2 CR3 Gem2 login login commitabort commit
  • 19. Commit Record Backlog • Here we have two Gems and two Commit Records • Additional commits create more Commit Records (maybe many!) • Intermediate CRs cannot be disposed of if older CR is referenced – This can be a major performance issue • Problems with excess Commit Records – They take space in SharedPageCache and/or Repository – They slow down new commit processing – They delay garbage collection 22 August 2016 19 Gem1 CR2 CR3 Gem2 CRn commit …….
  • 20. Agenda • Introduction • Architecture • Objects – Lookup (Object Table) – Versions (Commit Records) • Classes – Lookup (Namespaces) – Versions • Questions 20
  • 21. Typical Smalltalk Name Lookup • Root: a single Dictionary (subclass) instance • Lookup at method compile time – Compiled method binds to an Association • Global name -> object (typically a class name) • Lookup at runtime – (Smalltalk at: #’Array’) new • Replacing Association value substitutes new object (class) – Recompile class’s methods when schema changes – References to Association get new value at runtime 21
  • 22. GemStone/S Name Lookup: Root • Root: an instance of UserProfileSet (AllUsers) – UserProfile (name, privileges, groups, symbolList) – SymbolList: Array of SymbolDictionary instances – SymbolDictionary: keys constrained to Symbols • Each user has a unique SymbolList (namespace) – SymbolLists may share SymbolDictionaries • Globals and Published are typically shared • UserGlobals are typically unique 22
  • 23. Name Lookup: Compile Time • Compiler accepts an instance of SymbolList – Search SymbolDictionary instances in order – Bind to first discovered Association • Default is user session’s current symbolList – Set at login to symbolList referenced by UserProfile • Tools (IDE) may provide another SymbolList – Effectively a unique Dictionary – Opportunity for exploration of tools (packages?) 23
  • 24. SymbolLists • System myUserProfile == GsSession currentSession userProfile • System myUserProfile symbolList ~~ GsSession currentSession symbolList • System myUserProfile symbolList first == GsSession currentSession symbolList first “at login” 24
  • 25. Name Lookup: Runtime • (System myUserProfile symbolList objectNamed: #’Array’) new. • (Globals at: #’Array’) new. • (UserGlobals at: #’Array’) new. – Could be same or different from one in Globals! 25
  • 26. Agenda • Introduction • Architecture • Objects – Lookup (Object Table) – Versions (Commit Records) • Classes – Lookup (Namespaces) – Versions • Questions 26
  • 27. Changing a Class Schema • Traditional Smalltalks do an atomic operation – Edit class definition – Find and migrate all instances – No control over migration process (drop inst vars) • GemStone does not (usually) migrate instances – Repository may be large and finding would be slow – Other sessions may have view or edit of instances – Modifying session might not have security • GS Tools may offer immediate migrate instances 27
  • 28. Class History (Versions) • Editing a class schema creates a new class – Prior class’s methods are compiled into new class – New class is added to ClassHistory – New class replaces old class in SymbolDictionary – Existing instances of old class are unchanged • Execute methods in old class! • ClassHistory – Each class references a ClassHistory – Each class is referenced by a ClassHistory – Provides guidance for migration 28
  • 29. Object Migration • Requires explicit operation – Object>>#’migrate’ – Object>>#’migrateFrom:’ – Object>>#’migrateFrom:instVarMap:’ – Class>>#’migrateInstances:to:’ – Class>>#’migrateInstancesTo:’ • Migration creates new instance and swaps identity – Old instance version remain visible from old views – Old instance GCed when no longer visible 29
  • 30. Agenda • Introduction • Architecture • Objects – Lookup (Object Table) – Versions (Commit Records) • Classes – Lookup (Namespaces) – Versions • Questions 30
  • 31. Questions? 31 GemTalk Systems LLC 15220 NW Greenbrier Pkwy., Suite 240 Beaverton, Oregon, 97006 Voice & Fax: +1 503 766 4714 james.foster@gemtalksystems.com James G. Foster Director of Operations www.gemtalksystems.com ®