SqueakSave An Automatic Object-Relational Mapping Framework

27
SqueakSave An Automatic Object-Relational Mapping Framework Thomas Kowark Robert Hirschfeld Michael Haupt Software Architecture Group Hasso-Plattner-Institut Potsdam www.hpi.uni-potsdam.de/swa lundi 31 août 2009

description

SqueakSave An Automatic Object-Relational Mapping Framework by Michael Haupt, ESUG09, Brest, France

Transcript of SqueakSave An Automatic Object-Relational Mapping Framework

Page 1: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSaveAn Automatic Object-Relational Mapping Framework

Thomas KowarkRobert Hirschfeld

Michael Haupt

Software Architecture GroupHasso-Plattner-Institut Potsdam

www.hpi.uni-potsdam.de/swa

lundi 31 août 2009

Page 2: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

Outline

• motivation• basic usage• framework architecture• performance• summary & outlook

2lundi 31 août 2009

Page 3: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

Available Persistence Approaches

• image storing• object databases• (object-)relational persistence

3lundi 31 août 2009

Page 4: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

SqueakSave – Project Goals

• automatic mapping deduction• simplistic API• seamless integration into existing applications

4lundi 31 août 2009

Page 5: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

Guiding Example

5

-email : string

-username : string

-password : string

User

Admin

Author

-tit le : string

-lastUpdate : dateTime

Blog

-tit le : string

-text : string

BlogPost

-author : string

-tit le : string

-text : string

Comment

1

1

+b log

0..*

1..*

+administeredBlogs

0..*

1

+comments

0..*

1

+blogPosts

1

0..* +followers

Visual Paradigm for UML Community Edition [not for commercial use]

lundi 31 août 2009

Page 6: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009 6

SqsConfig subclass: #BlogExampleSqsConfig instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'BlogExample'

BlogExampleSqsConfig class>>#connectionSpecification ^ SqsMySQLConnectionSpecification user: 'admin' password: 'password' database: 'blog_example_db'

• configuration based on naming conventions

API – Configuration

lundi 31 août 2009

Page 7: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009 7

author := Author new password: 'password'; username: 'testuser'; email: '[email protected]'. author blog: (Blog new title: 'My Blog').

author save.

...

author destroy.

API – Basic Operations

lundi 31 août 2009

Page 8: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

API – Queries

8

(SqsSearch for: User) detect: [:aUser | aUser username = 'testuser']

(SqsSearch for: Author) select: [:anAuthor | anAuthor blog blogPosts size > 10 ]

(SqsSearch for: Blog) anySatisfy: [:aBlog | aBlog blogPosts noneSatisfy: [:aBlogPost | aBlogPost comments isEmpty ] ]

(SqsSearch for: Blog) findByTitle: 'testblog'

(SqsSearch for: Comment) findByAuthor: 'author' andTitle: 'comment'.

lundi 31 août 2009

Page 9: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009 9

SqsBase

Object

SqsConnection

Class

SqsStorage

SqsClassInfo

SqsDescriptionHandler

SqsTableStructureHandler

SqsSession

SqsDatabaseAdapter

SqsDatabaseConnection

SqsProxy

SqsConnectionManager

0..1

0..*

1

1

1

1

1

1

1

1

1

0..*

0..*

1

1

0..*

tableStructureHandler

1

0..* +classInfo

connection

1

1

storedObject

class

descriptionHandler

+session

currentClass

instVarValue

dbAdapter

< < u s e > >

< < u s e > >

Visual Paradigm for UML Community Edition [not for commercial use]

Figure 4.1: Overview of SqueakSave System Classes.

the original variable name into the separate sub words and connects them with an underscore. Avariable named ‘userName’, for example, is thereby converted to the column name ‘user name’.This is required to provide simple compatibility with most other O/R mappers for dynamicprogramming language environments, such as ActiveRecord for Ruby on Rails (see chapter 5).

The mapping of the data types is implemented within class side methods that are namedsqsType. For all classes that are trivially mappable, this method has been implemented andreturns a SqueakSave internal string representation of the according SQL type. If the columnshave to be created, those internal representations are translated by the SqsDatabaseAdapterclasses into the specific values that are required by the current database servers’ SQL implemen-tation. Types with variable lengths, like strings, are additionally enriched with the informationabout the current length of the respective object. Hence, a string of length 50 will not only bemapped to TEXT or VARCHAR, but VARCHAR(50).

