Skip to content

Commit

Permalink
Remove potentially expensive heap stats computation (#31074)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 8974d55175d4d0896b5b6057371975b470630016
  • Loading branch information
sujayakar authored and Convex, Inc. committed Oct 31, 2024
1 parent 6768818 commit 80a6f8b
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 51 deletions.
16 changes: 0 additions & 16 deletions crates/application/src/application_function_runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ use isolate::{
HttpActionOutcome,
IsolateClient,
IsolateConfig,
IsolateHeapStats,
JsonPackedValue,
UdfOutcome,
ValidatedPathAndArgs,
Expand Down Expand Up @@ -187,7 +186,6 @@ use usage_tracking::{
FunctionUsageTracker,
};
use value::{
heap_size::HeapSize,
id_v6::DeveloperDocumentId,
identifier::Identifier,
TableNamespace,
Expand Down Expand Up @@ -587,12 +585,6 @@ pub struct ApplicationFunctionRunner<RT: Runtime> {
fetch_client: Arc<dyn FetchClient>,
}

impl<RT: Runtime> HeapSize for ApplicationFunctionRunner<RT> {
fn heap_size(&self) -> usize {
self.cache_manager.heap_size()
}
}

impl<RT: Runtime> ApplicationFunctionRunner<RT> {
pub fn new(
instance_name: String,
Expand Down Expand Up @@ -697,14 +689,6 @@ impl<RT: Runtime> ApplicationFunctionRunner<RT> {
Ok(())
}

pub fn database_heap_size(&self) -> IsolateHeapStats {
self.analyze_isolate.aggregate_heap_stats()
}

pub fn http_actions_heap_size(&self) -> IsolateHeapStats {
self.http_actions.aggregate_heap_stats()
}

// Only used for running queries from REPLs.
pub async fn run_query_without_caching(
&self,
Expand Down
12 changes: 0 additions & 12 deletions crates/application/src/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ pub struct CacheManager<RT: Runtime> {
cache: Cache,
}

impl<RT: Runtime> HeapSize for CacheManager<RT> {
fn heap_size(&self) -> usize {
self.cache.heap_size()
}
}

#[derive(Clone, Eq, PartialEq, Hash)]
pub struct CacheKey {
path: PublicFunctionPath,
Expand Down Expand Up @@ -716,12 +710,6 @@ impl Cache {
}
}

impl HeapSize for Cache {
fn heap_size(&self) -> usize {
self.inner.lock().size
}
}

impl Inner {
// Remove only a `CacheEntry::Ready` from the cache, predicated on its
// `executor_id` matching.
Expand Down
12 changes: 0 additions & 12 deletions crates/application/src/function_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,6 @@ pub struct FunctionExecutionLog<RT: Runtime> {
rt: RT,
}

impl<RT: Runtime> HeapSize for FunctionExecutionLog<RT> {
fn heap_size(&self) -> usize {
self.inner.lock().heap_size()
}
}

impl<RT: Runtime> FunctionExecutionLog<RT> {
pub fn new(rt: RT, usage_tracking: UsageCounter, log_manager: Arc<dyn LogSender>) -> Self {
let inner = Inner {
Expand Down Expand Up @@ -1228,12 +1222,6 @@ struct Inner<RT: Runtime> {
metrics: Metrics,
}

impl<RT: Runtime> HeapSize for Inner<RT> {
fn heap_size(&self) -> usize {
self.log.heap_size() + self.log_waiters.heap_size()
}
}

impl<RT: Runtime> Inner<RT> {
fn log_execution(
&mut self,
Expand Down
5 changes: 0 additions & 5 deletions crates/database/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ use usage_tracking::{
UsageCounter,
};
use value::{
heap_size::HeapSize,
id_v6::DeveloperDocumentId,
Size,
TableNamespace,
Expand Down Expand Up @@ -2018,10 +2017,6 @@ impl<RT: Runtime> Database<RT> {
self.usage_counter.clone()
}

pub fn write_log_size(&self) -> usize {
self.log.heap_size()
}

pub fn search_storage(&self) -> Arc<dyn Storage> {
self.search_storage
.get()
Expand Down
6 changes: 0 additions & 6 deletions crates/database/src/write_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,6 @@ impl LogReader {
}
}

impl HeapSize for LogReader {
fn heap_size(&self) -> usize {
self.inner.read().heap_size()
}
}

/// LogWriter can append to the log.
pub struct LogWriter {
inner: Arc<RwLock<WriteLog>>,
Expand Down

0 comments on commit 80a6f8b

Please sign in to comment.