Metabase getting slow and stop working after opening mongo db collection

Getting the below-mentioned error and after Metabase restart, this gets resolved.
The CPU usage also gets up to 100% most of the time. Can someone help with the standard server configuration to run the Metabase? My current system has 2 cores with 8GB of RAM.

2022-03-07 14:23:41,773 ERROR middleware.log :: GET /api/database/2/metadata 500 27.5 mins (296 DB calls)
{:via [{:type java.lang.OutOfMemoryError, :message "Java heap space"}],
:trace [],
:cause "Java heap space",
:message "Java heap space"}

Hi @asharma
Post "Diagnostic Info" from Admin > Troubleshooting.
And how many tables (collections) and columns (fields) does the database connection have access to?

"browser-info": {
"language": "en-GB",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36",
"vendor": "Google Inc."
"system-info": {
"file.encoding": "UTF-8",
"": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.13+8-Ubuntu-0ubuntu1.20.04",
"java.vendor": "Ubuntu",
"java.vendor.url": "",
"java.version": "11.0.13",
"": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.13+8-Ubuntu-0ubuntu1.20.04",
"": "Linux",
"os.version": "5.4.0-1045-aws",
"user.language": "en",
"user.timezone": "Etc/UTC"
"metabase-info": {
"databases": [
"hosting-env": "unknown",
"application-database": "mysql",
"application-database-details": {
"database": {
"name": "MariaDB",
"version": "10.3.34-MariaDB-0ubuntu0.20.04.1"
"jdbc-driver": {
"name": "MariaDB Connector/J",
"version": "2.6.2"
"run-mode": "prod",
"version": {
"date": "2021-07-08",
"tag": "v0.40.0",
"branch": "master",
"hash": "961caed"
"settings": {
"report-timezone": null

collections 280

@asharma You should upgrade immediately to a newer release: