Skip to content

Instantly share code, notes, and snippets.

@antronic
Last active June 20, 2025 06:56
Show Gist options
  • Save antronic/4a13ae17aca46ddd8effa4f5b4cbc554 to your computer and use it in GitHub Desktop.
Save antronic/4a13ae17aca46ddd8effa4f5b4cbc554 to your computer and use it in GitHub Desktop.
let getCache = () => {
let maxCache = db.serverStatus().wiredTiger.cache['maximum bytes configured']
let useCache = db.serverStatus().wiredTiger.cache['bytes currently in the cache']
return {
maxCache: maxCache / 1024 / 1024, // Convert to MB
useCache: useCache / 1024 / 1024, // Convert to MB
usePercent: (useCache / maxCache * 100).toFixed(2) + '%', // Percentage of cache used
}
}
let interval = setInterval(() => console.log(getCache()), 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment