Commit Graph

65 Commits

Author SHA1 Message Date
Roman Khapov 40d95ad269
Backend connect timeout (#750)
* sources/console.c: remove unused variable

Signed-off-by: rkhapov <r.khapov@ya.ru>

* sources/config.c: backend_connect_timeout_ms

To remove const from sources/backend.c + format fixes

Signed-off-by: rkhapov <r.khapov@ya.ru>

---------

Signed-off-by: rkhapov <r.khapov@ya.ru>
Co-authored-by: rkhapov <r.khapov@ya.ru>
2025-01-13 15:55:31 +05:00
secwall 9ea042d36f
Fix some minor typos (#724) 2024-12-10 12:35:31 +05:00
Roman Khapov f081cf98c7
sources/config_reader.c: new default client_max_routing (#715)
Default per worker 16 value should be increased to achive
more CPU utilization and client connections rate.

After testing some client connection parallelism i learn that
there should be ~ 60-80 client connections per worker to get 100% of cpu loading
(with non-localhost connections)

So this patch increases 16 to 64

benchmarks/client_max_routing might be used for future learning

Signed-off-by: rkhapov <r.khapov@ya.ru>
Co-authored-by: rkhapov <r.khapov@ya.ru>
2024-11-15 22:05:20 +05:00
reshke d9d18b2c20
Reject connection initiating in replication lag too high. (#481)
* Reject connection initiating in replication lag too high.

In replication lag polling feature, check replication lag on connection
startuy (before auth), and reject connection if replication lag is too high.

* Apply fmt
2023-07-10 13:51:14 +03:00
Тимофей Шляпников bddd8b27a8
Fix configs (#467)
Co-authored-by: tim-shlyap <tim-shlyap@yandex-team.ru>
2022-10-10 12:48:32 +05:00
reshke c7fef9dffb
Fix a couple of prometheus-related setting in odyssey.conf (#465)
This resolves issue 460
2022-09-05 20:20:44 +05:00
reshke 1710d40246
Target session attr feature for storage (#456)
* Target session attr feature for storage


Storage host section is now accepts a comma-separated
PostgreSQL hosts list, in format "host2,host2"
or "[host1]:port1,host2" etc.

Storage structure now holds pointer to host, which connection was acquired.
This is required to cancel`s queries to work fine.

Target session attrs policies added:

    read-write
    read-only
    any (default)

Target session attrs uses pg_is_in_recovery function to
check if host in primary or replica. in_hot_standby option is not checked yet.
2022-08-18 17:15:13 +05:00
Тимофей Шляпников 33647f5750
Better prometheus support (#414)
* fix collector init

* Added promhttp server

* Fix memory leak

* Fix memory leak

* Minimum viable server

* Port is now set via config

* Port is now set via config

* Port is now set via config

* Better code organisation & config procession

* Fix docs

* Fix old typo in label_count

* More reliable init

* Shuffle metrics by label for more appropriate collection

* Done with shuffling

* Done, not tested

* Done, now rebase

* Format

* Fix port

Co-authored-by: tim-shlyap <tim-shlyap@yandex-team.ru>
2022-03-25 21:21:59 +05:00
Тимофей Шляпников d6e2c61087
Add roles in console DB (#371)
* Ldapless

* Ldapless

* Console are now considering roles

* For pull from origin

* Done, but not tested

* Works, but do not drop connections to console

* Update to origin

* Added drop connections with lowered role via reload

* Format and rename

* Fix makefile & dev.conf

* Fix makefile & dev.conf

* Fix lagpolling tests

* Fix tests

* Fix tests

* Add tests & fix .conf

* Add tests & fix .conf

* Add tests & fix .conf

Co-authored-by: tim-shlyap <tim-shlyap@yandex-team.ru>
2021-12-16 04:08:42 +05:00
Andrey Borodin f062d4ee16
Fix some warnings (#357)
* Fix some warnings

* Some leftover hash

* Add include
2021-11-12 19:01:32 +05:00
Julien Acroute 46420ba05b
fix: typo 2021-09-06 22:59:17 +02:00
Yury Frolov 02f3144265
Enabled writing stats in Prometheus format. (#346)
* Early implementation

* Added description for gauges

* Added prometheus lib finding to Cmake

* Fixed FindProm comments

* Small changes

* free to prom_free

* Moved metrics to separate file

* Refactored & added new methods to prom_metrics

* Refactored cron.c to use prom_metrics.h

* Refactored CMake & odyssey.h

* Added new metrics

* Small refactoring

* Small method renaming

* Small fix in init

* Added methods for use in od_cron_stats_cb

* Small fixes

* Refactored metrics to use separate collectors

* Small fix

* Passing metrics to od_cron_stat_cb now.

* Removed unused imports

* Removed old od_log calls

* Removed TODO

* Revert "Removed old od_log calls"

This reverts commit 60000c8321.

* Uncommented od_log calls

* Added processed clients field to metrics

* Refactored metrics init

* Fixed write_stat

* Added method for worker stats

* Added method for worker stat to metrics header file

* Refactored worker stat method

* Reverted changes in odyssey.h

* Added writing metrics to od_worker

* Added new method to logger

Method provides writing big strings to log without formatting.

* Fixed prometheus log writing

* More fixes

* Fixed log writing

* Fixed log calls

* Added TODO

* Added assertion whether prom.h found

* Fixed no format logger method

Now logs follow log format

* Fixed logger

* Added log_stats_prom option to config

* Renamed od_logger_write_no_fmt to od_logger_write_plain

* Formatted

* More ifdefs

* Added memory deallocating in od_cron_stop

* Updated configuration.md

* Removed outdated TODO

* Changed label

* Formatted
2021-08-17 17:07:16 +05:00
reshke 146ff3d8e2 add more comments to documentation/internals 2021-05-19 18:15:04 +05:00
reshke a78664e7b7 Add password_passthrough option to route 2021-05-19 17:18:49 +05:00
Rui Marinho 4dfc1c65cd Update server_login_retry on odyssey.conf 2021-05-09 22:29:24 +01:00
Andrey Borodin 4b90eb8971 Fix injection in auth_query 2021-03-05 09:42:45 +05:00
reshke 4323568a41 fix typos 2021-02-25 14:00:53 +05:00
reshke 9c3d23a815 rename param 2021-02-25 13:40:15 +05:00
reshke ade1b4c111 wait for pending data 2021-02-20 22:52:12 +05:00
reshke 107f0ae171 add pool idle in transaction setting 2021-02-12 13:03:06 +05:00
reshke e4bea27f66 introduse pool client idle timeout in session pooling mode 2021-02-12 02:30:03 +05:00
Daniil Zakhlystov e97f7e1f1c
Add compression toggle to config, cmake && Add dependencies to BuildDebian (#234)
* Add compression option to config

* Add BUILD_COMPRESSION option to cmake

* Escape identifiers

* Add preprocessing directives for OD_BUILD_COMPRESSION

* Add dependencies for BuildDebian

* apply fmt

Co-authored-by: root <root@ubuntu-build-machine.ru-central1.internal>
2020-11-23 16:55:42 +05:00
reshke 52b0abb647 fix infinte loop + add signals tests 2020-08-10 13:39:09 +05:00
reshke f030093484 use SO_REUSEPORT to graceful shutdown 2020-08-10 13:39:09 +05:00
reshke bde82dec9b tcp keepalive settings 2020-07-22 13:05:16 +05:00
Kazantcev Andrey e7c4c574c7
Fix mistake (#184) 2020-06-27 21:04:08 +05:00
kirill reshke 41a5449969
odyssey modules (#156) 2020-06-09 14:19:11 +05:00
Andrey Borodin b7bcb86956
Implement server lifetime (#129) 2020-02-28 15:20:55 +05:00
efimkin 60d7229cdc Enhance settings for replication support (#107) 2020-01-27 18:01:53 +05:00
Andrey Borodin 507682fdd5
Quantiles for transactions and queries (#95) 2020-01-24 17:31:15 +05:00
Andrey 3732c8b8b7 Refactor server_max_routing setting, use it for expiration too 2020-01-24 12:02:35 +05:00
Andrey 8496cde80a Implement server_max_routing restriction 2020-01-23 11:35:47 +05:00
Andrey 0bf792c4af Add server_login_retry timeout 2020-01-23 11:35:47 +05:00
Andrey e773dbb260 Add application_name_add_host setting 2020-01-20 11:43:16 +05:00
Andrey Borodin b98d34d489 Increase default client_max_routing 2019-12-04 15:21:50 +05:00
Andrey Borodin eb7299748d Implement login timeout 2019-12-02 18:28:39 +05:00
Dima Starkov a8ca664a63 Implements SCRAM Authentication (#73) 2019-11-11 12:28:50 +03:00
Andrey Borodin 298cdca895
Implement client_max_routing (#72) 2019-10-15 17:15:37 +03:00
reshke debfd09d8e Add PAM auth support 2019-09-26 13:54:53 +05:00
Andrey Borodin c4e2cedc35 Support of replication protocol 2019-04-12 15:13:50 +05:00
Dmitry Simonenko 6c0a1f09f8 odyssey: major rework of io architecture
This patch intend is to improve overall io performance, reduce
cpu and system usage.

Machinarium:

IO read/write logic is highly simplified and now based on conditions
instead of previously made internal readahead buffer and msg
queues. This allows to give user more control over io operations and
avoid doing undesired readahead copying.

Above that, TLS implementation reworked to use async logic instead of
separate BIO layer.

Direct pooling functions removed.

New objects machine_cond_t and machine_iov_t objects.

Odyssey:

Introduced readahead, io and relay objects.

Relay allows to connect two io handles for direct data retransmission
without double copying.

Removed configuration options no longer needed:
packet_read_size, packet_write_queue
2019-01-23 18:43:52 +03:00
Dmitry Simonenko 82f0deba7d odyssey: disable discard by default 2018-12-13 15:40:18 +03:00
Dmitry Simonenko c4f383ccfb odyssey: introduce pool_discard configuration parameter 2018-12-11 12:57:52 +03:00
Dmitry Simonenko dc3ae5ca2e odyssey: allow to set process/workers priority 2018-11-14 16:14:13 +03:00
Dmitry Simonenko 2d4f61f923 odyssey: introduce packet_write_queue 2018-11-13 18:29:25 +03:00
Dmitry Simonenko fbc037aa23 odyssey: implement packet retransmission in chunks; packet_read_size 2018-10-23 16:51:30 +03:00
Dmitry Simonenko 14d4a7f478 odyssey: add cache_msg_gc_size option and disable default caching 2018-09-26 18:18:17 +03:00
Dmitry Simonenko da7e6ea7a5 odyssey: major io rework and refactoring
This patch moves Odyssey from stream based write caching
to message driven. All write operations are delayed
and happen on a group of messages.

This removes necessity to do IO and wait for write completion during calls
from SSL_write() context. Write timings should behave more predictable now and
number of used syscalls should be also decreased.

This patch also simplifies caching management. All clients are simply
reusing cached messages without prolonged contention.

Several configuration options are no longer used:
pipeline, cache, cache_chunk
2018-08-28 17:43:46 +03:00
Dmitry Simonenko be59c897cc odyssey: gather current stats in routes instead of server 2018-08-09 17:39:36 +03:00
Dmitry Simonenko 008efe6727 odyssey: make stats_interval compatible with pgbouncer 2018-08-03 17:09:37 +03:00