Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Start by measuring the whole VPS, not just the mysqld resident-set size. MySQL deliberately keeps data in global caches, allocates buffers per connection and statement, and can retain Performance Schema memory while the server runs. High RAM use is a problem when it leaves the operating system or neighboring services without headroom, causes swap activity, triggers the OOM killer, or produces errors and latency—not simply because the mysqld number looks large.

Use the sequence below: establish host pressure, capture MySQL configuration and concurrency, attribute memory, then make one controlled change at a time. On a small VPS, the practical fix is often a smaller InnoDB buffer pool combined with a realistic connection limit and tighter per-session or temporary-table buffers. If those settings still leave no safe headroom, the correct fix is more RAM or a separate managed database, not increasingly aggressive tuning.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why MySQL can use a large amount of RAM

MySQL memory has several layers. InnoDB’s buffer pool caches table and index pages so frequently used data can be served from memory. The server also reserves global areas such as the InnoDB log buffer and, for MyISAM workloads, the key buffer. These allocations form much of the baseline resident set.

Other allocations scale with activity. Every established connection can consume session memory. Network and result buffers begin at net_buffer_length and can grow as high as max_allowed_packet. A session also receives max_digest_length bytes for statement-digest storage. Sort, join, read, and read-rnd buffers are additional per-session or per-operation consumers; many simultaneous sessions can multiply them.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Internal temporary tables can consume RAM when a query needs intermediate results. Performance Schema may allocate memory at startup and while observing workload. Its instrumented memory is not freed during normal operation; it is released when the server shuts down. Therefore, a resident set that grows during a busy period is not automatically a leak. The important question is which category is growing and whether the VPS is under pressure.

1. Confirm that the VPS, not only MySQL, is short of memory

Take a baseline during normal traffic and again during the period when memory use is reported as high. Run:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
free -h
ps -o pid,ppid,%mem,rss,vsz,cmd -C mysqld

free -h shows total, available, and swap memory. The ps output shows the MySQL process resident set (RSS). RSS includes allocator overhead and memory that may not be represented by a MySQL status table, so do not expect the numbers to match exactly.

Record whether the same VPS runs Apache, PHP-FPM, Redis, backup jobs, monitoring agents, containers, or another database. A buffer pool that is reasonable on a database-only host can be unsafe when a web stack needs several gigabytes at the same time. If your provider exposes systemd or cgroup metrics, use those as well; a container or service limit can be lower than the VPS’s advertised RAM.

Check the kernel and service logs for out-of-memory events. Typical commands are:

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
dmesg -T | grep -i -E 'out of memory|oom|killed process'
journalctl -k --since '24 hours ago' | grep -i -E 'out of memory|oom|killed process'
journalctl -u mysql --since '24 hours ago'

Use the command that your distribution permits; some VPS kernels restrict dmesg. An OOM-killer event, active swap-in or swap-out, failed allocations, or simultaneous failures in PHP and MySQL confirms host-level pressure. If available memory remains healthy and there are no symptoms, a large RSS may simply be MySQL’s intended cache.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Capture configuration and concurrency before changing anything

Save the current values so every change is reversible and so you can compare a quiet period with a peak. Run:

SHOW VARIABLES WHERE Variable_name IN (
  'innodb_buffer_pool_size',
  'innodb_log_buffer_size',
  'max_connections',
  'max_allowed_packet',
  'net_buffer_length',
  'sort_buffer_size',
  'join_buffer_size',
  'read_buffer_size',
  'read_rnd_buffer_size',
  'tmp_table_size',
  'max_heap_table_size',
  'performance_schema'
);

Then capture connection demand:

SHOW GLOBAL STATUS WHERE Variable_name IN
  ('Threads_connected','Threads_running','Max_used_connections');
Metric What it tells you How to use it
Threads_connected Connections currently open Shows the present session-memory multiplier.
Threads_running Connections actively executing Useful for identifying a peak that can multiply operation buffers.
Max_used_connections Highest simultaneous connection count since the last reset Compare with max_connections and the application pool’s configured limit.

max_connections is a capacity ceiling, not a performance target. A value far above observed demand reserves the possibility of a large memory spike. Conversely, lowering it below the application’s legitimate peak will cause connection failures, so check web-server and application pool settings before editing it.