Non-trivial attribute types are mapped by a foreign key reference to the corresponding entry inthe table that represents the class of the respective object. The reference will always point to thetable of the base class, i.e., the first class in the inheritance chain below Object or a class thatis marked like depicted in section 3.3.3, which is especially important in class table inheritancestructures. They are created in such a way, that a separate table for each subclass is created andonly contains the attributes that are defined within this class. Therefore, a foreign key constraintpointing to only such a sub table would prevent the possibility to reference objects of super orsubclasses.

28

SqueakSave – Architecture

lundi 31 août 2009

Page 10: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009 9

SqsBase

Object

SqsConnection

Class

SqsStorage

SqsClassInfo

SqsDescriptionHandler

SqsTableStructureHandler

SqsSession

SqsDatabaseAdapter

SqsDatabaseConnection

SqsProxy

SqsConnectionManager

0..1

0..*

1

1

1

1

1

1

1

1

1

0..*

0..*

1

1

0..*

tableStructureHandler

1

0..* +classInfo

connection

1

1

storedObject

class

descriptionHandler

+session

currentClass

instVarValue

dbAdapter

< < u s e > >

< < u s e > >

Visual Paradigm for UML Community Edition [not for commercial use]

Figure 4.1: Overview of SqueakSave System Classes.

the original variable name into the separate sub words and connects them with an underscore. Avariable named ‘userName’, for example, is thereby converted to the column name ‘user name’.This is required to provide simple compatibility with most other O/R mappers for dynamicprogramming language environments, such as ActiveRecord for Ruby on Rails (see chapter 5).

The mapping of the data types is implemented within class side methods that are namedsqsType. For all classes that are trivially mappable, this method has been implemented andreturns a SqueakSave internal string representation of the according SQL type. If the columnshave to be created, those internal representations are translated by the SqsDatabaseAdapterclasses into the specific values that are required by the current database servers’ SQL implemen-tation. Types with variable lengths, like strings, are additionally enriched with the informationabout the current length of the respective object. Hence, a string of length 50 will not only bemapped to TEXT or VARCHAR, but VARCHAR(50).

Non-trivial attribute types are mapped by a foreign key reference to the corresponding entry inthe table that represents the class of the respective object. The reference will always point to thetable of the base class, i.e., the first class in the inheritance chain below Object or a class thatis marked like depicted in section 3.3.3, which is especially important in class table inheritancestructures. They are created in such a way, that a separate table for each subclass is created andonly contains the attributes that are defined within this class. Therefore, a foreign key constraintpointing to only such a sub table would prevent the possibility to reference objects of super orsubclasses.

28

anObject save

SqueakSave – Architecture

lundi 31 août 2009

Page 11: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009 9

SqsBase

Object

SqsConnection

Class

SqsStorage

SqsClassInfo

SqsDescriptionHandler

SqsTableStructureHandler

SqsSession

SqsDatabaseAdapter

SqsDatabaseConnection

SqsProxy

SqsConnectionManager

0..1

0..*

1

1

1

1

1

1

1

1

1

0..*

0..*

1

1

0..*

tableStructureHandler

1

0..* +classInfo

connection

1

1

storedObject

class

descriptionHandler

+session

currentClass

instVarValue

dbAdapter

< < u s e > >

< < u s e > >

Visual Paradigm for UML Community Edition [not for commercial use]

Figure 4.1: Overview of SqueakSave System Classes.

the original variable name into the separate sub words and connects them with an underscore. Avariable named ‘userName’, for example, is thereby converted to the column name ‘user name’.This is required to provide simple compatibility with most other O/R mappers for dynamicprogramming language environments, such as ActiveRecord for Ruby on Rails (see chapter 5).

The mapping of the data types is implemented within class side methods that are namedsqsType. For all classes that are trivially mappable, this method has been implemented andreturns a SqueakSave internal string representation of the according SQL type. If the columnshave to be created, those internal representations are translated by the SqsDatabaseAdapterclasses into the specific values that are required by the current database servers’ SQL implemen-tation. Types with variable lengths, like strings, are additionally enriched with the informationabout the current length of the respective object. Hence, a string of length 50 will not only bemapped to TEXT or VARCHAR, but VARCHAR(50).

