SlideShare a Scribd company logo
1 of 96
Download to read offline
Things I Wish I Knew about GemStone/S
ESUG 2011, Friday, 11:45 – 12:30
James Foster, Sr. Member Technical Staff




                                           © 2010 VMware Inc. All rights reserved
Inspiration

 Nick Ager
    • Suggested a session covering "the tools, common problems (eg empty
     statements, classHistory) backing-up and restoring, installation, Object Log,
     blocking vs Gem based servers, debugging, background processing etc."
 Johan Brichau
    • "Count me in too ;-)"
 Stephan Eggermont
 Norbert Hartl
    • "Great idea. I'm in."
 Diego Lont
 Tobias Pape
    • "/me rises his hand."
 Conrad Taylor

2
Abstract

 This presentation provides an introduction to GemStone/S, a multi-
    user Smalltalk with a built-in database. We briefly examine some
    issues observed by people who transition to GemStone/S from
    other Smalltalks.
 Depending on time, these topics may include installation, tools,
    backup/restore, class versions, debugging, concurrence,
    background processing, and repository-wide garbage collection.
 Caveat:
    • There are three multi-day courses on GemStone/S.
    • 45 minutes is not enough time to cover any topic in depth!




3
Presenter

 Software Background
    • As a junior-high student in 1971, I discovered the local university‘s computer
     center and a life-long obsession with computers began.
    • I was introduced to Smalltalk/V for the Mac in the mid-90s, and became a
     Smalltalk bigot.
    • I am on the Smalltalk Engineering team at VMware, and am a passionate
     advocate for GemStone and Seaside.
 Past Careers
    • Commercial Pilot
    • Lawyer
 Other interests
    • Economics
    • Politics
    • Religion


4
Agenda

   Installation
   Architecture
   Tools
   Backup/Restore
   Class Versions
   Debugging
   Concurrence
   Background Processing




5
Installing GemStone/S 64 Bit




6
Install Guide and Other Documentation

 http://community.gemstone.com/display/GSS64/GemStoneS+64+Documentation
 Release Notes
 Install Guides
    • Solaris
    • AIX
    • Linux
    • HP/UX
    • Mac/Darwin
   Programming Guide
   Systems Admin Guide
   Topaz Programming Guide
   GemBuilder for C



7
Product Distribution

 ftp://ftp.gemstone.com/pub/GemStone64/2.4.4.7




8
Suggested Install Location

 /opt/gemstone/              # root for GemStone-related things
    • /opt/gemstone/<productDirectory>/
      • Add symbolic link from /opt/gemstone/product
    • /opt/gemstone/backups
    • /opt/gemstone/bin
    • /opt/gemstone/data
    • /opt/gemstone/etc
    • /opt/gemstone/locks
    • /opt/gemstone/log
    • /opt/gemstone/Monticello
    • /opt/gemstone/product
      • $GEMSTONE points here




9
Operating System Configuration

 Shared Memory settings in /etc/sysctl.conf
 Linux:
 • kern.shmmax = nnnn        # max shared memory segment in bytes
 • kern.shmall = nnnn         # max 4096-byte pages for shared memory
 Macintosh:
 • kern.sysv.shmmax = nnnn    # max shared memory segment in bytes
 • kern.sysv.shmall = nnn     # max 4096-byte pages for shared memory




10
Environment Variables

 See System Administration Guide, Appendix E for full list
 • GEMSTONE                            # full path to product
     • /opt/gemstone/product
 • GEMSTONE_EXE_CONF                   # dir or file for executable config files
     • /opt/gemstone/etc
 • GEMSTONE_NRS_ALL                    # settings for default directory, log files, etc.
     • #dir:/opt/gemstone#log:/var/log/gemstone/%N_%P.log
 • GEMSTONE_SYS_CONF                   # dir or file for system-wide config file
     • /opt/gemstone/etc/system.conf
 • upgradeLogDir                       # used for upgrade to new GS/S version


 • PATH should include $GEMSTONE/bin




11
Keyfile Capabilities

 Use of GemStone/S 64 Bit requires a "keyfile" that identifies
 allowed capabilities (with "Web Edition" no-cost license limits)
 • Max repository size (unlimited)
 • Max object count (unlimited)
 • Max concurrent logins (unlimited)
 • Expiration date (none)
 • Machine type (Linux or Macintosh)
 • Max shared page cache (2 GB)
 • Max CPUs used (2)
 • Allow use of traversal buffer in GCI-to-Gem communications (no)
     • Required for use of GemBuilder for Smalltalk (for VA Smalltalk and Cincom Smalltalk)
 • Allow Gems on non-Stone machine (no)




12
Keyfile Location

 $GEMSTONE/seaside/etc/gemstone.key is Web Edition keyfile
 • Also available from http://seaside.gemstone.com/etc/
 Location specified in config file to override default
 • KEYFILE = $GEMSTONE/sys/gemstone.key




13
Config File

 Default is at $GEMSTONE/data/system.conf
 • GEMSTONE_SYS_CONF environment variable specifies another location
 Four (4) required configurations (included in default file)
 • DBF_EXTENT_NAMES = $GEMSTONE/data/extent0.dbf;
 • STN_TRAN_FULL_LOGGING = FALSE;
 • STN_TRAN_LOG_DIRECTORIES = $GEMSTONE/data/, $GEMSTONE/data/;
 • STN_TRAN_LOG_SIZES = 100, 100;
 Suggest a file such as /opt/gemstone/etc/seaside.conf
 • Include only non-default configurations
 • Above plus KEYFILE




14
Agenda

   Installation
   Architecture
   Tools
   Backup/Restore
   Class Versions
   Debugging
   Concurrence
   Background Processing
   Repository-wide Garbage Collection




15
Architecture:
     What is Different about GemStone?




16
GemStone Enhancements over Typical Smalltalk

 Large object space
 • Object space is (in practice) limited only by disk (not by RAM)
 Transactions
 • Related updates can be grouped in an ―all-or-nothing‖ transaction
 Persistence
 • Transactions are immediately recorded to a log file
 Multi-user
 • Thousands of virtual machines can interact with a single object space
 Multi-machine
 • Virtual machines can be on hundreds of hosts




17
Complexities

 Large object space
 • Disk is slow, so cache recently-used objects in RAM
 Transactions
 • Group changes to support roll-back (abort)
 Persistence
 • Recover recent changes in event of crash
 Multi-user
 • Isolate each user‘s view (repeatable read)
 • Manage concurrency conflicts (avoid simultaneous updates to same object)
 • Manage object and class versions (when are updates visible to others?)
 Multi-machine
 • Coordinate object updates between machines



18
Programming Issues

 Garbage collection (GC)
 • Temporary objects local to virtual machine
 • Persistent objects in shared object space
 Large collections
 • Iterating can be slow
 • Use indexes to improve performance
 Transactions
 • Maintaining obsolete views can be expensive
 • Object versions (different views of same object can see different values)
 • Class versions (schema updates are not immediately applied to objects)
 • Avoiding unnecessary concurrency conflicts




19
Architecture:
     How it is Done




20
GemStone Architecture

 Repository
 • Disk-based ―image‖ holds objects and other data      Repository

 • Made up of extents (files or raw partitions)
 • Objects are on 16k pages
 Gem Process(s)
                                           Gem
 • Single Smalltalk virtual machine
 Stone Process                                         Stone
 • Manages concurrency
 Shared Page Cache                               SPC

 • Fast cache of pages from repository                     SPC
                                                          Monitor
 • Managed by SPC Monitor process
 Other Processes
 • GC Gems, Symbol Gem, AIO Page Server, Free Frame Server, etc.


21
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                           Repository
 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
 Statistics: FreePages (Gem vs. Stone)

22
System Startup

 „startstone‟ command
 • Command line arguments for database name and other configurations
 • Finds and opens all extents specified in required config file
 • Finds and opens transaction log specified in required config file
 • Starts Shared Page Cache (SPC) Monitor process (which allocates SPC)
 • Starts other processes
     •   AIO Page Server(s)
     •   Free Frame Server(s)
     •   Symbol Gem
     •   GC Admin Gem
     •   Reclaim Gem(s)
 • Restores missing transactions if last shutdown was not clean (i.e., crash)
 • Waits for requests from Gems (login, lock, commit, etc.)



23
Shared Page Cache

   Typical database challenge: disk is slow
   In-RAM cache of pages from repository
                                                               SPC
   Gem(s) may “attach” (or lock) in-use Frames
   Frame may contain a “dirty” page
   Async IO Page Server(s) write to repository
                                                              16 KB
                                                              Frame

   Reuse frame only if it is unattached and clean
   Free Frame List                       Free Frame List
                                             Frame #5
    • Maintained by SPC Monitor
                                             Frame #7
                                                            Repository
    • Might be incomplete                    Frame #8
    • Gem might be forced to scan cache
 Free Frame Server(s) scan for unattached & clean



24
Shared Page Cache Statistics

 Shrpc                         Gem, Stn
 • FreeFrameCount
                                • AttachDelta
 • GlobalDirtyPageCount
                                • AttachedCount
 • LocalDirtyPageCount
                                • FramesFromFindFree
 • TargetFreeFrameCount
                                • FramesFromFreeList
 • TotalAttached
                                • LocalPageCacheHits
 Pgsvr                         • LocalPageCacheMisses
 • FramesAddedToFreeList        • NonSharedAttached
                                • TimeInFramesFromFindFree