3. Attribute the resident set with Performance Schema

When performance_schema is enabled, use its memory instruments instead of guessing. First inspect which memory instruments exist and whether they are enabled:

SELECT NAME, ENABLED, TIMED
FROM performance_schema.setup_instruments
WHERE NAME LIKE 'memory/%'
ORDER BY NAME;

Enable only the instruments needed for diagnosis, following the syntax supported by your installed MySQL release. Then query global totals:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
SELECT EVENT_NAME, CURRENT_NUMBER_OF_BYTES_USED,
       CURRENT_COUNT_USED, HIGH_NUMBER_OF_BYTES_USED
FROM performance_schema.memory_summary_global_by_event_name
WHERE CURRENT_NUMBER_OF_BYTES_USED > 0
ORDER BY CURRENT_NUMBER_OF_BYTES_USED DESC;

Account and thread summaries can show whether a user, connection class, or workload is responsible:

SELECT *
FROM performance_schema.memory_summary_by_account_by_event_name
ORDER BY CURRENT_NUMBER_OF_BYTES_USED DESC
LIMIT 25;

Column names and available summary tables vary by release. If a query fails, inspect information_schema.tables for the memory-summary tables present on your server and use the corresponding columns documented for that release.

Look for code areas such as memory/innodb and memory/sql. Compare the instrumented total with the process RSS from the operating system. The difference includes allocator overhead and uninstrumented areas, so a gap is expected; a rapidly growing gap is a reason to investigate the allocator, plugins, connectors, or a possible leak rather than blindly increasing limits.

4. Check the InnoDB buffer pool before shrinking it

The buffer pool is often the largest intentional allocation. Oracle’s MySQL Reference Manual says that a typical recommended innodb_buffer_pool_size is 50 to 75 percent of system memory. That is a starting range for a host dedicated largely to MySQL, not a promise for a small VPS running a complete application stack. Reserve memory for the kernel, filesystem cache, web workers, agents, replication, and temporary peaks.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect InnoDB’s view of the pool:

SHOW ENGINE INNODB STATUSG

Use the buffer-pool sections and your operating-system baseline to determine whether the pool consumes most of the available RAM. A pool that is too small can cause page churn and more storage reads; a pool that is too large can force swapping and make the entire VPS unstable.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Stage a buffer-pool reduction

  1. Choose a modest reduction based on the memory headroom you actually need; do not jump directly to a generic percentage.
  2. Confirm whether your installed MySQL version supports dynamic changes to innodb_buffer_pool_size and what granularity or restart behavior it requires. Variable behavior differs by release and distribution.
  3. Apply the change through the supported administrative method, record the old and new values, and watch available memory, swap activity, query latency, and errors.
  4. If the release requires a restart, schedule it, verify that the new value loaded, and recheck the application immediately afterward.

Make one buffer-pool change at a time. If latency rises because the working set no longer fits, restore part of the reduction or plan additional RAM rather than allowing the host to swap.

5. Control connection and per-session memory

Each established connection can consume memory even when it is idle, and active statements can allocate additional buffers. Calculate pressure from the observed peak, not from an average request rate. A high max_connections combined with large session buffers creates a worst-case multiplication that may never appear in a quiet test.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set a defensible connection ceiling

  1. Compare Max_used_connections with max_connections over a representative busy period.
  2. Check the connection-pool limits in the application, PHP-FPM, job workers, and proxy layer.
  3. Lower max_connections only when the new ceiling exceeds the real peak plus a small operational margin.
  4. Monitor rejected connections and application errors after the change; raise the ceiling or fix pooling if legitimate traffic is being refused.

Do not treat a lower ceiling as a substitute for fixing a connection leak. Idle sessions that never return to the pool still consume resources and should be closed or recycled by the application.

Keep packet and operation buffers tied to real workloads

net_buffer_length is the initial network buffer, while a session can grow its connection and result buffers up to max_allowed_packet. Set the packet limit high enough for the largest legitimate statement or row, but do not use an enormous value as a general memory fix. Verify import, replication, and application requirements before reducing it.