Non-trivial attribute types are mapped by a foreign key reference to the corresponding entry inthe table that represents the class of the respective object. The reference will always point to thetable of the base class, i.e., the first class in the inheritance chain below Object or a class thatis marked like depicted in section 3.3.3, which is especially important in class table inheritancestructures. They are created in such a way, that a separate table for each subclass is created andonly contains the attributes that are defined within this class. Therefore, a foreign key constraintpointing to only such a sub table would prevent the possibility to reference objects of super orsubclasses.

28

Creation or fetching of unique SqsStorage wrapper instance

SqueakSave – Architecture

lundi 31 août 2009

Page 12: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009 9

SqsBase

Object

SqsConnection

Class

SqsStorage

SqsClassInfo

SqsDescriptionHandler

SqsTableStructureHandler

SqsSession

SqsDatabaseAdapter

SqsDatabaseConnection

SqsProxy

SqsConnectionManager

0..1

0..*

1

1

1

1

1

1

1

1

1

0..*

0..*

1

1

0..*

tableStructureHandler

1

0..* +classInfo

connection

1

1

storedObject

class

descriptionHandler

+session

currentClass

instVarValue

dbAdapter

< < u s e > >

< < u s e > >

Visual Paradigm for UML Community Edition [not for commercial use]

Figure 4.1: Overview of SqueakSave System Classes.

the original variable name into the separate sub words and connects them with an underscore. Avariable named ‘userName’, for example, is thereby converted to the column name ‘user name’.This is required to provide simple compatibility with most other O/R mappers for dynamicprogramming language environments, such as ActiveRecord for Ruby on Rails (see chapter 5).

The mapping of the data types is implemented within class side methods that are namedsqsType. For all classes that are trivially mappable, this method has been implemented andreturns a SqueakSave internal string representation of the according SQL type. If the columnshave to be created, those internal representations are translated by the SqsDatabaseAdapterclasses into the specific values that are required by the current database servers’ SQL implemen-tation. Types with variable lengths, like strings, are additionally enriched with the informationabout the current length of the respective object. Hence, a string of length 50 will not only bemapped to TEXT or VARCHAR, but VARCHAR(50).

Non-trivial attribute types are mapped by a foreign key reference to the corresponding entry inthe table that represents the class of the respective object. The reference will always point to thetable of the base class, i.e., the first class in the inheritance chain below Object or a class thatis marked like depicted in section 3.3.3, which is especially important in class table inheritancestructures. They are created in such a way, that a separate table for each subclass is created andonly contains the attributes that are defined within this class. Therefore, a foreign key constraintpointing to only such a sub table would prevent the possibility to reference objects of super orsubclasses.

28

Creation or update of mapping descriptions

SqueakSave – Architecture

lundi 31 août 2009

Page 13: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009 9

SqsBase

Object

SqsConnection

Class

SqsStorage

SqsClassInfo

SqsDescriptionHandler

SqsTableStructureHandler

SqsSession

SqsDatabaseAdapter

SqsDatabaseConnection

SqsProxy

SqsConnectionManager

0..1

0..*

1

1

1

1

1

1

1

1

1

0..*

0..*

1

1

0..*

tableStructureHandler

1

0..* +classInfo

connection

1

1

storedObject

class

descriptionHandler

+session

currentClass

instVarValue

dbAdapter

< < u s e > >

< < u s e > >

Visual Paradigm for UML Community Edition [not for commercial use]

Figure 4.1: Overview of SqueakSave System Classes.

the original variable name into the separate sub words and connects them with an underscore. Avariable named ‘userName’, for example, is thereby converted to the column name ‘user name’.This is required to provide simple compatibility with most other O/R mappers for dynamicprogramming language environments, such as ActiveRecord for Ruby on Rails (see chapter 5).

The mapping of the data types is implemented within class side methods that are namedsqsType. For all classes that are trivially mappable, this method has been implemented andreturns a SqueakSave internal string representation of the according SQL type. If the columnshave to be created, those internal representations are translated by the SqsDatabaseAdapterclasses into the specific values that are required by the current database servers’ SQL implemen-tation. Types with variable lengths, like strings, are additionally enriched with the informationabout the current length of the respective object. Hence, a string of length 50 will not only bemapped to TEXT or VARCHAR, but VARCHAR(50).

Non-trivial attribute types are mapped by a foreign key reference to the corresponding entry inthe table that represents the class of the respective object. The reference will always point to thetable of the base class, i.e., the first class in the inheritance chain below Object or a class thatis marked like depicted in section 3.3.3, which is especially important in class table inheritancestructures. They are created in such a way, that a separate table for each subclass is created andonly contains the attributes that are defined within this class. Therefore, a foreign key constraintpointing to only such a sub table would prevent the possibility to reference objects of super orsubclasses.