25
Gem Types

 Linked Gem
                                                    OS Process
 • Application loads GemStone C Interface            Application &
     (GCI) library into its process space
                                                      GCI Library
 • GCI library contains Gem code and runs in
     Application‘s OS process space
                                                       Gem

 Remote Procedure Call (RPC) Gem
 • Application loads GCI library into its process   OS Process 1
     space                                            Application &
                                                      GCI Library
 • GCI library asks NetLDI process to start Gem
     process                                                 TCP/IP
 • Gem process can be on same or different
     host as application
                                                    OS Process 2
 • Additional communications overhead                 Gem
 • Reduced risk of application corrupting Gem

26
One-Machine Process Locations (Linked Gem)

                                      Stone Host


                                      Stone
                                               SPC




     Application
       & GCI
                   Gem                        Repository
       Library




27
One-Machine Process Locations (RPC Gem)

                                     Stone Host

                                                  NetLDI
                                     Stone
                                              SPC




 Application
                Gem                          Repository
     & GCI
     Library




28
Two-Machine Process Locations (Gem on Stone Host)

Client Host                           Stone Host

                                                    NetLDI
               N                      Stone
               E                                SPC

               T
               W
 Application
                   Gem                         Repository
     & GCI     O
     Library
               R
               K



29
Two-Machine Process Locations (Gem Remote from Stone)

                  Gem Host             Stone Host

                        NetLDI                      NetLDI
                                  N   Stone
                                  E             SPC
                          Page
                         Server   T
                                  W
 Application
                Gem               O            Repository
     & GCI                            Page
     Library                          Server
                                  R
                  Remote SPC
                                  K




30
Three-Machine Process Locations

Client Host         Gem Host             Stone Host

                          NetLDI                      NetLDI
               N                    N   Stone
               E                    E             SPC
                            Page

               T           Server   T

               W                    W
 Application
                   Gem              O            Repository
     & GCI     O                        Page
     Library                            Server
               R                    R
                    Remote SPC
               K                    K




31
Gem Startup

 Gem process started (if RPC)
 • Linked Gem started with Application
 • RPC Gem started by NetLDI based on request from Application (via GCI)
 Application requests login
 • Application provides Stone host and name to Gem through GCI library
 • Gem contacts Stone and is assigned a session ID and a database view
 • Gem connects to SPC on local machine
     • Stone asks NetLDI on Gem host to start SPC Monitor if needed
 • Application provides user ID and password to Gem through GCI library and
     Gem validates user based on lookup in database
 Login complete
 • Gem now waits for requests from GCI
 • Application submits requests to GCI for Smalltalk execution or objects



32
Architecture:
     Database View and Commit Records




33
Database View and Commit Record

 On login, Gem has a database view
                                                        Object Table
 Object Table                                        Object ID Page ID
 • Object ID (OID) == Object Oriented Pointer (OOP)    246               10343
 • Map to Page (offset in an Extent)                   247               10343
 • Each view is based on a single Object Table
                                                       248               -1

 Each commit creates a Commit Record
                                                        Object Table Reference
 • Reference to unique Object Table
 • List of modified objects (Write Set)                      Write Set
 • List of Shadowed Pages
                                                          Shadowed Pages




34
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


                               Gem1      Gem2

                        login          login commit
                             abort       commit

                        CR1      CR2     CR3
35
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 — a large CR Backlog is bad!
 Problems with excess Commit Records
 • They take space in SharedPageCache and/or Repository
 • They slow down new commit processing
 • They delay garbage collection

                                   Gem1    Gem2

                                                          commit

                                    CR2    CR3 ……. CRn
36
SigAbort

 Important to avoid excessive CR Backlog
 Signal requesting an abort (SigAbort) sent to a Gem if and only if:
 1. Gem is referencing the oldest Commit Record
 2. Gem is not in transaction
 3. CR Backlog is above configured value
 If Gem responds quickly to SigAbort, good!
 Stone can dispose of oldest unreferenced CR(s)

                    SigAbort
                                Gem1       Gem2

                                      abort

                                 CR2       CR3 ……. CRn
37
LostOtRoot

 If a SigAbort was sent to a Gem and it was ignored for X minutes
 • X is configurable, with default of one (1)
 Stone will revoke the Gem‟s database view (Commit Record)
 Stone will send Gem a signal: LostOtRoot (Lost Object Table Root)
 • Any object access will give an error
 Stone can dispose of oldest unreferenced CR(s)
 Gem must abort to get a new Commit Record (or logout)

                    LostOtRoot
                                   Gem1           Gem2

                                                abort

                                     CR2          CR3 ……. CRn
38
Transaction State vs. Mode

 Transaction state
 • In – commit attempt is allowed (might succeed or fail)
 • Out – commit attempt is not allowed and will always give an error
 Transaction mode
 • #autoBegin – always in a transaction with a stable view
 • #manualBegin – can be in or out, but always a stable view
 • #transactionless – can be in or out, stable view only when in transaction
                        #autoBegin          #manualBegin        #transactionless
Always in                    
Stable view in                                                        
Stable view out             N/A                   
Can get SigAbort                                  
Can get SigFinish            
Safe for GBS                                     

39
Transaction Control

 System abortTransaction
 • Abort, losing any existing changes and obtain the most recent Commit Record
 • New transaction state:
     • ‗In transaction‘ if transaction mode is #autoBegin
     • ‗Out of transaction‘ if transaction mode is #manualBegin or #transactionless
 System beginTransaction
 • Abort, losing any existing changes and obtain the most recent Commit Record
 • Enter the ‗in transaction‘ state (for all transaction modes)
 System commitTransaction
 • If commit succeeds, new transaction state:
     • ‗In transaction‘ if transaction mode is #autoBegin
     • ‗Out of transaction‘ if transaction mode is #manualBegin or #transactionless
 • If commit fails, see next slide …



40
Failed Commit

 Reasons for a commit failure
 • Another Gem has a lock (read or write) on an object we modified
 • An object we modified was modified in a Commit Record after we got our view
 Impact of commit failure
 • Update to most recent Commit Record
     • No longer on prior Commit Record, so database view is updated; but …
 • Still have all locally modified objects
     • New database view does not change local modifications of persistent objects
 • Still in transaction
     • But any further commit attempt will fail
 • Gem will need to abort before any subsequent commit can succeed
     • Abort will lose all local modifications of persistent objects
     • May wish to copy modifications into other objects before abort
     • Could reapply changes after abort and attempt another commit


41
Agenda

   Installation
   Architecture
   Tools
   Backup/Restore
   Class Versions
   Debugging
   Concurrence
   Background Processing
   Repository-wide Garbage Collection




42
Tools




43
Tools

 Traditional
 • GemBuilder for Smalltalk (GBS)
 • Topaz
 • Visual Statistics Display (VSD)
 • Transaction log analysis scripts
 Built using other Smalltalks
 • GemTools (Pharo)
 • Jade (Windows/Dolphin)
 Web
 • tODE
 • WebTools




44
GemBuilder for Smalltalk

 Smalltalk package that wraps GCI library
 • Cincom Smalltalk (VisualWorks)
 • VA Smalltalk from Instantiations (formerly VisualAge Smalltalk from IBM)
 Provides "transparent" replication between server Smalltalk and
 client Smalltalk
 • Traditionally used to build "rich client" GUI applications
 Tools
 • Code browser
 • Debugger
 • Inspector
 • UserProfile editor
 •…
 Not available in Web Edition


45
Topaz

 Command-line wrapper for GCI library
 Limited scripting capabilities
 • No control flow (loop/conditionals)
 Used extensively by GemStone's internal developers
 • Used to load code (see $GEMSTONE/upgrade)
 • Used to test server
 • Preferred way to report server product bugs
 Primary customer use is for batch jobs
 • SystemRepository>>#fullBackupTo:
 • SystemRepository>>#markForCollection
 Useful when GUI-based tools are not available
 • SSH to production server behind firewall over WAN



46
Visual Statistics Display (VSD)

 Each process records data to shared page cache (SPC)
 • Many values exist and are constantly updated (220 for Gems, 272 for Stone)
 • Any process attached to SPC can monitor other processes on same host
 $GEMSTONE/bin/statmonitor
 • Periodically copies current data to a file for later analysis
 • Every production system should be capturing statistics for later analysis
 • If Gems are on separate machine from Stone, need additional statmonitors
 VSD application
 • $GEMSTONE/bin/vsd contains an X Window System application (Linux/Mac)
 • Window version at http://community.gemstone.com/display/GSS64/VSD
 Vital uses
 • Performance tuning
 • Crash analysis


47
Transaction Log Analysis Scripts

 All changes to persistent objects take place in a transaction
 • Record of each transaction in transaction logs
 Primary use is to replay transactions
 • After restore from backup
 • Restart after crash
 Scripts are available to search tranlogs
 • Traditional use is for bug analysis ("How did that happen!?")
 • Recent enhancements for forensic analysis ("Who made that change?")
 System Administration Guide, Appendix H
 • $GEMSTONE/bin/printlogs.sh
 • $GEMSTONE/bin/searchlogs.sh