Review sort_buffer_size, join_buffer_size, read_buffer_size, and read_rnd_buffer_size. These are not free global reservations: concurrent statements can allocate them simultaneously. Prefer query and index improvements over large buffers. Apply session-level values for an exceptional report or maintenance job instead of raising global defaults for every connection.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Limit internal temporary-table memory

When a query cannot complete an operation in its normal execution structures, MySQL may create an internal temporary table. Large in-memory temporary tables can produce short, sharp spikes that a baseline measurement misses. If memory summaries, status counters, or a workload trace points to this category, review tmp_table_size and max_heap_table_size.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Identify the statements creating large temporary results with the query-observability tools available in your release.
  2. Reduce tmp_table_size and max_heap_table_size in a controlled step so oversized temporary results spill to disk rather than exhausting RAM.
  3. Fix the underlying queries and indexes: reduce unnecessary grouping or sorting, select only required columns, and add indexes that match the access pattern.
  4. Measure storage I/O and latency after the change.

Lower limits protect the VPS but can increase disk I/O and response time because more work is performed on on-disk temporary tables. Faster storage does not remove the need to fix inefficient queries; it only reduces the cost of the spill.

7. Investigate Performance Schema growth without disabling it blindly

Performance Schema can allocate memory at startup and while it observes new workload patterns. It does not free that memory during normal operation, although a shutdown releases it. Autoscaled buffers have sizing parameters that can cap growth. Use the memory instruments and summary tables to identify the category before changing instrumentation.

If a particular instrument expands with a predictable workload, set an appropriate cap supported by your release and recheck whether the workload still has the observability it needs. Disabling all instrumentation may hide the evidence needed to find the real source of growth. A restart can be useful as containment when memory must be returned immediately, but recurring growth after restart calls for workload, configuration, plugin, or leak investigation.

8. Choose the least risky remedy

Remedy Memory effect Trade-offs Restart usually required? Protects
Reduce InnoDB buffer pool Lowers baseline RSS Less cache capacity, more page reads, possible latency increase Depends on MySQL release and change method Whole VPS, when the pool is the dominant consumer
Lower max_connections Reduces worst-case session multiplier Can reject legitimate clients if set below the real peak Often dynamic, but verify your release Whole VPS during connection spikes
Tighten per-session buffers Reduces memory per active statement Sorts, joins, or reads may become slower; query-specific exceptions may be needed Usually variable-dependent MySQL during concurrent workloads
Lower temporary-table limits Caps in-memory intermediate results More disk I/O and potentially higher latency Verify variable behavior Whole VPS during query spikes
Cap Performance Schema autoscaling Limits instrumentation growth Less retained observability or lower diagnostic capacity Some sizing changes require restart MySQL’s instrumentation footprint
Increase VPS RAM or move the database Adds headroom without shrinking caches Higher recurring cost and possible migration or network changes Migration planning may be required Entire stack when safe tuning is insufficient

9. Validate every change under representative load

After each change, repeat the same measurements rather than relying on a single ps snapshot. Check:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • available and swap memory from the operating system;
  • mysqld RSS and, where applicable, service or cgroup limits;
  • swap-in and swap-out activity and new OOM-killer messages;
  • Threads_connected, Threads_running, and rejected-connection errors;
  • query latency, throughput, deadlocks, and application error rates;
  • disk I/O and temporary-table spill behavior after changing temporary limits;
  • Performance Schema memory summaries and the gap between instrumented bytes and RSS.

Test during the workload that caused the incident: batch imports, traffic bursts, reporting queries, backups, or deployment jobs can have very different memory profiles. Keep a rollback value for every variable and change only one category at a time so the effect is attributable.

When tuning is not enough

If the VPS still swaps or reaches the OOM threshold after the buffer pool, connection ceiling, session buffers, temporary tables, and instrumentation have been measured and right-sized, there may simply be insufficient capacity. Increase RAM when the application and database must share the host and the working set legitimately needs more memory. Consider a managed MySQL service or a separate database host when backups, failover, maintenance, and isolation matter as much as raw capacity.

A persistent, unexplained increase after attribution deserves a focused investigation of the workload, plugins, connectors, and MySQL release. A controlled restart can reclaim memory as short-term containment, but it does not prove that a leak is fixed. Keep the before-and-after measurements so the next decision is based on evidence rather than a single headline memory number.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.