Skip to content

Commit

Permalink
tikv allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
amigin committed Jan 10, 2024
1 parent acc96a5 commit 2fc5d62
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ prometheus = "*"
async-trait = "*"
tokio-stream = "*"
zip = "*"
jemallocator = "*"

tikv-jemalloc-ctl = { version = "*", features = ['use_std'] }
tikv-jemallocator = { version = "*", features = [
"unprefixed_malloc_on_supported_platforms",
] }

[build-dependencies]
tonic-build = { version = "*", features = ["prost"] }
10 changes: 7 additions & 3 deletions src/app/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,19 @@ impl PrometheusMetrics {
pub fn update_tcp_threads(&self, threads_statistics: &ThreadsStatistics) {
self.tcp_connections
.with_label_values(&["ping_threads"])
.set(threads_statistics.get_ping_threads() as i64);
.set(threads_statistics.ping_threads.get());

self.tcp_connections
.with_label_values(&["read_threads"])
.set(threads_statistics.get_read_threads() as i64);
.set(threads_statistics.read_threads.get());

self.tcp_connections
.with_label_values(&["write_threads"])
.set(threads_statistics.get_write_threads() as i64);
.set(threads_statistics.write_threads.get());

self.tcp_connections
.with_label_values(&["connection_objects"])
.set(threads_statistics.connections_objects.get());
}

pub fn mark_new_tcp_disconnection(&self) {
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub mod mynosqlserver_grpc {
}

#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;

#[tokio::main]
async fn main() {
Expand Down

0 comments on commit 2fc5d62

Please sign in to comment.