48
GemTools

 Pharo-based GUI application
 • Uses Squeak's FFI interface to interact with GCI library
 • Pharo is used to provide GUI (primarily with OmniBrowser)
 • No support for object replication—pretend that Pharo Smalltalk doesn't exist
 Tools
 • Code browser, Monticello browser, Metacello browser
 • Workspace, Debugger, Inspector
 • Backup/restore menus
 Closely tied to GLASS
 • Use of OB means many round-trips to server for each action
 Download from http://seaside.gemstone.com/downloads.html




49
Jade

 Windows-only stand-alone 1 MB executable build with Dolphin
 • Works with all GemStone/S versions (32-bit and 64-bit)
 • Does not require any server code to be pre-loaded
 • Optimized for slow network (most operations require only one round-trip)
 Tools
 • Code browser, Monticello browser
 • Workspace, Debugger, Inspector
 Download from http://seaside.gemstone.com/jade/




50
tODE – the Object (Centric) Development Environment

 Seaside-based web application
 • Runs in Pharo and GemStone
 • Non-traditional approach to tools
 Tools
 • Code browser, Metacello browser
 • Workspace, Debugger, Inspector
 Web Resources
 • Code at http://code.google.com/p/tode/
 • Mailing list at http://groups.google.com/group/tode_st




51
WebTools

 Javascript application
 • Uses async Json queries to lightweight web server in GemStone
 • Not a Seaside application; available in any GemStone/S 64 Bit 3.0 database
 Tools
 • Code browser
 • Statmonitor file graphing
 Extensible with plug-in tools
 Code distributed in $GEMSTONE/examples/www/




52
Agenda

   Installation
   Architecture
   Tools
   Backup/Restore
   Class Versions
   Debugging
   Concurrence
   Background Processing
   Repository-wide Garbage Collection




53
Backup and Restore




54
Documentation

 System Administration Guide for GemStone/S 64 Bit
 Chapter 9: Making and Restoring Backups




55
Types of Backups

 Off-line Extent Copy
 Smalltalk Backup
 On-line Extent Copy




56
Off-line Extent Copy

 Make a copy of extent(s) when system is down.
 Advantages
 • Simple to make
 • Simple to restore
 Disadvantages
 • System must be down
 • Copy includes empty space and non-object data
 Recommended for
 • Development systems
 • Systems that are regularly down due to usage patterns and hardware needs




57
Smalltalk Backup

 Evaluate 'SystemRepository fullBackupTo: aFilePath'
 • Alternative method: #'fullBackupCompressedTo:'
 • Other methods support multi-file backups to limit file size (for tape backups!)
 Advantages
 • Traditional means
 • Compact size contains only objects
 • Restore results in minimal extent size(s)
 Disadvantages
 • Can take significant time to create backup
 • Gem process holds a transaction for initial phase
 • Restore process more time-consuming
 Recommended for:
 • Smaller systems that have not experienced any of the disadvantages


58
Hybrid: On-line Extent Copy

 Process
 1. Suspend checkpoints
 2. Copy extent(s)
 3. Resume checkpoints
 Advantages
 •   On-line
 •   Most work is done by OS file copy (as compared to Smalltalk backup)
 •   Can take advantage of hardware features (split a mirror)
 Disadvantages
 •   More complex to create & restore
 •   Backup might be invalid if checkpoints resumed too early
 Recommended for:
 •   Larger systems


59
Recomendation

 Validate backup file
 • copydbf extentOrBackup /dev/null
 Test your restore process
 Keep transaction logs associated with backup




60
Agenda

   Installation
   Architecture
   Tools
   Backup/Restore
   Class Versions
   Debugging
   Concurrence
   Background Processing
   Repository-wide Garbage Collection




61
Class Versions




62
Documentation

 GemStone/S 64 Bit Programming Guide
 Chapter 9
 • Class Creation,
 • Versions,
 • and Instance Migration




63
Class Creation

 Send #'subclass:…' message to object that will be superclass
 What happens in traditional Smalltalks if class already exists?
 • Create new class object
 • Copy and recompile methods to new class
 • Find all instances of old class
 • Create new instances of new class for each instance of old class
 • Copy values in instance variables from old to new instances
 • Perform #'become:'-like action to swap old and new instances
 • Perform #'become:'-like action to swap old and new classes
 • Garbage collect to remove old class and instances
 Can't do this in GemStone
 • Scanning large object space would take too long
 • Modifying objects in other session's views would violate isolation


64
Class Versions

 Every class is part of a ClassHistory collection
  • Others are related but may have different name and/or schema
  • Might be only one Class in ClassHistory
 Object>>#'isKindOf:' checks superclasses and ClassHistory
 Most compiled references to a Class will be updated automatically
  • Methods do not reference a Class, but a SymbolAssociation with a value
 Methods are typically copied and recompiled by tools
  • Low-level subclass creation does not automatically create methods
 Instances are left with old class until migrated explicitly




65
Instance Migration

 Could leave instances of old class as-is
 • Provide method(s) that answer default values for missing instance variables
 Could migrate all at once
 • Make instance migration part of general application upgrade process
 • Application down-time
 • Find all instances and migrate them in one or more transactions
 Could do lazy migration
 • Modify code to migrate before any message is sent to old object
 • Simple if limited lookup path(s) to object
 • Elaborate approach of replacing methods on old class to migrate self
 • Could still have background process to finish migration as soon as possible




66
Agenda

   Installation
   Architecture
   Tools
   Backup/Restore
   Class Versions
   Debugging
   Concurrence
   Background Processing
   Repository-wide Garbage Collection




67
Debugging




68
Debugging – Printing/Logging

 System class>>#'addAllToStoneLog:'
 GsFile class
  • #'stdout'
  • #'stderr'
  • #'gciLogClient:'
  • #'gciLogServer:'
 TranscriptProxy class>>#'show:'
  • Global Transcript points to TranscriptProxy class
  • Creates an ObjectLogEntry
  • Will send to client if client has registered a ClientForwarder
  • Otherwise sends GsFile class>>#'gciLogServer:'
 Store value in global
  • UserGlobals at: #'James' put: 'got to step #1 at ' , DateTime now printString


