oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.49k stars 2.79k forks source link

discord.js bot memory usage 6x higher and climbing with switch from Node to Bun #8856

Open leonlarsson opened 9 months ago

leonlarsson commented 9 months ago

What version of Bun is running?

1.0.26+c75e768a6

What platform is your computer?

Not sure sorry. Hosted on Railway

What steps can reproduce the bug?

I am hosting https://github.com/leonlarsson/Battlebot on Railway using the Dockerfile in the repo.

Below is the observed memory usage: The switch to Bun can be seen in the graph. 2024-02-11_19-08-48 2024-02-11_19-13-27 2024-02-11_19-25-50

What is the expected behavior?

I would expect Bun to be on par with Node. I am new to Docker, so there might be something I am doing wrong. I would love to be wrong.

What do you see instead?

I see both a higher and climbing memory usage. I also host another bigger disord.js bot on Railway that is also seeing the same higher and climbing memory usage: 2024-02-11_19-17-12 2024-02-11_19-18-29

Additional information

I have read through https://github.com/oven-sh/bun/issues/3065, and it might be of interest.

Jarred-Sumner commented 9 months ago

If you pass --smol, do the results differ?

leonlarsson commented 9 months ago

If you pass --smol, do the results differ?

I've just redeployed it with --smol. Will report back.

leonlarsson commented 9 months ago

Early observation: It seems to be acting the same way. Higher than Node's baseline and climbing 2024-02-12_15-51-09 2024-02-12_15-53-02

leonlarsson commented 9 months ago

Not looking hot 2024-02-13_18-19-54

leonlarsson commented 9 months ago

Update: The last deployment (last vertical line) is where I added Bun.gc() to run on every shard, every 5 minutes. It seemed to have been effective at first, but it also started to climb. 2024-02-16_11-34-33