Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

17
DEVEL-A35 Dmitry Yemanov 1 Firebird 2.5 Architecture Dmitry Yemanov Firebird Project http://www.firebirdsql.org/

description

This presentation was made at Firebird Conference 2008 in Bergamo, Italy, by Dmitry Yemanov. Presentation is devoted to the new architecture type introduced in Firebird 2.5 - SuperClassic. Firebird SuperClassic introduces the major step to more effective and scalable SMP support in Firebird.

Transcript of Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

Page 1: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

1

Firebird 2.5Architecture

Dmitry Yemanov

Firebird Projecthttp://www.firebirdsql.org/

Page 2: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

2

Firebird 2.5

Rationale

First step in the Classic/SuperServer unification

Codebase modernization

Common threadable architectureand more efficient multi-threading support

A number of new features

Intermediate release between v2.1 and v3.0

Page 3: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

3

Threadability as a Primary Goal

Major MT cleanup

Only threadable platforms are supported

Old synchronization logic is updated

Generic thread safety everywhere,starting from the API (both client and embedded)

Better scalability

No cooperative scheduling anymore

Say “goodbye” to the global mutex

Synchronization goes to the lower levels

Page 4: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

4

Threadability as a Primary Goal

Server layer / remote subsystem

Worker thread pooling

Asynchronous connection cleanup

Unified listener code for SS and CS

Lock management

Non-blocking notifications

No need in the static semaphores setup

Per database lock tables

Page 5: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

5

Effects for the Supported Architectures

Classic Server

Lock manager doesn't need explicit semaphores and signals setup anymore

fb_lock_mgr binary is deprecated on POSIX

Services and automatic sweep are executedas threads (less processes spawned)

Server layer may determine broken network links immediately and terminate the worker process

libfbembed.so is thread-safe

Page 6: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

6

Effects for the Supported Architectures

SuperServer

Better overall scalability and respond timings dueto a lower-level synchronization inside the engine

SMP/multi-core hardware can be utilized efficiently when multiple databases are accessed simultaneously

fbclient.so/.dll is thread-safe

Page 7: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

7

Effects for the Supported Architectures

Embedded Server

Now based on the Classic architecture,including all the benefits of the SuperClassic

Multiple processes can safely access the database

Official utilities (gbak, gfix, isql, etc)can be used as well

fbembed.dll is thread-safe

Page 8: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

8

What is Super Classic?

Architecture

Single process, multiple worker threads (pooled)

Per connection page cache and metadata cache

A number of in-process optimizations

Database access can be safely shared among Classic, SuperClassic and Embedded processes

Page 9: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

9

What is Super Classic?

SuperClassic

Classic

Classic

Classic

Embedded

Embedded

Embedded

Database

Page 10: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

10

What is Super Classic?

Benefits as compared to Classic

Less kernel resources (but not memory) used

Scalability limits are shifted

Better performance due to local calls inside the lock manager and other in-process optimizations(25% performance boost in TPC-C)

Server can be safely shutdown as a whole

Possibility to enumerate attached databases/users

Security database connection is cached

Page 11: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

11

What is Super Classic?

Benefits as compared to SuperServer

Better scalability(number of connections is not explicitly limited)

Better concurrency on SMP/multi-core hardware

More responsive under high load

Page 12: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

12

What is Super Classic?

Drawbacks

Still ineffective memory usage

High lock table contention (page locks),requires careful tuning of the LM configuration

Server crash affects all user attachments

Doesn't make much sense on 32-bit systems

Page 13: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

13

What is Super Classic?

How to use on Windows

The same binary as for the regular Classic

Application: fb_inet_server.exe -a -m

Service: instsvc install -m

How to use on POSIX

New fb_smp_server binary

No need in [x]inetd

Page 14: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

14

Combined Efforts

Firebird team

Synchronization inside the core engine

SuperClassic and Embedded modes

Updated lock manager

Remote subsystem rework

SAS Institute

Concurrency testing, SuperClassic/Embedded

RedSoft Corporation

Concurrency testing and bugfixing

Page 15: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

15

Evolution in Firebird 3.0

Architecture

Single server, different working modes:- shared – multiple server processes (CS like)- dedicated – standalone server process (SS like)

Per database configuration

Multi-threading abilities

Full cross-attachment concurrency

Prepared statements cache

Page 16: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

16

Evolution in Firebird 3.0

SuperServer SuperClassic Classic

Firebird 2.5

Dedicated(in-process)

Shared(cross-process)

Firebird 3.0

Page 17: Firebird 2.5 Architecture, by Dmitry Yemanov (in English)

DEVEL-A35 Dmitry Yemanov

17

Thank you!

Dmitry Yemanov

mailto:[email protected]