esugauthor mariano peck created date 9/2/2009 8:33:48 pm

38
Smalltalk Smalltalk Programmer Programmer Ing. Mariano Martínez Peck Ing. Mariano Martínez Peck [email protected] [email protected]

Upload: others

Post on 06-Aug-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

SmalltalkSmalltalkProgrammerProgrammer

Ing. Mariano Martínez Peck Ing. Mariano Martínez Peck [email protected]@gmail.com

Page 2: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

SqueakDBXSqueakDBX

The complete and The complete and open-source open-source solutionsolution to to

relational database relational database accessaccessMARKETING

MARKETING

Page 3: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

SqueakDBX teamSqueakDBX team Hernán Hernán CassinelliCassinelliGermán Germán

PalaciosPalaciosEsteban LorenzanoEsteban LorenzanoMariano Mariano M. PeckM. Peck

Page 4: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

F.A.QF.A.Q

Who are we?Who are we?

How did it begin?How did it begin?

What is actually SqueakDBX?What is actually SqueakDBX?

Page 5: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

RDBMS VS. OODBRDBMS VS. OODB

Please, don't fight ;)Please, don't fight ;)

Page 6: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Anyway, we rather program in Anyway, we rather program in objects and use RDBMS than objects and use RDBMS than

using Java with RDBMSusing Java with RDBMS;);)

Page 7: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

SurveySurvey 1/21/2

How many times were you forced to use a How many times were you forced to use a particular database?particular database?

Page 8: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

SurveySurvey 2/22/2Which databases?Which databases?

Page 9: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Squeak's current situationSqueak's current situation

Only MySQL and PostgreSQL native Only MySQL and PostgreSQL native drivers.drivers.

Limited ODBC driverLimited ODBC driver

Glorp in Squeak Glorp in Squeak

only works withonly works with

PostgreSQLPostgreSQL

Page 10: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

We are in trouble...We are in trouble...

Direct SQL queries: 20%Direct SQL queries: 20%

Using GLORP: 8.52%Using GLORP: 8.52%

Page 11: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Our goalOur goal

Direct SQL queries: 100%Direct SQL queries: 100%

Using GLORP: 100%Using GLORP: 100%

Page 12: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Our purposeOur purpose

Page 13: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Oracle uses oci.h and libclntsh.Oracle uses oci.h and libclntsh.It has N functions. It has N functions. Examples: OCIHandleAlloc(), OCIServerAttach(), Examples: OCIHandleAlloc(), OCIServerAttach(), OCISessionEnd(), etc.OCISessionEnd(), etc.

MySQL uses mysql.h and libmysqlclient_r.MySQL uses mysql.h and libmysqlclient_r.It has M functions. It has M functions. Examples: mysql_real_connect(), mysql_server_end(),Examples: mysql_real_connect(), mysql_server_end(),mysql_real_query(), etc.mysql_real_query(), etc.

Oracle Oracle clientclient

librarylibrary

MySQL MySQL clientclient

librarylibrary

PosgreSQL PosgreSQL clientclient

librarylibrary

Sqlite Sqlite clientclient

librarylibrary

SQLServer SQLServer clientclient

librarylibrary

OpenDBX architecture OpenDBX architecture

Common APICommon APIfor all backends!!!for all backends!!!

Oracle Oracle clientclient

librarylibrary

Oracle Oracle clientclient

librarylibrary

MySQL MySQL clientclient

librarylibrary

MySQL MySQL clientclient

librarylibrary

PosgreSQL PosgreSQL clientclient

librarylibrary

PosgreSQL PosgreSQL clientclient

librarylibrary

Sqlite Sqlite clientclient

librarylibrary

Sqlite Sqlite clientclient

librarylibrary

SQLServer SQLServer clientclient

librarylibrary

SQLServer SQLServer clientclient

librarylibrary

Page 14: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Why OpenDBX?Why OpenDBX?

It is fast It is fast

Simple to useSimple to use

FlexibleFlexible

Cross platform Cross platform

AsynchronoAsynchronous queriesus queries

Specific RDBMS featuresSpecific RDBMS features

Good documentationGood documentation

Page 15: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

PC2PC2PC1PC1

DatabaseDatabaseSqueak imageSqueak imageSqueak imageSqueak imageSqueak imageSqueak image

OpenDBXOpenDBXOpenDBXOpenDBX

DatabaseDatabaseClient LibraryClient Library

DatabaseDatabaseClient LibraryClient Library

Deployment and infrastructureDeployment and infrastructure

Page 16: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

||

#include <stdio.h>#include <stdio.h>static int mysql_odbx_get_option( odbx_t*)static int mysql_odbx_get_option( odbx_t*)

switch( option )switch( option )..........

#include <stdio.h>#include <stdio.h>static int mysql_odbx_get_option( odbx_t*)static int mysql_odbx_get_option( odbx_t*)

switch( option )switch( option )..........

Squeak imageSqueak image

OpenDBXOpenDBX

Smalltalk and CSmalltalk and C

Page 17: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Smalltalk-C ConnectorSmalltalk-C Connector

FFI (Foreign Function Interface)FFI (Foreign Function Interface)

Main problem: Locks the entire VMMain problem: Locks the entire VM

Page 18: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Squeak ODBC driver queriesSqueak ODBC driver queries