69
Debugging – Halt and Breakpoints

 Object>>#'halt'
 • Signals a Halt exception
 • Might be trapped by Exception handlers
 • Typically reports exception back to GCI client (Topaz, GemTools, etc)
 • Similar behavior for most other Error exceptions
 Set breakpoint in method
 • Does not require modifying source code
 • Applies only to current Gem
 • Require tool support (or GsNMethod>>#'setBreakAtStepPoint:')




70
Remote Debugging

 DebuggerLogEntry (subclass of ObjectLogEntry)
 • Application may persist a continuation with an error
     • DebuggerLogEntry class>>#'createContinuationLabeled:'
 • Tools may support opening a debugger on persisted continuation




71
Agenda

   Installation
   Architecture
   Tools
   Backup/Restore
   Class Versions
   Debugging
   Concurrence
   Background Processing
   Repository-wide Garbage Collection




72
Concurrence




73
Documentation

 GemStone/S 64 Bit Programming Guide
 Chapter 7
 • Transactions and Concurrency Control




74
Concurrency Issues

 GemStone prevents simultaneous updates to same object
 • Each session starts with a database view
 • First to commit wins
 • Other sessions will get a TransactionConflict error if objects have changed
 • This is "optimistic locking"
 Short transactions reduce likelihood of this "physical" conflict
 • Abort just before making change and then commit immediately
 • Note that value might change based on abort!




75
Logical Conflict

 Seaside framework (mostly) addresses physical conflict problem
 • Abort performed immediately before executing callbacks and rendering page
 • TransactionConflict error is handled by abort then retrying (up to 10 times)
 • Odds are that another attempt will succeed
 Application is responsible for detecting "logical" conflicts
 • User may enter data based on old view of database
 • Abort may switch to newer view with different data than presented to user
 • Seaside will do abort and then replace existing (possibly changed) value with
     user's entry




76
Explicit Locking

 Pessimistic Locking
 • System class>>#'writeLock:' (and friends)
 • If you are successful in obtaining a write lock, then no other session may
     commit a change to that object
 • Your view might be out-of-date, however, and you need an abort/commit
     before modifying the locked object




77
Reduced Conflict Classes

 Certain overlapping modifications to an object might be okay
 • Multiple sessions adding objects to a collection
 • Adding, changing, or removing the value at different keys in a Dictionary
 • Incrementing a counter
 GemStone provides classes that avoid well-defined conflicts
 • RcCounter
 • RcIdentityBag
 • RcQueue
 • RcKeyValueDictionary
 Trade-off of slight overhead for avoiding conflicts




78
Agenda

   Installation
   Architecture
   Tools
   Backup/Restore
   Class Versions
   Debugging
   Concurrence
   Background Processing
   Repository-wide Garbage Collection




79
Background Processing




80
Session View

 A single VM (Gem) has a single database view
 • A forked Process (via ExecutableBlock>>#'fork') runs in the same view
 • A commit or abort by any Smalltalk Process in the session will change the view
     for all Smalltalk code running in the Gem
 Typical Smalltalk patterns will not work
 • Fork a Process to handle a web request using a unique ODBC connection
 • Fork a Process to handle a long-running background task using a unique DB
 • Fork a Process to handle web requests and edit code in foreground
 Need a separate Gem for each independent activity




81
Background Processing In GemStone

 Define a 'cron' job for regular maintenance (backup and MFC)
 Start a dedicated Topaz session for background jobs
 • Multiple "producers" add tasks to a well-known collection (e.g., an RcQueue)
 • Single "consumer" takes tasks from queue, and processes them
 • Gem does only one task at a time, in a transaction
 • On TransactionConflict error, abort and start over




82
Agenda

   Installation
   Architecture
   Tools
   Backup/Restore
   Class Versions
   Debugging
   Concurrence
   Background Processing
   Repository-wide Garbage Collection




83
Repository Garbage Collection




84
Types of Repository Garbage Collection

 Page reclamation
 • Recovering space taken by shadow objects
 • Compacting space by copying objects from partially filled pages
 Full markForCollection
 • Scan the entire repository for any references to every object
 Epoch GC
 • Scan the objects modified during a time period (epoch) for new references to
     new objects
 Off-line GC
 • Scan the entire repository for any references to objects found to be
     unreferenced by an off-line scan




85
Garbage Collection Vocabulary

 AllUsers
 • The instance of UserProfileSet that acts as a root for the object graph
 Live object
 • An object referenced directly or indirectly from AllUsers
 Dead object
 • An object defined in the object table and present on a page, but not live
 • A dead object may be referenced by a dead object (but not a live object)
 • A dead object may reference both live and dead objects (but it doesn‘t matter)
 • The object ID (OOP) and the space of a dead object may be reclaimed
 Shadow object
 • When an existing object is modified, it is placed on a new page
 • The old page is preserved until no more views reference the old object
 • The space can be reclaimed (through page compaction), but not the object ID


86
Summary of Repository-Wide Garbage Collection

 MFC Gem builds possible dead set
 • Mark live objects
 • Object table sweep
 • Record possible dead
 Voting to remove from possible dead set (managed by Stone)
 • Current gems vote based on current references at next commit or abort
 • GcGem votes on behalf of all commit records since start of MFC
 Cleanup
 • Finalizing for selected objects
 • Page reclamation
 • Return of pages and object IDs to free pool




87
Mark Live Objects

 Find connected objects
 • Start with AllUsers as the root of the object graph (the original ‗live‘ object)
 • Perform a ‗transitive closure‘ visiting each object referenced from a live object
 • Add each live object to a live object set
 Gem: ProgressCount
 • Number of live objects found so far
 • When this statistic drops back to zero, this step is done
 Configuration
 • Set mfcGcPageBufSize
 Process is very I/O and CPU intensive
 • Read object table page and data page for every live object
 • Same page might be read multiple times



88
Object Table Sweep

 Subtract live objects from all objects to get possible dead set
 Gem: ProgressCount
 • Begins at zero (clearing from previous step)
 • Count of possible dead objects
 • When this statistic drops back to zero, this step is done




89
Record Possible Dead

 Pass possible dead set to stone
 MFC Gem‟s task is now done
 Stn: PossibleDeadSize
 • Rough approximation of possible dead set size




90
Voting by Existing Gems

 As each logged-in Gem does an abort or commit
 • Stone passes list of possible dead to Gem for voting
 • Gem scans its private memory for references to the objects
 • Referenced objects are voted ‗not dead‘
 Gem Statistic
 • VoteNotDead
 Stn Statistics
 • GcPossibleDeadSize
 • GcVoteUnderway
 • SessionNotVoted
 Garbage collection can stall here
 • Voting happens only at the next abort or commit
 • A quiet Gem that does not abort or commit will not vote


91
Voting by GcGem („Finalize Voting‟)

   Original live object set is based on view at beginning of MFC
   Any commit since MFC began could have created a reference
   A „write set union‟ of all commit records since MFC began is kept
   GcGem takes possible dead set and searches for new references
   Stn statistics:
    • GcPossibleDeadWsUnionSize
    • GcSweepCount
    • GcPossibleDeadSize
    • DeadNotReclaimedSize
 Gem statistic:
    • ProgressCount
 At end, we have a definitive dead object set


92
Cleanup: Finalizing

 GcGem reads each object in the dead set
 Certain dead objects require special cleanup
 • Collections with indexes
 • Compiled methods
 Gem: ProgressCount
 Stn: GcPossibleDeadSize
 Stn: DeadNotReclaimed




93
Cleanup: Reclamation

 GcGem activity
 For each page containing a dead object
  • In a transaction, copy all live objects on that page to a new page
  • This leaves only shadow objects (the current version is on a new page), dead
     objects, and free space on the old page
 Note that the old page might still be referenced from a view
  • Shadow objects need to be kept around as long as they are part of a view
 Stn statistics
  • GcReclaimState
  • GcReclaimNewDataPagesCount
  • DeadObjsCount
  • FreePages
  • GcPagesNeedReclaimSize
  • DeadNotReclaimedSize

94
Cleanup: Return to Free Pool

 When commit record for reclaim activity is no longer referenced
 Page IDs and Object IDs associated with that reclaim are added to
 the free list




95
Questions?

 James Foster
 • jfoster@vmware.com
 • http://programminggems.wordpress.com/




96

More Related Content

What's hot

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisDvir Volk
 
PostgreSQL + ZFS best practices
PostgreSQL + ZFS best practicesPostgreSQL + ZFS best practices
PostgreSQL + ZFS best practicesSean Chittenden
 
Gluster fs architecture_&amp;_roadmap-vijay_bellur-linuxcon_eu_2013
Gluster fs architecture_&amp;_roadmap-vijay_bellur-linuxcon_eu_2013Gluster fs architecture_&amp;_roadmap-vijay_bellur-linuxcon_eu_2013
Gluster fs architecture_&amp;_roadmap-vijay_bellur-linuxcon_eu_2013Gluster.org
 
Dustin Black - Red Hat Storage Server Administration Deep Dive
Dustin Black - Red Hat Storage Server Administration Deep DiveDustin Black - Red Hat Storage Server Administration Deep Dive
Dustin Black - Red Hat Storage Server Administration Deep DiveGluster.org
 
Azure storage deep dive
Azure storage deep diveAzure storage deep dive
Azure storage deep diveYves Goeleven
 
Gluster fs architecture_future_directions_tlv
Gluster fs architecture_future_directions_tlvGluster fs architecture_future_directions_tlv
Gluster fs architecture_future_directions_tlvSahina Bose
 
CloverETL + Hadoop
CloverETL + HadoopCloverETL + Hadoop
CloverETL + HadoopDavid Pavlis
 
BlueStore, A New Storage Backend for Ceph, One Year In
BlueStore, A New Storage Backend for Ceph, One Year InBlueStore, A New Storage Backend for Ceph, One Year In
BlueStore, A New Storage Backend for Ceph, One Year InSage Weil
 
Cassandra EU 2012 - Storage Internals by Nicolas Favre-Felix
Cassandra EU 2012 - Storage Internals by Nicolas Favre-FelixCassandra EU 2012 - Storage Internals by Nicolas Favre-Felix
Cassandra EU 2012 - Storage Internals by Nicolas Favre-FelixAcunu
 
OSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey KopytovOSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey KopytovNETWAYS
 
Gluster fs for_storage_admins_glusterfs_meetup_07_feb
Gluster fs for_storage_admins_glusterfs_meetup_07_febGluster fs for_storage_admins_glusterfs_meetup_07_feb
Gluster fs for_storage_admins_glusterfs_meetup_07_febbipin kunal
 
Lisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introductionLisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introductionGluster.org
 
SSD Deployment Strategies for MySQL
SSD Deployment Strategies for MySQLSSD Deployment Strategies for MySQL
SSD Deployment Strategies for MySQLYoshinori Matsunobu
 
Lcna tutorial-2012
Lcna tutorial-2012Lcna tutorial-2012
Lcna tutorial-2012Gluster.org
 
ZFS Workshop
ZFS WorkshopZFS Workshop
ZFS WorkshopAPNIC
 
Glusterfs and openstack
Glusterfs  and openstackGlusterfs  and openstack
Glusterfs and openstackopenstackindia
 
Introduction to highly_availablenfs_server_on_scale-out_storage_systems_based...
Introduction to highly_availablenfs_server_on_scale-out_storage_systems_based...Introduction to highly_availablenfs_server_on_scale-out_storage_systems_based...
Introduction to highly_availablenfs_server_on_scale-out_storage_systems_based...Gluster.org
 
Inno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structureInno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structurezhaolinjnu
 

What's hot (20)

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
PostgreSQL + ZFS best practices
PostgreSQL + ZFS best practicesPostgreSQL + ZFS best practices
PostgreSQL + ZFS best practices
 
Gluster fs architecture_&amp;_roadmap-vijay_bellur-linuxcon_eu_2013
Gluster fs architecture_&amp;_roadmap-vijay_bellur-linuxcon_eu_2013Gluster fs architecture_&amp;_roadmap-vijay_bellur-linuxcon_eu_2013
Gluster fs architecture_&amp;_roadmap-vijay_bellur-linuxcon_eu_2013
 
Dustin Black - Red Hat Storage Server Administration Deep Dive
Dustin Black - Red Hat Storage Server Administration Deep DiveDustin Black - Red Hat Storage Server Administration Deep Dive
Dustin Black - Red Hat Storage Server Administration Deep Dive
 
Azure storage deep dive
Azure storage deep diveAzure storage deep dive
Azure storage deep dive
 
Gluster fs architecture_future_directions_tlv
Gluster fs architecture_future_directions_tlvGluster fs architecture_future_directions_tlv
Gluster fs architecture_future_directions_tlv
 
CloverETL + Hadoop
CloverETL + HadoopCloverETL + Hadoop
CloverETL + Hadoop
 
BlueStore, A New Storage Backend for Ceph, One Year In
BlueStore, A New Storage Backend for Ceph, One Year InBlueStore, A New Storage Backend for Ceph, One Year In
BlueStore, A New Storage Backend for Ceph, One Year In
 
Cassandra EU 2012 - Storage Internals by Nicolas Favre-Felix
Cassandra EU 2012 - Storage Internals by Nicolas Favre-FelixCassandra EU 2012 - Storage Internals by Nicolas Favre-Felix
Cassandra EU 2012 - Storage Internals by Nicolas Favre-Felix
 
OSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey KopytovOSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
 
Gluster fs for_storage_admins_glusterfs_meetup_07_feb
Gluster fs for_storage_admins_glusterfs_meetup_07_febGluster fs for_storage_admins_glusterfs_meetup_07_feb
Gluster fs for_storage_admins_glusterfs_meetup_07_feb
 
Lisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introductionLisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introduction
 
SSD Deployment Strategies for MySQL
SSD Deployment Strategies for MySQLSSD Deployment Strategies for MySQL
SSD Deployment Strategies for MySQL
 
Shadow forensics print
Shadow forensics printShadow forensics print
Shadow forensics print
 
Lcna tutorial-2012
Lcna tutorial-2012Lcna tutorial-2012
Lcna tutorial-2012
 
ZFS Workshop
ZFS WorkshopZFS Workshop
ZFS Workshop
 
Glusterfs and openstack
Glusterfs  and openstackGlusterfs  and openstack
Glusterfs and openstack
 
Introduction to highly_availablenfs_server_on_scale-out_storage_systems_based...
Introduction to highly_availablenfs_server_on_scale-out_storage_systems_based...Introduction to highly_availablenfs_server_on_scale-out_storage_systems_based...
Introduction to highly_availablenfs_server_on_scale-out_storage_systems_based...
 
Inno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structureInno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structure
 
YDAL Barcelona
YDAL BarcelonaYDAL Barcelona
YDAL Barcelona
 

Similar to Things I wish I knew about GemStone

GemStone/64 product update and road map
GemStone/64 product update and road mapGemStone/64 product update and road map
GemStone/64 product update and road mapESUG
 
Introduction to Memory-Style Storage in Linux
Introduction to Memory-Style Storage in LinuxIntroduction to Memory-Style Storage in Linux
Introduction to Memory-Style Storage in LinuxClay (Chih-Hao) Chang
 
SQL Queries on Smalltalk Objects
SQL Queries on Smalltalk ObjectsSQL Queries on Smalltalk Objects
SQL Queries on Smalltalk ObjectsESUG
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)MongoDB
 
EuroSec2012 "Effects of Memory Randomization, Sanitization and Page Cache on ...
EuroSec2012 "Effects of Memory Randomization, Sanitization and Page Cache on ...EuroSec2012 "Effects of Memory Randomization, Sanitization and Page Cache on ...
EuroSec2012 "Effects of Memory Randomization, Sanitization and Page Cache on ...Kuniyasu Suzaki
 
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...Alluxio, Inc.
 
Tuning Your SharePoint Environment
Tuning Your SharePoint EnvironmentTuning Your SharePoint Environment
Tuning Your SharePoint Environmentvmaximiuk
 
azure track -04- azure storage deep dive
azure track -04- azure storage deep diveazure track -04- azure storage deep dive
azure track -04- azure storage deep diveITProceed
 
Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...Alluxio, Inc.
 
Unity Internals: Memory and Performance
Unity Internals: Memory and PerformanceUnity Internals: Memory and Performance
Unity Internals: Memory and PerformanceDevGAMM Conference
 
Vmwareperformancetroubleshooting 100224104321-phpapp02 (1)
Vmwareperformancetroubleshooting 100224104321-phpapp02 (1)Vmwareperformancetroubleshooting 100224104321-phpapp02 (1)
Vmwareperformancetroubleshooting 100224104321-phpapp02 (1)Suresh Kumar
 
Vmwareperformancetroubleshooting 100224104321-phpapp02
Vmwareperformancetroubleshooting 100224104321-phpapp02Vmwareperformancetroubleshooting 100224104321-phpapp02
Vmwareperformancetroubleshooting 100224104321-phpapp02Suresh Kumar
 
Front end for back end developers
Front end for back end developersFront end for back end developers
Front end for back end developersWojciech Bednarski
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage SystemsSATOSHI TAGOMORI
 
Dissecting Scalable Database Architectures
Dissecting Scalable Database ArchitecturesDissecting Scalable Database Architectures
Dissecting Scalable Database Architectureshypertable
 
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018Amazon Web Services
 
Driver development – memory management
Driver development – memory managementDriver development – memory management
Driver development – memory managementVandana Salve
 

Similar to Things I wish I knew about GemStone (20)

GemStone/64 product update and road map
GemStone/64 product update and road mapGemStone/64 product update and road map
GemStone/64 product update and road map
 
Introduction to Memory-Style Storage in Linux
Introduction to Memory-Style Storage in LinuxIntroduction to Memory-Style Storage in Linux
Introduction to Memory-Style Storage in Linux
 
SQL Queries on Smalltalk Objects
SQL Queries on Smalltalk ObjectsSQL Queries on Smalltalk Objects
SQL Queries on Smalltalk Objects
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)
 