28

Calculation of changes to the relational database schema

SqueakSave – Architecture

lundi 31 août 2009

Page 14: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009 9

SqsBase

Object

SqsConnection

Class

SqsStorage

SqsClassInfo

SqsDescriptionHandler

SqsTableStructureHandler

SqsSession

SqsDatabaseAdapter

SqsDatabaseConnection

SqsProxy

SqsConnectionManager

0..1

0..*

1

1

1

1

1

1

1

1

1

0..*

0..*

1

1

0..*

tableStructureHandler

1

0..* +classInfo

connection

1

1

storedObject

class

descriptionHandler

+session

currentClass

instVarValue

dbAdapter

< < u s e > >

< < u s e > >

Visual Paradigm for UML Community Edition [not for commercial use]

Figure 4.1: Overview of SqueakSave System Classes.

the original variable name into the separate sub words and connects them with an underscore. Avariable named ‘userName’, for example, is thereby converted to the column name ‘user name’.This is required to provide simple compatibility with most other O/R mappers for dynamicprogramming language environments, such as ActiveRecord for Ruby on Rails (see chapter 5).

The mapping of the data types is implemented within class side methods that are namedsqsType. For all classes that are trivially mappable, this method has been implemented andreturns a SqueakSave internal string representation of the according SQL type. If the columnshave to be created, those internal representations are translated by the SqsDatabaseAdapterclasses into the specific values that are required by the current database servers’ SQL implemen-tation. Types with variable lengths, like strings, are additionally enriched with the informationabout the current length of the respective object. Hence, a string of length 50 will not only bemapped to TEXT or VARCHAR, but VARCHAR(50).

Non-trivial attribute types are mapped by a foreign key reference to the corresponding entry inthe table that represents the class of the respective object. The reference will always point to thetable of the base class, i.e., the first class in the inheritance chain below Object or a class thatis marked like depicted in section 3.3.3, which is especially important in class table inheritancestructures. They are created in such a way, that a separate table for each subclass is created andonly contains the attributes that are defined within this class. Therefore, a foreign key constraintpointing to only such a sub table would prevent the possibility to reference objects of super orsubclasses.

28

Connection pooling

SqueakSave – Architecture

lundi 31 août 2009

Page 15: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009 9

SqsBase

Object

SqsConnection

Class

SqsStorage

SqsClassInfo

SqsDescriptionHandler

SqsTableStructureHandler

SqsSession

SqsDatabaseAdapter

SqsDatabaseConnection

SqsProxy

SqsConnectionManager

0..1

0..*

1

1

1

1

1

1

1

1

1

0..*

0..*

1

1

0..*

tableStructureHandler

1

0..* +classInfo

connection

1

1

storedObject

class

descriptionHandler

+session

currentClass

instVarValue

dbAdapter

< < u s e > >

< < u s e > >

Visual Paradigm for UML Community Edition [not for commercial use]

Figure 4.1: Overview of SqueakSave System Classes.

the original variable name into the separate sub words and connects them with an underscore. Avariable named ‘userName’, for example, is thereby converted to the column name ‘user name’.This is required to provide simple compatibility with most other O/R mappers for dynamicprogramming language environments, such as ActiveRecord for Ruby on Rails (see chapter 5).

The mapping of the data types is implemented within class side methods that are namedsqsType. For all classes that are trivially mappable, this method has been implemented andreturns a SqueakSave internal string representation of the according SQL type. If the columnshave to be created, those internal representations are translated by the SqsDatabaseAdapterclasses into the specific values that are required by the current database servers’ SQL implemen-tation. Types with variable lengths, like strings, are additionally enriched with the informationabout the current length of the respective object. Hence, a string of length 50 will not only bemapped to TEXT or VARCHAR, but VARCHAR(50).

Non-trivial attribute types are mapped by a foreign key reference to the corresponding entry inthe table that represents the class of the respective object. The reference will always point to thetable of the base class, i.e., the first class in the inheritance chain below Object or a class thatis marked like depicted in section 3.3.3, which is especially important in class table inheritancestructures. They are created in such a way, that a separate table for each subclass is created andonly contains the attributes that are defined within this class. Therefore, a foreign key constraintpointing to only such a sub table would prevent the possibility to reference objects of super orsubclasses.

28

Schema update and object insertion or update

SqueakSave – Architecture

