2019-02-11 09:45:14 +01:00
|
|
|
[package]
|
2019-09-09 19:06:24 +02:00
|
|
|
name = "flodgatt"
|
2019-02-11 18:58:51 +01:00
|
|
|
description = "A blazingly fast drop-in replacement for the Mastodon streaming api server"
|
2020-04-11 04:56:19 +02:00
|
|
|
version = "0.8.2"
|
2019-05-10 12:23:07 +02:00
|
|
|
authors = ["Daniel Long Sockwell <daniel@codesections.com", "Julian Laubstein <contact@julianlaubstein.de>"]
|
2019-02-11 09:45:14 +01:00
|
|
|
edition = "2018"
|
|
|
|
|
|
|
|
[dependencies]
|
2020-03-25 22:50:32 +01:00
|
|
|
log = { version = "0.4.6", features = ["release_max_level_info"] }
|
2019-04-15 20:48:09 +02:00
|
|
|
futures = "0.1.26"
|
2019-04-28 23:28:57 +02:00
|
|
|
tokio = "0.1.19"
|
2019-10-06 00:18:11 +02:00
|
|
|
warp = { git = "https://github.com/seanmonstar/warp.git"}
|
2020-04-03 18:41:53 +02:00
|
|
|
serde = { version = "1.0.105", features = ["derive"] }
|
|
|
|
serde_json = "1.0.50"
|
2019-04-15 20:48:09 +02:00
|
|
|
serde_derive = "1.0.90"
|
2019-04-18 16:10:01 +02:00
|
|
|
pretty_env_logger = "0.3.0"
|
2020-01-10 21:45:16 +01:00
|
|
|
postgres = "0.17.0"
|
2020-04-12 22:36:45 +02:00
|
|
|
dotenv = "0.15.0"
|
2019-09-05 03:31:52 +02:00
|
|
|
postgres-openssl = { git = "https://github.com/sfackler/rust-postgres.git"}
|
2019-10-02 06:03:18 +02:00
|
|
|
url = "2.1.0"
|
2019-10-09 02:35:26 +02:00
|
|
|
strum = "0.16.0"
|
|
|
|
strum_macros = "0.16.0"
|
2020-01-10 21:45:16 +01:00
|
|
|
r2d2_postgres = "0.16.0"
|
|
|
|
r2d2 = "0.8.8"
|
2020-03-19 01:37:10 +01:00
|
|
|
lru = "0.4.3"
|
2020-04-03 22:35:32 +02:00
|
|
|
urlencoding = "1.0.0"
|
2020-04-09 00:39:52 +02:00
|
|
|
hashbrown = "0.7.1"
|
2019-02-19 20:29:32 +01:00
|
|
|
|
2019-09-11 23:28:27 +02:00
|
|
|
[dev-dependencies]
|
|
|
|
criterion = "0.3"
|
2020-01-10 00:17:01 +01:00
|
|
|
regex = "1.3.2"
|
2019-09-11 23:28:27 +02:00
|
|
|
|
|
|
|
[[bench]]
|
|
|
|
name = "parse_redis"
|
|
|
|
harness = false
|
|
|
|
|
|
|
|
|
2019-02-19 20:29:32 +01:00
|
|
|
[features]
|
|
|
|
default = [ "production" ]
|
2020-04-03 18:41:53 +02:00
|
|
|
bench = []
|
2020-04-05 16:54:42 +02:00
|
|
|
stub_status = []
|
2019-02-19 20:29:32 +01:00
|
|
|
production = []
|
2020-04-09 00:39:52 +02:00
|
|
|
|
|
|
|
[profile.release]
|
2020-04-11 04:56:19 +02:00
|
|
|
lto = "fat"
|
Stream events via a watch channel (#128)
This squashed commit makes a fairly significant structural change to significantly reduce Flodgatt's CPU usage.
Flodgatt connects to Redis in a single (green) thread, and then creates a new thread to handle each WebSocket/SSE connection. Previously, each thread was responsible for polling the Redis thread to determine whether it had a message relevant to the connected client. I initially selected this structure both because it was simple and because it minimized memory overhead – no messages are sent to a particular thread unless they are relevant to the client connected to the thread. However, I recently ran some load tests that show this approach to have unacceptable CPU costs when 300+ clients are simultaneously connected.
Accordingly, Flodgatt now uses a different structure: the main Redis thread now announces each incoming message via a watch channel connected to every client thread, and each client thread filters out irrelevant messages. In theory, this could lead to slightly higher memory use, but tests I have run so far have not found a measurable increase. On the other hand, Flodgatt's CPU use is now an order of magnitude lower in tests I've run.
This approach does run a (very slight) risk of dropping messages under extremely heavy load: because a watch channel only stores the most recent message transmitted, if Flodgatt adds a second message before the thread can read the first message, the first message will be overwritten and never transmitted. This seems unlikely to happen in practice, and we can avoid the issue entirely by changing to a broadcast channel when we upgrade to the most recent Tokio version (see #75).
2020-04-09 19:32:36 +02:00
|
|
|
#panic = "abort"
|
2020-04-11 04:56:19 +02:00
|
|
|
codegen-units = 1
|
Stream events via a watch channel (#128)
This squashed commit makes a fairly significant structural change to significantly reduce Flodgatt's CPU usage.
Flodgatt connects to Redis in a single (green) thread, and then creates a new thread to handle each WebSocket/SSE connection. Previously, each thread was responsible for polling the Redis thread to determine whether it had a message relevant to the connected client. I initially selected this structure both because it was simple and because it minimized memory overhead – no messages are sent to a particular thread unless they are relevant to the client connected to the thread. However, I recently ran some load tests that show this approach to have unacceptable CPU costs when 300+ clients are simultaneously connected.
Accordingly, Flodgatt now uses a different structure: the main Redis thread now announces each incoming message via a watch channel connected to every client thread, and each client thread filters out irrelevant messages. In theory, this could lead to slightly higher memory use, but tests I have run so far have not found a measurable increase. On the other hand, Flodgatt's CPU use is now an order of magnitude lower in tests I've run.
This approach does run a (very slight) risk of dropping messages under extremely heavy load: because a watch channel only stores the most recent message transmitted, if Flodgatt adds a second message before the thread can read the first message, the first message will be overwritten and never transmitted. This seems unlikely to happen in practice, and we can avoid the issue entirely by changing to a broadcast channel when we upgrade to the most recent Tokio version (see #75).
2020-04-09 19:32:36 +02:00
|
|
|
|
2020-04-09 00:39:52 +02:00
|
|
|
|
|
|
|
|