EuroSec2012 "Effects of Memory Randomization, Sanitization and Page Cache on ...
EuroSec2012 "Effects of Memory Randomization, Sanitization and Page Cache on ...EuroSec2012 "Effects of Memory Randomization, Sanitization and Page Cache on ...
EuroSec2012 "Effects of Memory Randomization, Sanitization and Page Cache on ...
 
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-sensitive queries for Presto at Facebook: A Collaboration ...
 
Tuning Your SharePoint Environment
Tuning Your SharePoint EnvironmentTuning Your SharePoint Environment
Tuning Your SharePoint Environment
 
azure track -04- azure storage deep dive
azure track -04- azure storage deep diveazure track -04- azure storage deep dive
azure track -04- azure storage deep dive
 
Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...
 
Unity Internals: Memory and Performance
Unity Internals: Memory and PerformanceUnity Internals: Memory and Performance
Unity Internals: Memory and Performance
 
Vmwareperformancetroubleshooting 100224104321-phpapp02 (1)
Vmwareperformancetroubleshooting 100224104321-phpapp02 (1)Vmwareperformancetroubleshooting 100224104321-phpapp02 (1)
Vmwareperformancetroubleshooting 100224104321-phpapp02 (1)
 
Vmwareperformancetroubleshooting 100224104321-phpapp02
Vmwareperformancetroubleshooting 100224104321-phpapp02Vmwareperformancetroubleshooting 100224104321-phpapp02
Vmwareperformancetroubleshooting 100224104321-phpapp02
 
Front end for back end developers
Front end for back end developersFront end for back end developers
Front end for back end developers
 
Kinetic basho public
Kinetic basho publicKinetic basho public
Kinetic basho public
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage Systems
 
Dissecting Scalable Database Architectures
Dissecting Scalable Database ArchitecturesDissecting Scalable Database Architectures
Dissecting Scalable Database Architectures
 
Open ebs 101
Open ebs 101Open ebs 101
Open ebs 101
 
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018
 
Tuning Linux for MongoDB
Tuning Linux for MongoDBTuning Linux for MongoDB
Tuning Linux for MongoDB
 
Driver development – memory management
Driver development – memory managementDriver development – memory management
Driver development – memory management
 

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

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
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
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
 
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
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Recently uploaded (20)

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)
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
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
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
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
 
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
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 