lundi 31 août 2009

Page 16: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

Query Analysis

• SQL statement generation through block execution with placeholder objects

• one placeholder class per ‘simple type’, SqsQueryObject and SqsQueryCollection for complex cases

10

(SqsSearch for: User) detect: [:aUser | aUser username = 'testuser']

lundi 31 août 2009

Page 17: SqueakSave An Automatic Object-Relational Mapping Framework

queryObject := SqsQueryObject new depictedClass: User.

result := aBlock value: queryObject.

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

Query Analysis

• SQL statement generation through block execution with placeholder objects

• one placeholder class per ‘simple type’, SqsQueryObject and SqsQueryCollection for complex cases

10

(SqsSearch for: User) detect: [:aUser | aUser username = 'testuser']

lundi 31 août 2009

Page 18: SqueakSave An Automatic Object-Relational Mapping Framework

The query object does not know what #username does, but generates the SQL to scope to the respective column.

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

Query Analysis

• SQL statement generation through block execution with placeholder objects

• one placeholder class per ‘simple type’, SqsQueryObject and SqsQueryCollection for complex cases

10

(SqsSearch for: User) detect: [:aUser | aUser username = 'testuser']

lundi 31 août 2009

Page 19: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

WHERE users.username

Query Analysis

• SQL statement generation through block execution with placeholder objects

• one placeholder class per ‘simple type’, SqsQueryObject and SqsQueryCollection for complex cases

10

(SqsSearch for: User) detect: [:aUser | aUser username = 'testuser']

lundi 31 août 2009

Page 20: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

Query Analysis

• SQL statement generation through block execution with placeholder objects

• one placeholder class per ‘simple type’, SqsQueryObject and SqsQueryCollection for complex cases

10

(SqsSearch for: User) detect: [:aUser | aUser username = 'testuser']

The result of the first call is an SqsQueryString. It knows how to map the #= to SQL properly.

lundi 31 août 2009

Page 21: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

WHERE users.username =

Query Analysis

• SQL statement generation through block execution with placeholder objects

• one placeholder class per ‘simple type’, SqsQueryObject and SqsQueryCollection for complex cases

10

(SqsSearch for: User) detect: [:aUser | aUser username = 'testuser']

lundi 31 août 2009

Page 22: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

WHERE users.username = WHERE users.username = ‘testuser’

Query Analysis

• SQL statement generation through block execution with placeholder objects

• one placeholder class per ‘simple type’, SqsQueryObject and SqsQueryCollection for complex cases

10

(SqsSearch for: User) detect: [:aUser | aUser username = 'testuser']

lundi 31 août 2009

Page 23: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

Evaluation

11

• evaluation based on OO7 benchmark– CAD application data structure– complex object model with many cyclic dependencies

• set of queries with increasing complexity• number of traversals of an object graph• comparison with GLORP

lundi 31 août 2009

Page 24: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009 12

• approx. 20% slower than GLORP• two exceptions

– caching mechanism (10x slower)

– query creation with joins (1/3x faster)

(SqsSearch for: SqsBaseAssembly) select: [:ba | ba unsharedParts anySatisfy: [:part | part document = id ]].

(SqsSearch for: SqsAtomicPart) detect: [:ap | ap oid = id].

Evaluation – Query Performance

lundi 31 août 2009

Page 25: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009 13

– missing eager loading (n+1 queries problem)

0s

33s

65s

98s

130s

SqueakSave GLORP

Traversal 1

0s

2s

3s

5s

6s

SqueakSave GLORP

Traversal 2a

0s

7s

14s

20s

27s

SqueakSave GLORP

Traversal 2b

0s

6s

12s

18s

24s

SqueakSave GLORP

Traversal 2c

Evaluation – Traversal Performance

– minimal intrusion into object models (only collection proxies)

lundi 31 août 2009

Page 26: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

Summary and Outlook

• simple usage & setup– integration into existing applications almost seamless

• automatic deduction of database structures

14lundi 31 août 2009

Page 27: SqueakSave An Automatic Object-Relational Mapping Framework

SqueakSave: An Automatic Object-Relational Mapping Framework

Thomas Kowark, Robert Hirschfeld, Michael Haupt (www.hpi.uni-potsdam.de/swa) 2009

Summary and Outlook

• simple usage & setup– integration into existing applications almost seamless

• automatic deduction of database structures

• possible extensions– SqueakDBX usage– eager loading– performance optimizations

14lundi 31 août 2009