2016-11-07 09:49:42 +00:00
|
|
|
|
2018-03-12 14:03:15 +00:00
|
|
|
## Odyssey
|
2016-11-08 11:01:55 +00:00
|
|
|
|
2017-07-14 12:05:09 +00:00
|
|
|
Advanced multi-threaded PostgreSQL connection pooler and request router.
|
2017-01-18 12:07:41 +00:00
|
|
|
|
2017-07-14 12:05:09 +00:00
|
|
|
### Design goals and main features
|
|
|
|
|
2017-07-18 14:06:53 +00:00
|
|
|
#### Multi-threaded architecture
|
2017-07-14 12:06:51 +00:00
|
|
|
|
2017-07-14 12:57:36 +00:00
|
|
|
Odissey can significantly scale processing performance by
|
2017-07-14 12:05:09 +00:00
|
|
|
specifying a number of additional worker threads. Each worker thread is
|
|
|
|
responsible for authentication and proxying client-to-server and server-to-client
|
|
|
|
requests. All worker threads are sharing global server connection pools.
|
2017-07-14 12:23:08 +00:00
|
|
|
Multi-threaded design plays important role in `SSL/TLS` performance.
|
2017-12-08 15:39:45 +00:00
|
|
|
Additionally client-to-server and server-to-client buffers are zero-copy.
|
2017-07-14 12:05:09 +00:00
|
|
|
|
2017-07-18 14:06:53 +00:00
|
|
|
#### Advanced transactional pooling
|
2017-07-14 12:06:51 +00:00
|
|
|
|
2017-07-14 12:05:09 +00:00
|
|
|
Odissey tracks current transaction state and in case of unexpected client
|
|
|
|
disconnection can emit automatic `Cancel` connection and do `Rollback` of
|
|
|
|
abandoned transaction, before putting server connection back to
|
|
|
|
the server pool for reuse. Additionally, last server connection owner client
|
|
|
|
is remembered to reduce a need for `Discard` and `Setting` up client options
|
|
|
|
on each client-to-server assignment.
|
|
|
|
|
2017-07-18 14:06:53 +00:00
|
|
|
#### Better pooling control
|
2017-07-14 12:06:51 +00:00
|
|
|
|
2017-07-18 10:11:59 +00:00
|
|
|
Odissey allows to define connection pools as a pair of `Database` and `User`.
|
|
|
|
Each defined pool can have separate authentication, pooling mode and limits settings.
|
2017-07-14 12:05:09 +00:00
|
|
|
|
2017-07-18 14:06:53 +00:00
|
|
|
#### Authentication
|
2017-07-14 12:06:51 +00:00
|
|
|
|
2017-07-14 12:23:08 +00:00
|
|
|
Odissey has full-featured `SSL/TLS` support and common authentication methods
|
2017-07-14 12:05:09 +00:00
|
|
|
like: `md5` and `clear text` both for client and server authentication.
|
|
|
|
Additionally it allows to block each pool user separately.
|
|
|
|
|
2017-07-18 14:06:53 +00:00
|
|
|
#### Logging
|
2017-07-14 13:12:46 +00:00
|
|
|
|
|
|
|
Odissey generates universally unique identifiers `uuid` for client and server connections.
|
|
|
|
Any log events and client error responces include the id, which then can be used to
|
2017-07-14 13:17:03 +00:00
|
|
|
uniquely identify client and track actions. Odissey can save log events into log file and
|
|
|
|
using system logger.
|
2017-07-14 13:12:46 +00:00
|
|
|
|
2018-03-13 13:33:17 +00:00
|
|
|
#### Architecture and internals
|
2017-07-14 12:06:51 +00:00
|
|
|
|
2017-07-14 12:05:09 +00:00
|
|
|
Odissey has sophisticated asynchonous multi-threaded architecture which
|
2017-07-14 12:13:12 +00:00
|
|
|
is driven by custom made coroutine engine: [machinarium](https://github.yandex-team.ru/pmwkaa/machinarium).
|
2017-07-14 12:18:23 +00:00
|
|
|
Main idea behind coroutine design is to make event-driven asynchronous applications to look and feel
|
2017-07-14 12:23:08 +00:00
|
|
|
like being written in synchronous-procedural manner instead of using traditional
|
2017-07-17 12:26:45 +00:00
|
|
|
callback approach.
|
|
|
|
|
|
|
|
One of the main goal was to make code base understandable for new developers and
|
2017-07-17 12:23:05 +00:00
|
|
|
to make an architecture easily extensible for future development.
|
2017-07-14 12:05:09 +00:00
|
|
|
|
2017-07-18 10:30:23 +00:00
|
|
|
More information: [Architecture and internals](INTERNALS.md).
|
2017-07-14 12:05:09 +00:00
|
|
|
|
|
|
|
### Build instructions
|
2017-01-18 12:07:41 +00:00
|
|
|
|
|
|
|
```sh
|
2018-03-12 14:03:15 +00:00
|
|
|
git clone --recursive git://github.yandex-team.ru/pmwkaa/odyssey.git
|
|
|
|
cd odyssey
|
2017-01-18 12:07:41 +00:00
|
|
|
mkdir build
|
|
|
|
cd build
|
2017-02-07 15:58:26 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
2017-01-18 12:07:41 +00:00
|
|
|
make
|
|
|
|
```
|