Things I wish I knew about GemStone

  • 1. Things I Wish I Knew about GemStone/S ESUG 2011, Friday, 11:45 – 12:30 James Foster, Sr. Member Technical Staff © 2010 VMware Inc. All rights reserved
  • 2. Inspiration  Nick Ager • Suggested a session covering "the tools, common problems (eg empty statements, classHistory) backing-up and restoring, installation, Object Log, blocking vs Gem based servers, debugging, background processing etc."  Johan Brichau • "Count me in too ;-)"  Stephan Eggermont  Norbert Hartl • "Great idea. I'm in."  Diego Lont  Tobias Pape • "/me rises his hand."  Conrad Taylor 2
  • 3. Abstract  This presentation provides an introduction to GemStone/S, a multi- user Smalltalk with a built-in database. We briefly examine some issues observed by people who transition to GemStone/S from other Smalltalks.  Depending on time, these topics may include installation, tools, backup/restore, class versions, debugging, concurrence, background processing, and repository-wide garbage collection.  Caveat: • There are three multi-day courses on GemStone/S. • 45 minutes is not enough time to cover any topic in depth! 3
  • 4. Presenter  Software Background • As a junior-high student in 1971, I discovered the local university‘s computer center and a life-long obsession with computers began. • I was introduced to Smalltalk/V for the Mac in the mid-90s, and became a Smalltalk bigot. • I am on the Smalltalk Engineering team at VMware, and am a passionate advocate for GemStone and Seaside.  Past Careers • Commercial Pilot • Lawyer  Other interests • Economics • Politics • Religion 4
  • 5. Agenda  Installation  Architecture  Tools  Backup/Restore  Class Versions  Debugging  Concurrence  Background Processing 5
  • 7. Install Guide and Other Documentation  http://community.gemstone.com/display/GSS64/GemStoneS+64+Documentation  Release Notes  Install Guides • Solaris • AIX • Linux • HP/UX • Mac/Darwin  Programming Guide  Systems Admin Guide  Topaz Programming Guide  GemBuilder for C 7
  • 9. Suggested Install Location  /opt/gemstone/ # root for GemStone-related things • /opt/gemstone/<productDirectory>/ • Add symbolic link from /opt/gemstone/product • /opt/gemstone/backups • /opt/gemstone/bin • /opt/gemstone/data • /opt/gemstone/etc • /opt/gemstone/locks • /opt/gemstone/log • /opt/gemstone/Monticello • /opt/gemstone/product • $GEMSTONE points here 9
  • 10. Operating System Configuration  Shared Memory settings in /etc/sysctl.conf  Linux: • kern.shmmax = nnnn # max shared memory segment in bytes • kern.shmall = nnnn # max 4096-byte pages for shared memory  Macintosh: • kern.sysv.shmmax = nnnn # max shared memory segment in bytes • kern.sysv.shmall = nnn # max 4096-byte pages for shared memory 10
  • 11. Environment Variables  See System Administration Guide, Appendix E for full list • GEMSTONE # full path to product • /opt/gemstone/product • GEMSTONE_EXE_CONF # dir or file for executable config files • /opt/gemstone/etc • GEMSTONE_NRS_ALL # settings for default directory, log files, etc. • #dir:/opt/gemstone#log:/var/log/gemstone/%N_%P.log • GEMSTONE_SYS_CONF # dir or file for system-wide config file • /opt/gemstone/etc/system.conf • upgradeLogDir # used for upgrade to new GS/S version • PATH should include $GEMSTONE/bin 11
  • 12. Keyfile Capabilities  Use of GemStone/S 64 Bit requires a "keyfile" that identifies allowed capabilities (with "Web Edition" no-cost license limits) • Max repository size (unlimited) • Max object count (unlimited) • Max concurrent logins (unlimited) • Expiration date (none) • Machine type (Linux or Macintosh) • Max shared page cache (2 GB) • Max CPUs used (2) • Allow use of traversal buffer in GCI-to-Gem communications (no) • Required for use of GemBuilder for Smalltalk (for VA Smalltalk and Cincom Smalltalk) • Allow Gems on non-Stone machine (no) 12
  • 13. Keyfile Location  $GEMSTONE/seaside/etc/gemstone.key is Web Edition keyfile • Also available from http://seaside.gemstone.com/etc/  Location specified in config file to override default • KEYFILE = $GEMSTONE/sys/gemstone.key 13
  • 14. Config File  Default is at $GEMSTONE/data/system.conf • GEMSTONE_SYS_CONF environment variable specifies another location  Four (4) required configurations (included in default file) • DBF_EXTENT_NAMES = $GEMSTONE/data/extent0.dbf; • STN_TRAN_FULL_LOGGING = FALSE; • STN_TRAN_LOG_DIRECTORIES = $GEMSTONE/data/, $GEMSTONE/data/; • STN_TRAN_LOG_SIZES = 100, 100;  Suggest a file such as /opt/gemstone/etc/seaside.conf • Include only non-default configurations • Above plus KEYFILE 14
  • 15. Agenda  Installation  Architecture  Tools  Backup/Restore  Class Versions  Debugging  Concurrence  Background Processing  Repository-wide Garbage Collection 15
  • 16. Architecture: What is Different about GemStone? 16
  • 17. GemStone Enhancements over Typical Smalltalk  Large object space • Object space is (in practice) limited only by disk (not by RAM)  Transactions • Related updates can be grouped in an ―all-or-nothing‖ transaction  Persistence • Transactions are immediately recorded to a log file  Multi-user • Thousands of virtual machines can interact with a single object space  Multi-machine • Virtual machines can be on hundreds of hosts 17
  • 18. Complexities  Large object space • Disk is slow, so cache recently-used objects in RAM  Transactions • Group changes to support roll-back (abort)  Persistence • Recover recent changes in event of crash  Multi-user • Isolate each user‘s view (repeatable read) • Manage concurrency conflicts (avoid simultaneous updates to same object) • Manage object and class versions (when are updates visible to others?)  Multi-machine • Coordinate object updates between machines 18
  • 19. Programming Issues  Garbage collection (GC) • Temporary objects local to virtual machine • Persistent objects in shared object space  Large collections • Iterating can be slow • Use indexes to improve performance  Transactions • Maintaining obsolete views can be expensive • Object versions (different views of same object can see different values) • Class versions (schema updates are not immediately applied to objects) • Avoiding unnecessary concurrency conflicts 19
  • 20. Architecture: How it is Done 20
  • 21. GemStone Architecture  Repository • Disk-based ―image‖ holds objects and other data Repository • Made up of extents (files or raw partitions) • Objects are on 16k pages  Gem Process(s) Gem • Single Smalltalk virtual machine  Stone Process Stone • Manages concurrency  Shared Page Cache SPC • Fast cache of pages from repository SPC Monitor • Managed by SPC Monitor process  Other Processes • GC Gems, Symbol Gem, AIO Page Server, Free Frame Server, etc. 21
  • 22. 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 Repository  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  Statistics: FreePages (Gem vs. Stone) 22
  • 23. System Startup  „startstone‟ command • Command line arguments for database name and other configurations • Finds and opens all extents specified in required config file • Finds and opens transaction log specified in required config file • Starts Shared Page Cache (SPC) Monitor process (which allocates SPC) • Starts other processes • AIO Page Server(s) • Free Frame Server(s) • Symbol Gem • GC Admin Gem • Reclaim Gem(s) • Restores missing transactions if last shutdown was not clean (i.e., crash) • Waits for requests from Gems (login, lock, commit, etc.) 23
  • 24. Shared Page Cache  Typical database challenge: disk is slow  In-RAM cache of pages from repository SPC  Gem(s) may “attach” (or lock) in-use Frames  Frame may contain a “dirty” page  Async IO Page Server(s) write to repository 16 KB Frame  Reuse frame only if it is unattached and clean  Free Frame List Free Frame List Frame #5 • Maintained by SPC Monitor Frame #7 Repository • Might be incomplete Frame #8 • Gem might be forced to scan cache  Free Frame Server(s) scan for unattached & clean 24
  • 25. Shared Page Cache Statistics  Shrpc  Gem, Stn • FreeFrameCount • AttachDelta • GlobalDirtyPageCount • AttachedCount • LocalDirtyPageCount • FramesFromFindFree • TargetFreeFrameCount • FramesFromFreeList • TotalAttached • LocalPageCacheHits  Pgsvr • LocalPageCacheMisses • FramesAddedToFreeList • NonSharedAttached • TimeInFramesFromFindFree 25
  • 26. Gem Types  Linked Gem OS Process • Application loads GemStone C Interface Application & (GCI) library into its process space GCI Library • GCI library contains Gem code and runs in Application‘s OS process space Gem  Remote Procedure Call (RPC) Gem • Application loads GCI library into its process OS Process 1 space Application & GCI Library • GCI library asks NetLDI process to start Gem process TCP/IP • Gem process can be on same or different host as application OS Process 2 • Additional communications overhead Gem • Reduced risk of application corrupting Gem 26
  • 27. One-Machine Process Locations (Linked Gem) Stone Host Stone SPC Application & GCI Gem Repository Library 27
  • 28. One-Machine Process Locations (RPC Gem) Stone Host NetLDI Stone SPC Application Gem Repository & GCI Library 28
  • 29. Two-Machine Process Locations (Gem on Stone Host) Client Host Stone Host NetLDI N Stone E SPC T W Application Gem Repository & GCI O Library R K 29
  • 30. Two-Machine Process Locations (Gem Remote from Stone) Gem Host Stone Host NetLDI NetLDI N Stone E SPC Page Server T W Application Gem O Repository & GCI Page Library Server R Remote SPC K 30
  • 31. Three-Machine Process Locations Client Host Gem Host Stone Host NetLDI NetLDI N N Stone E E SPC Page T Server T W W Application Gem O Repository & GCI O Page Library Server R R Remote SPC K K 31
  • 32. Gem Startup  Gem process started (if RPC) • Linked Gem started with Application • RPC Gem started by NetLDI based on request from Application (via GCI)  Application requests login • Application provides Stone host and name to Gem through GCI library • Gem contacts Stone and is assigned a session ID and a database view • Gem connects to SPC on local machine • Stone asks NetLDI on Gem host to start SPC Monitor if needed • Application provides user ID and password to Gem through GCI library and Gem validates user based on lookup in database  Login complete • Gem now waits for requests from GCI • Application submits requests to GCI for Smalltalk execution or objects 32
  • 33. Architecture: Database View and Commit Records 33
  • 34. Database View and Commit Record  On login, Gem has a database view Object Table  Object Table Object ID Page ID • Object ID (OID) == Object Oriented Pointer (OOP) 246 10343 • Map to Page (offset in an Extent) 247 10343 • Each view is based on a single Object Table 248 -1  Each commit creates a Commit Record Object Table Reference • Reference to unique Object Table • List of modified objects (Write Set) Write Set • List of Shadowed Pages Shadowed Pages 34
  • 35. 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 Gem1 Gem2 login login commit abort commit CR1 CR2 CR3 35
  • 36. 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 — a large CR Backlog is bad!  Problems with excess Commit Records • They take space in SharedPageCache and/or Repository • They slow down new commit processing • They delay garbage collection Gem1 Gem2 commit CR2 CR3 ……. CRn 36
  • 37. SigAbort  Important to avoid excessive CR Backlog  Signal requesting an abort (SigAbort) sent to a Gem if and only if: 1. Gem is referencing the oldest Commit Record 2. Gem is not in transaction 3. CR Backlog is above configured value  If Gem responds quickly to SigAbort, good!  Stone can dispose of oldest unreferenced CR(s) SigAbort Gem1 Gem2 abort CR2 CR3 ……. CRn 37
  • 38. LostOtRoot  If a SigAbort was sent to a Gem and it was ignored for X minutes • X is configurable, with default of one (1)  Stone will revoke the Gem‟s database view (Commit Record)  Stone will send Gem a signal: LostOtRoot (Lost Object Table Root) • Any object access will give an error  Stone can dispose of oldest unreferenced CR(s)  Gem must abort to get a new Commit Record (or logout) LostOtRoot Gem1 Gem2 abort CR2 CR3 ……. CRn 38
  • 39. Transaction State vs. Mode  Transaction state • In – commit attempt is allowed (might succeed or fail) • Out – commit attempt is not allowed and will always give an error  Transaction mode • #autoBegin – always in a transaction with a stable view • #manualBegin – can be in or out, but always a stable view • #transactionless – can be in or out, stable view only when in transaction #autoBegin #manualBegin #transactionless Always in  Stable view in    Stable view out N/A  Can get SigAbort  Can get SigFinish  Safe for GBS   39
  • 40. Transaction Control  System abortTransaction • Abort, losing any existing changes and obtain the most recent Commit Record • New transaction state: • ‗In transaction‘ if transaction mode is #autoBegin • ‗Out of transaction‘ if transaction mode is #manualBegin or #transactionless  System beginTransaction • Abort, losing any existing changes and obtain the most recent Commit Record • Enter the ‗in transaction‘ state (for all transaction modes)  System commitTransaction • If commit succeeds, new transaction state: • ‗In transaction‘ if transaction mode is #autoBegin • ‗Out of transaction‘ if transaction mode is #manualBegin or #transactionless • If commit fails, see next slide … 40
  • 41. Failed Commit  Reasons for a commit failure • Another Gem has a lock (read or write) on an object we modified • An object we modified was modified in a Commit Record after we got our view  Impact of commit failure • Update to most recent Commit Record • No longer on prior Commit Record, so database view is updated; but … • Still have all locally modified objects • New database view does not change local modifications of persistent objects • Still in transaction • But any further commit attempt will fail • Gem will need to abort before any subsequent commit can succeed • Abort will lose all local modifications of persistent objects • May wish to copy modifications into other objects before abort • Could reapply changes after abort and attempt another commit 41
  • 42. Agenda  Installation  Architecture  Tools  Backup/Restore  Class Versions  Debugging  Concurrence  Background Processing  Repository-wide Garbage Collection 42
  • 44. Tools  Traditional • GemBuilder for Smalltalk (GBS) • Topaz • Visual Statistics Display (VSD) • Transaction log analysis scripts  Built using other Smalltalks • GemTools (Pharo) • Jade (Windows/Dolphin)  Web • tODE • WebTools 44
  • 45. GemBuilder for Smalltalk  Smalltalk package that wraps GCI library • Cincom Smalltalk (VisualWorks) • VA Smalltalk from Instantiations (formerly VisualAge Smalltalk from IBM)  Provides "transparent" replication between server Smalltalk and client Smalltalk • Traditionally used to build "rich client" GUI applications  Tools • Code browser • Debugger • Inspector • UserProfile editor •…  Not available in Web Edition 45
  • 46. Topaz  Command-line wrapper for GCI library  Limited scripting capabilities • No control flow (loop/conditionals)  Used extensively by GemStone's internal developers • Used to load code (see $GEMSTONE/upgrade) • Used to test server • Preferred way to report server product bugs  Primary customer use is for batch jobs • SystemRepository>>#fullBackupTo: • SystemRepository>>#markForCollection  Useful when GUI-based tools are not available • SSH to production server behind firewall over WAN 46
  • 47. Visual Statistics Display (VSD)  Each process records data to shared page cache (SPC) • Many values exist and are constantly updated (220 for Gems, 272 for Stone) • Any process attached to SPC can monitor other processes on same host  $GEMSTONE/bin/statmonitor • Periodically copies current data to a file for later analysis • Every production system should be capturing statistics for later analysis • If Gems are on separate machine from Stone, need additional statmonitors  VSD application • $GEMSTONE/bin/vsd contains an X Window System application (Linux/Mac) • Window version at http://community.gemstone.com/display/GSS64/VSD  Vital uses • Performance tuning • Crash analysis 47
  • 48. Transaction Log Analysis Scripts  All changes to persistent objects take place in a transaction • Record of each transaction in transaction logs  Primary use is to replay transactions • After restore from backup • Restart after crash  Scripts are available to search tranlogs • Traditional use is for bug analysis ("How did that happen!?") • Recent enhancements for forensic analysis ("Who made that change?")  System Administration Guide, Appendix H • $GEMSTONE/bin/printlogs.sh • $GEMSTONE/bin/searchlogs.sh 48
  • 49. GemTools  Pharo-based GUI application • Uses Squeak's FFI interface to interact with GCI library • Pharo is used to provide GUI (primarily with OmniBrowser) • No support for object replication—pretend that Pharo Smalltalk doesn't exist  Tools • Code browser, Monticello browser, Metacello browser • Workspace, Debugger, Inspector • Backup/restore menus  Closely tied to GLASS • Use of OB means many round-trips to server for each action  Download from http://seaside.gemstone.com/downloads.html 49
  • 50. Jade  Windows-only stand-alone 1 MB executable build with Dolphin • Works with all GemStone/S versions (32-bit and 64-bit) • Does not require any server code to be pre-loaded • Optimized for slow network (most operations require only one round-trip)  Tools • Code browser, Monticello browser • Workspace, Debugger, Inspector  Download from http://seaside.gemstone.com/jade/ 50
  • 51. tODE – the Object (Centric) Development Environment  Seaside-based web application • Runs in Pharo and GemStone • Non-traditional approach to tools  Tools • Code browser, Metacello browser • Workspace, Debugger, Inspector  Web Resources • Code at http://code.google.com/p/tode/ • Mailing list at http://groups.google.com/group/tode_st 51
  • 52. WebTools  Javascript application • Uses async Json queries to lightweight web server in GemStone • Not a Seaside application; available in any GemStone/S 64 Bit 3.0 database  Tools • Code browser • Statmonitor file graphing  Extensible with plug-in tools  Code distributed in $GEMSTONE/examples/www/ 52
  • 53. Agenda  Installation  Architecture  Tools  Backup/Restore  Class Versions  Debugging  Concurrence  Background Processing  Repository-wide Garbage Collection 53
  • 55. Documentation  System Administration Guide for GemStone/S 64 Bit  Chapter 9: Making and Restoring Backups 55
  • 56. Types of Backups  Off-line Extent Copy  Smalltalk Backup  On-line Extent Copy 56
  • 57. Off-line Extent Copy  Make a copy of extent(s) when system is down.  Advantages • Simple to make • Simple to restore  Disadvantages • System must be down • Copy includes empty space and non-object data  Recommended for • Development systems • Systems that are regularly down due to usage patterns and hardware needs 57
  • 58. Smalltalk Backup  Evaluate 'SystemRepository fullBackupTo: aFilePath' • Alternative method: #'fullBackupCompressedTo:' • Other methods support multi-file backups to limit file size (for tape backups!)  Advantages • Traditional means • Compact size contains only objects • Restore results in minimal extent size(s)  Disadvantages • Can take significant time to create backup • Gem process holds a transaction for initial phase • Restore process more time-consuming  Recommended for: • Smaller systems that have not experienced any of the disadvantages 58
  • 59. Hybrid: On-line Extent Copy  Process 1. Suspend checkpoints 2. Copy extent(s) 3. Resume checkpoints  Advantages • On-line • Most work is done by OS file copy (as compared to Smalltalk backup) • Can take advantage of hardware features (split a mirror)  Disadvantages • More complex to create & restore • Backup might be invalid if checkpoints resumed too early  Recommended for: • Larger systems 59
  • 60. Recomendation  Validate backup file • copydbf extentOrBackup /dev/null  Test your restore process  Keep transaction logs associated with backup 60
  • 61. Agenda  Installation  Architecture  Tools  Backup/Restore  Class Versions  Debugging  Concurrence  Background Processing  Repository-wide Garbage Collection 61
  • 63. Documentation  GemStone/S 64 Bit Programming Guide  Chapter 9 • Class Creation, • Versions, • and Instance Migration 63
  • 64. Class Creation  Send #'subclass:…' message to object that will be superclass  What happens in traditional Smalltalks if class already exists? • Create new class object • Copy and recompile methods to new class • Find all instances of old class • Create new instances of new class for each instance of old class • Copy values in instance variables from old to new instances • Perform #'become:'-like action to swap old and new instances • Perform #'become:'-like action to swap old and new classes • Garbage collect to remove old class and instances  Can't do this in GemStone • Scanning large object space would take too long • Modifying objects in other session's views would violate isolation 64
  • 65. Class Versions  Every class is part of a ClassHistory collection • Others are related but may have different name and/or schema • Might be only one Class in ClassHistory  Object>>#'isKindOf:' checks superclasses and ClassHistory  Most compiled references to a Class will be updated automatically • Methods do not reference a Class, but a SymbolAssociation with a value  Methods are typically copied and recompiled by tools • Low-level subclass creation does not automatically create methods  Instances are left with old class until migrated explicitly 65
  • 66. Instance Migration  Could leave instances of old class as-is • Provide method(s) that answer default values for missing instance variables  Could migrate all at once • Make instance migration part of general application upgrade process • Application down-time • Find all instances and migrate them in one or more transactions  Could do lazy migration • Modify code to migrate before any message is sent to old object • Simple if limited lookup path(s) to object • Elaborate approach of replacing methods on old class to migrate self • Could still have background process to finish migration as soon as possible 66
  • 67. Agenda  Installation  Architecture  Tools  Backup/Restore  Class Versions  Debugging  Concurrence  Background Processing  Repository-wide Garbage Collection 67
  • 69. Debugging – Printing/Logging  System class>>#'addAllToStoneLog:'  GsFile class • #'stdout' • #'stderr' • #'gciLogClient:' • #'gciLogServer:'  TranscriptProxy class>>#'show:' • Global Transcript points to TranscriptProxy class • Creates an ObjectLogEntry • Will send to client if client has registered a ClientForwarder • Otherwise sends GsFile class>>#'gciLogServer:'  Store value in global • UserGlobals at: #'James' put: 'got to step #1 at ' , DateTime now printString 69
  • 70. Debugging – Halt and Breakpoints  Object>>#'halt' • Signals a Halt exception • Might be trapped by Exception handlers • Typically reports exception back to GCI client (Topaz, GemTools, etc) • Similar behavior for most other Error exceptions  Set breakpoint in method • Does not require modifying source code • Applies only to current Gem • Require tool support (or GsNMethod>>#'setBreakAtStepPoint:') 70
  • 71. Remote Debugging  DebuggerLogEntry (subclass of ObjectLogEntry) • Application may persist a continuation with an error • DebuggerLogEntry class>>#'createContinuationLabeled:' • Tools may support opening a debugger on persisted continuation 71
  • 72. Agenda  Installation  Architecture  Tools  Backup/Restore  Class Versions  Debugging  Concurrence  Background Processing  Repository-wide Garbage Collection 72
  • 74. Documentation  GemStone/S 64 Bit Programming Guide  Chapter 7 • Transactions and Concurrency Control 74
  • 75. Concurrency Issues  GemStone prevents simultaneous updates to same object • Each session starts with a database view • First to commit wins • Other sessions will get a TransactionConflict error if objects have changed • This is "optimistic locking"  Short transactions reduce likelihood of this "physical" conflict • Abort just before making change and then commit immediately • Note that value might change based on abort! 75
  • 76. Logical Conflict  Seaside framework (mostly) addresses physical conflict problem • Abort performed immediately before executing callbacks and rendering page • TransactionConflict error is handled by abort then retrying (up to 10 times) • Odds are that another attempt will succeed  Application is responsible for detecting "logical" conflicts • User may enter data based on old view of database • Abort may switch to newer view with different data than presented to user • Seaside will do abort and then replace existing (possibly changed) value with user's entry 76
  • 77. Explicit Locking  Pessimistic Locking • System class>>#'writeLock:' (and friends) • If you are successful in obtaining a write lock, then no other session may commit a change to that object • Your view might be out-of-date, however, and you need an abort/commit before modifying the locked object 77
  • 78. Reduced Conflict Classes  Certain overlapping modifications to an object might be okay • Multiple sessions adding objects to a collection • Adding, changing, or removing the value at different keys in a Dictionary • Incrementing a counter  GemStone provides classes that avoid well-defined conflicts • RcCounter • RcIdentityBag • RcQueue • RcKeyValueDictionary  Trade-off of slight overhead for avoiding conflicts 78
  • 79. Agenda  Installation  Architecture  Tools  Backup/Restore  Class Versions  Debugging  Concurrence  Background Processing  Repository-wide Garbage Collection 79
  • 81. Session View  A single VM (Gem) has a single database view • A forked Process (via ExecutableBlock>>#'fork') runs in the same view • A commit or abort by any Smalltalk Process in the session will change the view for all Smalltalk code running in the Gem  Typical Smalltalk patterns will not work • Fork a Process to handle a web request using a unique ODBC connection • Fork a Process to handle a long-running background task using a unique DB • Fork a Process to handle web requests and edit code in foreground  Need a separate Gem for each independent activity 81
  • 82. Background Processing In GemStone  Define a 'cron' job for regular maintenance (backup and MFC)  Start a dedicated Topaz session for background jobs • Multiple "producers" add tasks to a well-known collection (e.g., an RcQueue) • Single "consumer" takes tasks from queue, and processes them • Gem does only one task at a time, in a transaction • On TransactionConflict error, abort and start over 82
  • 83. Agenda  Installation  Architecture  Tools  Backup/Restore  Class Versions  Debugging  Concurrence  Background Processing  Repository-wide Garbage Collection 83
  • 85. Types of Repository Garbage Collection  Page reclamation • Recovering space taken by shadow objects • Compacting space by copying objects from partially filled pages  Full markForCollection • Scan the entire repository for any references to every object  Epoch GC • Scan the objects modified during a time period (epoch) for new references to new objects  Off-line GC • Scan the entire repository for any references to objects found to be unreferenced by an off-line scan 85
  • 86. Garbage Collection Vocabulary  AllUsers • The instance of UserProfileSet that acts as a root for the object graph  Live object • An object referenced directly or indirectly from AllUsers  Dead object • An object defined in the object table and present on a page, but not live • A dead object may be referenced by a dead object (but not a live object) • A dead object may reference both live and dead objects (but it doesn‘t matter) • The object ID (OOP) and the space of a dead object may be reclaimed  Shadow object • When an existing object is modified, it is placed on a new page • The old page is preserved until no more views reference the old object • The space can be reclaimed (through page compaction), but not the object ID 86
  • 87. Summary of Repository-Wide Garbage Collection  MFC Gem builds possible dead set • Mark live objects • Object table sweep • Record possible dead  Voting to remove from possible dead set (managed by Stone) • Current gems vote based on current references at next commit or abort • GcGem votes on behalf of all commit records since start of MFC  Cleanup • Finalizing for selected objects • Page reclamation • Return of pages and object IDs to free pool 87
  • 88. Mark Live Objects  Find connected objects • Start with AllUsers as the root of the object graph (the original ‗live‘ object) • Perform a ‗transitive closure‘ visiting each object referenced from a live object • Add each live object to a live object set  Gem: ProgressCount • Number of live objects found so far • When this statistic drops back to zero, this step is done  Configuration • Set mfcGcPageBufSize  Process is very I/O and CPU intensive • Read object table page and data page for every live object • Same page might be read multiple times 88
  • 89. Object Table Sweep  Subtract live objects from all objects to get possible dead set  Gem: ProgressCount • Begins at zero (clearing from previous step) • Count of possible dead objects • When this statistic drops back to zero, this step is done 89
  • 90. Record Possible Dead  Pass possible dead set to stone  MFC Gem‟s task is now done  Stn: PossibleDeadSize • Rough approximation of possible dead set size 90
  • 91. Voting by Existing Gems  As each logged-in Gem does an abort or commit • Stone passes list of possible dead to Gem for voting • Gem scans its private memory for references to the objects • Referenced objects are voted ‗not dead‘  Gem Statistic • VoteNotDead  Stn Statistics • GcPossibleDeadSize • GcVoteUnderway • SessionNotVoted  Garbage collection can stall here • Voting happens only at the next abort or commit • A quiet Gem that does not abort or commit will not vote 91
  • 92. Voting by GcGem („Finalize Voting‟)  Original live object set is based on view at beginning of MFC  Any commit since MFC began could have created a reference  A „write set union‟ of all commit records since MFC began is kept  GcGem takes possible dead set and searches for new references  Stn statistics: • GcPossibleDeadWsUnionSize • GcSweepCount • GcPossibleDeadSize • DeadNotReclaimedSize  Gem statistic: • ProgressCount  At end, we have a definitive dead object set 92
  • 93. Cleanup: Finalizing  GcGem reads each object in the dead set  Certain dead objects require special cleanup • Collections with indexes • Compiled methods  Gem: ProgressCount  Stn: GcPossibleDeadSize  Stn: DeadNotReclaimed 93
  • 94. Cleanup: Reclamation  GcGem activity  For each page containing a dead object • In a transaction, copy all live objects on that page to a new page • This leaves only shadow objects (the current version is on a new page), dead objects, and free space on the old page  Note that the old page might still be referenced from a view • Shadow objects need to be kept around as long as they are part of a view  Stn statistics • GcReclaimState • GcReclaimNewDataPagesCount • DeadObjsCount • FreePages • GcPagesNeedReclaimSize • DeadNotReclaimedSize 94
  • 95. Cleanup: Return to Free Pool  When commit record for reclaim activity is no longer referenced  Page IDs and Object IDs associated with that reclaim are added to the free list 95
  • 96. Questions?  James Foster • jfoster@vmware.com • http://programminggems.wordpress.com/ 96