Unloading a chunk with many tile entities (containers with contents) in it will cause a lag spike. These lag spikes affect the client even in multiplayer. Since loading these chunks does not cause a similar lag spike, I believe that the garbage collector is causing this.
Steps to reproduce:
Place around 2000 chests or other containers in the same chunk column.
Fill them with items.
Move away from the containers.
As the containers leave your view distance, observe a period of several seconds where the game visually freezes completely.
Forward resolving to MC-117075.