Skip to content

Commit

Permalink
Use jemalloc
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiezzel committed May 21, 2024
1 parent 12e5499 commit 6f2834b
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 21 deletions.
43 changes: 33 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ resolver = "2"

[workspace.dependencies]
contract-client = { git = "ssh://[email protected]/subsquid/subsquid-network.git", version = "1.0.0-rc1" }
subsquid-messages = { git = "ssh://[email protected]/subsquid/subsquid-network.git", version = "1.0.0-rc1" }
subsquid-network-transport = { git = "ssh://[email protected]/subsquid/subsquid-network.git", version = "1.0.0-rc1" }
subsquid-messages = { git = "ssh://[email protected]/subsquid/subsquid-network.git", version = "1.0.0-rc2" }
subsquid-network-transport = { git = "ssh://[email protected]/subsquid/subsquid-network.git", version = "1.0.0-rc2" }
5 changes: 4 additions & 1 deletion crates/logs-collector/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "logs-collector"
version = "1.0.0-rc1"
version = "1.0.0-rc2"
edition = "2021"

[dependencies]
Expand All @@ -20,3 +20,6 @@ tokio = { version = "1", features = ["full"] }
contract-client = { workspace = true }
subsquid-messages = { workspace = true }
subsquid-network-transport = { workspace = true, features = ["logs-collector"] }

[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = "0.5"
10 changes: 4 additions & 6 deletions crates/logs-collector/src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ impl<T: LogsStorage + Sync> LogsCollector<T> {
log::trace!("Logs collected: {logs:?}");
let mut rows: Vec<QueryExecutedRow> = logs
.into_iter()
.filter_map(|log| match log.try_into() {
Ok(log) => Some(log),
Err(e) => {
log::error!("Invalid log message: {e}");
None
}
.filter_map(|log| {
log.try_into()
.map_err(|e| log::error!("Invalid log message: {e}"))
.ok()
})
.collect();

Expand Down
7 changes: 7 additions & 0 deletions crates/logs-collector/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ mod server;
mod storage;
mod utils;

#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;

#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Init logger and parse arguments
Expand Down
5 changes: 4 additions & 1 deletion crates/network-scheduler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "network-scheduler"
version = "1.0.0-rc1"
version = "1.0.0-rc2"
edition = "2021"

[dependencies]
Expand Down Expand Up @@ -37,3 +37,6 @@ url = "2.5.0"
contract-client = { workspace = true }
subsquid-messages = { workspace = true, features = ["semver"] }
subsquid-network-transport = { workspace = true, features = ["scheduler", "metrics"] }

[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = "0.5"
7 changes: 7 additions & 0 deletions crates/network-scheduler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ mod signature;
mod storage;
mod worker_state;

#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;

#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Init logger and parse arguments and config
Expand Down
5 changes: 4 additions & 1 deletion crates/query-gateway/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "query-gateway"
version = "1.0.0-rc1"
version = "1.0.0-rc2"
edition = "2021"

[dependencies]
Expand Down Expand Up @@ -31,3 +31,6 @@ uuid = { version = "1", features = ["v4", "fast-rng"] }
contract-client = { workspace = true }
subsquid-messages = { workspace = true, features = ["semver"] }
subsquid-network-transport = { workspace = true, features = ["gateway"] }

[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = "0.5"
7 changes: 7 additions & 0 deletions crates/query-gateway/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ mod scheme_extractor;
mod server;
mod task;

#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;

#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

#[derive(Parser)]
#[command(version)]
struct Cli {
Expand Down

0 comments on commit 6f2834b

Please sign in to comment.