Huge lag spikes

Roughly what happens:
my computer starts to buzz a lot, the game freezes, along with the whole computer, discord stops working, and all this for from 1 to 20 seconds. In this case, the maximum CPU load is 50%, GPU - 50%. A year ago, when I played, this was not the case.
CPU - i5-10400F
GPU - RTX 3060
RAM - 16 GB DDR4
Internet - cable, up to 800 megabit/s, no delays.
Server - EU, location - EU East.
I will also note that this did not happen in any game except D2R.
Please help me understand what I need to do to prevent this from happening, I don’t understand the reason.

Sounds like overheating/potential hardware problems. Take your computer somewhere reputable to have them diagnose the problem.

As it turned out, 16GB of RAM was not enough and the same thing happened as in Minecraft - as soon as the memory was completely full, everything froze and the garbage collector started working. I just found this out when I installed an additional 16 GB of memory. Overkill, but I planned to expand the RAM

Good deal…

I’m running 16GB RAM myself, and there are occasional times where the RAM usage will get pretty high playing games. 16GB is quickly becoming the “bare minimum” to play newer games, with 32GB being the new “sweet spot”. Ever since the old days of trying to run games that required a Pentium processor on a 486 and trying to squeeze every ounce of performance from that old bucket, that engrained running a minimalist setup into my brain. Since then, I have always been a stickler about making sure only the absolute necessary programs I need to start up automatically do so when turning the system on. There are waaaaaaaay too many programs that want to start up automatically by default.

Programs and games just keep getting bigger and bigger.

Turns out RAM wasn’t the case)
I’ll keep searching

Check the SMART status of your storage device(s) and see if they are healthy.

Pending sectors for reallocation = trouble, back up any critical data immediately.

it says 86%, what else I need to check?

Anything below 100% means your solid-state drive has started consuming its available reserve space due to parts of your SSDs NAND flash reaching max writes. This occurs for a couple of reasons…

Once is due to simply writing a lot of data… High RAM usage conditions, and excessive usage of the system paging file to free up RAM to run games/programs.
The other is due to the drive being close to full, which accelerates NAND write wear in the available free space.

If it doesn’t report “C5 - Pending sectors for reallocation”, then the SSD you have doesn’t report that statistic. Some SSDs do, some don’t.

When the SSD health is below 90%, I recommend replacing the SSD.

Okay, maybe I’ll change it (I don’t have endless supplies of money xD). Why then does this not happen in other, more demanding games?

It’s just a suggestion with the evidence at hand.

D2:R is not as optimized as other games, because D2:R is literally the original game running within a glorified graphics wrapper.

What resolution are you running the game at?

Fullscreen 1980x1080
I tried lowering the graphics, but it still lags from time to time. Even when the FPS drops, I can’t do anything, neither alt+tab, nor ctrl+alt+delete. Do you know of any programs that track down the cause of the lags/freezes?

This might help

Do you have “One drive” or “Google drive” running in the background?

The problem was caused by this user being an administrator