2018-03-15 11:34:54 +00:00
|
|
|
<p align="center">
|
2018-03-26 14:50:15 +00:00
|
|
|
<img src="documentation/odyssey.png" width="35%" height="35%" /><br>
|
2018-03-15 11:34:54 +00:00
|
|
|
</p>
|
|
|
|
<br>
|
2018-03-15 11:40:12 +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
|
|
|
|
2018-05-30 14:54:43 +00:00
|
|
|
#### Project status
|
|
|
|
|
|
|
|
Although we run Odyssey in production, the project is currently in Beta. We appreciate any kind of feedback and contribution to the project.
|
|
|
|
|
2018-06-13 15:23:56 +00:00
|
|
|
<a href="https://travis-ci.org/yandex/odyssey"><img src="https://travis-ci.org/yandex/odyssey.svg?branch=master" /></a>
|
|
|
|
|
2017-07-14 12:05:09 +00:00
|
|
|
### Design goals and main features
|
|
|
|
|
2018-03-16 10:25:20 +00:00
|
|
|
#### Multi-threaded processing
|
2017-07-14 12:06:51 +00:00
|
|
|
|
2018-03-13 13:41:20 +00:00
|
|
|
Odyssey 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-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
|
|
|
|
2018-03-13 13:41:20 +00:00
|
|
|
Odyssey tracks current transaction state and in case of unexpected client
|
2017-07-14 12:05:09 +00:00
|
|
|
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
|
2018-03-16 10:25:20 +00:00
|
|
|
is remembered to reduce a need for setting up client options on each
|
|
|
|
client-to-server assignment.
|
2017-07-14 12:05:09 +00:00
|
|
|
|
2017-07-18 14:06:53 +00:00
|
|
|
#### Better pooling control
|
2017-07-14 12:06:51 +00:00
|
|
|
|
2018-03-13 13:41:20 +00:00
|
|
|
Odyssey allows to define connection pools as a pair of `Database` and `User`.
|
2017-07-18 10:11:59 +00:00
|
|
|
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
|
|
|
|
2018-03-13 13:41:20 +00:00
|
|
|
Odyssey 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
|
|
|
|
2018-03-13 13:41:20 +00:00
|
|
|
Odyssey generates universally unique identifiers `uuid` for client and server connections.
|
2018-05-30 13:56:20 +00:00
|
|
|
Any log events and client error responses include the id, which then can be used to
|
2018-03-13 13:41:20 +00:00
|
|
|
uniquely identify client and track actions. Odyssey can save log events into log file and
|
2017-07-14 13:17:03 +00:00
|
|
|
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
|
|
|
|
2018-03-16 10:25:20 +00:00
|
|
|
Odyssey has sophisticated asynchronous multi-threaded architecture which
|
2018-05-29 14:30:11 +00:00
|
|
|
is driven by custom made coroutine engine: [machinarium](https://github.com/yandex/odyssey/tree/master/third_party/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
|
|
|
|
2018-03-21 15:11:57 +00:00
|
|
|
More information: [Architecture and internals](documentation/internals.md).
|
2017-07-14 12:05:09 +00:00
|
|
|
|
2018-03-29 12:24:41 +00:00
|
|
|
#### Build instructions
|
2017-01-18 12:07:41 +00:00
|
|
|
|
2018-06-01 10:02:48 +00:00
|
|
|
Currently Odyssey runs only on Linux. Supported platforms are x86/x86_64.
|
|
|
|
|
|
|
|
To build you will need:
|
|
|
|
|
|
|
|
* cmake >= 2.8
|
|
|
|
* gcc >= 4.6
|
2018-06-07 11:43:06 +00:00
|
|
|
* openssl
|
2018-06-01 10:02:48 +00:00
|
|
|
|
2017-01-18 12:07:41 +00:00
|
|
|
```sh
|
2018-05-29 14:30:11 +00:00
|
|
|
git clone git://github.com/yandex/odyssey.git
|
2018-03-12 14:03:15 +00:00
|
|
|
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
|
|
|
|
```
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:37:24 +00:00
|
|
|
### Configuration reference
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:37:24 +00:00
|
|
|
##### Service
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:43:46 +00:00
|
|
|
* [include](documentation/configuration.md#include-string)
|
|
|
|
* [daemonize](documentation/configuration.md#daemonize-yesno)
|
|
|
|
* [pid\_file](documentation/configuration.md#pid_file-string)
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:37:24 +00:00
|
|
|
##### Logging
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:43:46 +00:00
|
|
|
* [log\_file](documentation/configuration.md#log_file-string)
|
|
|
|
* [log\_format](documentation/configuration.md#log_format-string)
|
|
|
|
* [log\_to\_stdout](documentation/configuration.md#log_to_stdout-yesno)
|
|
|
|
* [log\_syslog](documentation/configuration.md#log_syslog-yesno)
|
|
|
|
* [log\_syslog\_ident](documentation/configuration.md#log_syslog_ident-string)
|
|
|
|
* [log\_syslog\_facility](documentation/configuration.md#log_syslog_facility-string)
|
|
|
|
* [log\_debug](documentation/configuration.md#log_debug-yesno)
|
|
|
|
* [log\_config](documentation/configuration.md#log_config-yesno)
|
|
|
|
* [log\_session](documentation/configuration.md#log_session-yesno)
|
|
|
|
* [log\_query](documentation/configuration.md#log_query-yesno)
|
|
|
|
* [log\_stats](documentation/configuration.md#log_stats-yesno)
|
|
|
|
* [stats\_interval](documentation/configuration.md#stats_interval-integer)
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:37:24 +00:00
|
|
|
##### Performance
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:43:46 +00:00
|
|
|
* [workers](documentation/configuration.md#workers-integer)
|
|
|
|
* [resolvers](documentation/configuration.md#resolvers-integer)
|
|
|
|
* [readahead](documentation/configuration.md#readahead-integer)
|
|
|
|
* [pipeline](documentation/configuration.md#pipeline-integer)
|
|
|
|
* [cache](documentation/configuration.md#cache-integer)
|
|
|
|
* [cache\_chunk](documentation/configuration.md#cache_chunk-integer)
|
|
|
|
* [cache\_coroutine](documentation/configuration.md#cache_coroutine-integer)
|
|
|
|
* [nodelay](documentation/configuration.md#nodelay-yesno)
|
|
|
|
* [keepalive](documentation/configuration.md#keepalive-integer)
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-06-04 12:32:18 +00:00
|
|
|
##### System
|
|
|
|
|
|
|
|
* [coroutine\_stack\_size](documentation/configuration.md#coroutine_stack_size-integer)
|
|
|
|
|
2018-03-29 12:37:24 +00:00
|
|
|
##### Global limits
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:43:46 +00:00
|
|
|
* [client\_max](documentation/configuration.md#client_max-integer)
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:37:24 +00:00
|
|
|
##### Listen
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:43:46 +00:00
|
|
|
* [host](documentation/configuration.md#host-string)
|
|
|
|
* [port](documentation/configuration.md#port-integer)
|
|
|
|
* [backlog](documentation/configuration.md#backlog-integer)
|
|
|
|
* [tls](documentation/configuration.md#tls-string)
|
2018-03-30 11:23:42 +00:00
|
|
|
* [tls\_ca\_file](documentation/configuration.md#tls-string)
|
|
|
|
* [tls\_key\_file](documentation/configuration.md#tls-string)
|
|
|
|
* [tls\_cert\_file](documentation/configuration.md#tls-string)
|
|
|
|
* [tls\_protocols](documentation/configuration.md#tls-string)
|
2018-03-30 11:19:33 +00:00
|
|
|
* [example](documentation/configuration.md#example)
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:37:24 +00:00
|
|
|
##### Routing
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:43:46 +00:00
|
|
|
* [overview](documentation/configuration.md#routing-rules)
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-30 11:19:33 +00:00
|
|
|
##### Storage
|
|
|
|
|
|
|
|
* [overview](documentation/configuration.md#storage)
|
|
|
|
* [type](documentation/configuration.md#type-string)
|
|
|
|
* [host](documentation/configuration.md#host-string-1)
|
|
|
|
* [port](documentation/configuration.md#port-integer-1)
|
|
|
|
* [tls](documentation/configuration.md#tls-string-1)
|
2018-03-30 11:23:42 +00:00
|
|
|
* [tls\_ca\_file](documentation/configuration.md#tls-string-1)
|
|
|
|
* [tls\_key\_file](documentation/configuration.md#tls-string-1)
|
|
|
|
* [tls\_cert\_file](documentation/configuration.md#tls-string-1)
|
|
|
|
* [tls\_protocols](documentation/configuration.md#tls-string-1)
|
2018-03-30 11:19:33 +00:00
|
|
|
* [example](documentation/configuration.md#example-1)
|
|
|
|
|
|
|
|
##### Database and user
|
|
|
|
|
|
|
|
* [overview](documentation/configuration.md#database-and-user)
|
|
|
|
* [authentication](documentation/configuration.md#authentication-string)
|
|
|
|
* [password](documentation/configuration.md#password-string)
|
2018-05-10 12:51:49 +00:00
|
|
|
* [auth\_common\_name](documentation/configuration.md#auth_common_name-defaultstring)
|
2018-03-30 11:19:33 +00:00
|
|
|
* [auth\_query](documentation/configuration.md#auth_query-string)
|
2018-03-30 11:23:42 +00:00
|
|
|
* [auth\_query\_db](documentation/configuration.md#auth_query-string)
|
|
|
|
* [auth\_query\_user](documentation/configuration.md#auth_query-string)
|
2018-03-30 11:19:33 +00:00
|
|
|
* [client\_max](documentation/configuration.md#client_max-integer-1)
|
|
|
|
* [storage](documentation/configuration.md#storage-string)
|
2018-03-30 11:23:42 +00:00
|
|
|
* [storage\_db](documentation/configuration.md#storage-string)
|
|
|
|
* [storage\_user](documentation/configuration.md#storage-string)
|
|
|
|
* [storage\_password](documentation/configuration.md#storage-string)
|
2018-03-30 11:19:33 +00:00
|
|
|
* [pool](documentation/configuration.md#pool-string)
|
|
|
|
* [pool\_size](documentation/configuration.md#pool_size-integer)
|
|
|
|
* [pool\_timeout](documentation/configuration.md#pool_timeout-integer)
|
|
|
|
* [pool\_ttl](documentation/configuration.md#pool_ttl-integer)
|
|
|
|
* [pool\_cancel](documentation/configuration.md#pool_cancel-yesno)
|
|
|
|
* [pool\_rollback](documentation/configuration.md#pool_rollback-yesno)
|
|
|
|
* [client\_fwd\_error](documentation/configuration.md#client_fwd_error-yesno)
|
|
|
|
* [log\_debug](documentation/configuration.md#log_debug-yesno-1)
|
|
|
|
* [example](documentation/configuration.md#example-remote)
|
|
|
|
* [example console](documentation/configuration.md#example-admin-console)
|
|
|
|
|
|
|
|
##### Architecture and Internals
|
2018-03-29 12:24:41 +00:00
|
|
|
|
2018-03-29 12:37:24 +00:00
|
|
|
* [overview](documentation/internals.md)
|
|
|
|
* [error codes](documentation/internals.md#client-error-codes)
|