VM lockedVM lockedtimetime

Page 19: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

OpenDBX ConnectorOpenDBX Connector

FFI (Foreign Function Interface)FFI (Foreign Function Interface)

Main problem: Locks the entire VMMain problem: Locks the entire VM

Our solution: Our solution: ✔ Asynchronous queries✔ “Mini” VM locks✔ Retry schema✔ DBXQuerySettings>>timeout:

Page 20: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

SqueakDBX queriesSqueakDBX queries

VM lockedVM lockedtimetime

Page 21: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Database access in SmalltalkDatabase access in Smalltalk

SqueakDBXSqueakDBX✔ One for all databasesOne for all databases

✔ Less time and effortLess time and effort

✔ Good performaceGood performace

✔ OSS and proprietaryOSS and proprietary

✗ Difficult to debugDifficult to debug

✗ Platform dependentPlatform dependent

✗ FFI locks the VMFFI locks the VM

Smalltalk driverSmalltalk driver✗ One for each databaseOne for each database

✗ More time and effortMore time and effort

✗ Performance issues?Performance issues?

✗ Only OSSOnly OSS

✔ Easier to debugEasier to debug

✔ Platform independentPlatform independent

✔ Non-lockingNon-locking

Page 22: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

SqueakDBX designSqueakDBX design

SqueakDBX Structure (API)SqueakDBX Structure (API)SqueakDBX Structure (API)SqueakDBX Structure (API)

SqueakDBX PlatformSqueakDBX PlatformSqueakDBX PlatformSqueakDBX Platform

OpenDBX ConnectorOpenDBX ConnectorOpenDBX ConnectorOpenDBX Connector

FFIFFIFFIFFI SqueakDBXPluginSqueakDBXPluginSqueakDBXPluginSqueakDBXPlugin

OpenDBXOpenDBX

{{DBXConnectionDBXConnectionDBXConnectionSettingsDBXConnectionSettingsDBXResultSetDBXResultSetDBXResultDBXResultDBXRowDBXRow......{{DBXPlatformDBXPlatformDBXSpecialOptionsDBXSpecialOptionsDBXErrorSeverityDBXErrorSeverityDBXTimeSpecDBXTimeSpec......

Page 23: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

ShowtimeShowtime

Page 24: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Who can use SqueakDBX?Who can use SqueakDBX?

An applicationAn application

GlorpGlorp

Magritte-RDBMagritte-RDB

SqueakSaveSqueakSave

MoeMoe

Page 25: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Current backends and OSCurrent backends and OS

Page 26: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Benchmark for PostgreSQLBenchmark for PostgreSQL

InsertConverted Insert

Select100Select1000

0

200

400

600

800

1000

1200

1400

1600

1800

SqueakDBXNative

tests

ms

Page 27: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Benchmark for MySQLBenchmark for MySQL

InsertConverted Insert

Select100Select1000

0

100

200

300

400

500

600

700

SqueakDBXNative

tests

ms

Page 28: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

FeaturesFeatures

Mini VM locksMini VM locks

SqueakDBXPluginSqueakDBXPlugin

Automatic fields conversionAutomatic fields conversion

Configurable logging/traceConfigurable logging/trace

Special RDBMS featuresSpecial RDBMS features

MultistatementsMultistatements

Automatic release of resourcesAutomatic release of resources

Page 29: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

What do we have?What do we have?

Enough unit testsEnough unit tests

Acceptable test coverageAcceptable test coverage

SmallLint runsSmallLint runs

Good enough designGood enough design

GLORP integrationGLORP integration

Page 30: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

DocumentationDocumentation

WebsiteWebsite

Documented codeDocumented code

Mailing listMailing list

BenchmarksBenchmarks

Page 31: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

What will comeWhat will come

Complete Glorp refactor and integrationComplete Glorp refactor and integration

More backends in more OSMore backends in more OS

Large objects supportLarge objects support

Better SPs and functions supportBetter SPs and functions support

Continue with SqueakDBXPluginContinue with SqueakDBXPlugin

Try Alien FFITry Alien FFI

Port to Smalltalk/X ?Port to Smalltalk/X ?

Page 32: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Glorp progress Glorp progress

Port from Squeak to PharoPort from Squeak to Pharo

First refactor to SqueakDatabaseAccesorFirst refactor to SqueakDatabaseAccesor

Driver for native driverDriver for native driver

Driver for SqueakDBX (PostgreSQL)Driver for SqueakDBX (PostgreSQL)

Page 33: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Glorp before SqueakDBXGlorp before SqueakDBX

Page 34: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Glorp after SqueakDBXGlorp after SqueakDBX

Page 35: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Special thanks to...Special thanks to...

Norbert SendetzkyNorbert Sendetzky

GLORPGLORP Alan KnightAlan Knight

Stéphane DucasseStéphane Ducasse

Page 36: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

aConnection execute: 'select * from questionsaConnection execute: 'select * from questionswhere has_answer = true'where has_answer = true'

Ing. Mariano Martínez Peck Ing. Mariano Martínez Peck [email protected]@gmail.com

Page 37: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM

Thank you Thank you very muchvery much

Page 38: ESUGAuthor Mariano Peck Created Date 9/2/2009 8:33:48 PM