Newbie seeks help: Nat built a solid PC, but memory keeps crashing

[Thread] LXC Architecture with 384MB RAM and high latency (300ms RTT): how to fix V2bX OOM when running speedtest?

1. Environment Background (Environment)

  • Virtualization Architecture: LXC container (shared kernel)
  • Operating System: Debian 12 (system footprint around 70M); Alpine has been tried too, not much better
  • Hardware Configuration: 1 vCPU / 384MB RAM
  • Server-side Application: V2bX (VLESS + Reality)

2. Problem Description (The Issue)

When under high concurrency or heavy traffic during speed tests, once the speed reaches around 500 Mbps, the V2bX process is OOM-killed by the system (status 9/KILL).
Speedtest is the only thing that triggers it; 8k and cloud drive downloads are fine.

Core contradiction:

Tried reducing the buffer to 4 MB, but it still OOM-killed. Very odd.

3. Troubleshooting

A. Go Runtime Environment Tuning

Configured environment variables in the systemd service file to suppress Go’s memory scaling (garbage collector growth).

  • Result: It still OOM-killed.

B. Bandwidth Limiting Attempt

Tried limiting to 100 Mbps, but speedtest kills the v2bx process

C. Kernel Buffer Adjustment

Tried modifying net.ipv4.tcp_rmem and tcp_wmem to around 4 MB; not much effect.


Later observed that speedtest uses a lot of concurrent TCP packets, reaching 250+, not sure if that’s the issue (single-threaded runs won’t crash, but speeds are only around 30). In practice it’s fine, not going to worry about it.

7 Likes

Switch to xray-core

Forgot to mention, I started with Singbox, but after switching to Xray it crashes faster.

Case closed… The speed test ended up pulling in 220 TCP connections… We normally don’t need that many at all—just cap the concurrency.

I was just about to reply to you. I usually use MemoryHigh=256M to limit systemd processes, and it has never crashed. I’m using Xray 26.5.9.

Dude, I’m on Alpine. My home Debian image isn’t great; it uses up 130 right at boot, and I don’t even have dd. I’ve given up now, embracing hy2 :sob:

What swap are you using for this LXC? Is it using the host’s swap?
Whatever shows up inside the container isn’t surprising.
With 384 MB of RAM and 128 MB, SS2022 used as an exit for other machines can still run at high speed.
What is that on their end—an E3 or some other weird thing?
Would this 384 MB crash just from a speed test?

Not sure what’s going on, but swap can be enabled on a Ryzen 9950X—the CPU isn’t under much load, and the memory ran out (OOM). Still, SS overhead should be lower than VLESS Reality, right?

Then I don’t have any tricks left; turning swap on is indeed useless.
Try Alpine + 3xui and see. My previous 256 MB deployment ran this fast for a long time without any issues.

1 Like

Curious how you configured swap. I remember LXC can’t configure swap inside the container itself, right? I guess you didn’t actually enable it.

With such a small amount of memory, if you don’t need edge nodes, it’s better not to use V2bX; its memory footprint isn’t small, you can just roll your own configuration.

That still seems too large. I saw you mentioned latency of 300ms earlier; this parameter should be determined based on RTT and target bandwidth by calculating the bandwidth-delay product. Moreover, your system and V2bX itself probably take up a fair amount of memory; try setting it below 16MB, preferably starting with 8MB; if it stays stable, then gradually adjust upward, for example:

net.core.rmem_max = 8388608
net.core.wmem_max = 8388608

net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_wmem = 4096 65536 8388608

If the node is only for your own use and the number of concurrent connections isn’t large, you can go a bit higher, but it’s not recommended to exceed 16MB."}

3 Likes

Also, it’s obvious that this post has been polished by an LLM. AI-generated or edited content can’t be posted directly—please revise it quickly.

1 Like

Sorry, man. I spent the morning tweaking things and still couldn’t get it right; had AI generate a Markdown file, and it’s full of errors. I set the parameter to over 4m; even with a 100m limit it still runs out of memory (speedtest always crashes, but uploading 8k and downloading from the cloud drive nothing happens—don’t know what’s going on).

Running Speedtest will indeed spike the number of concurrent connections, and 384MB of memory is not suitable for high-concurrency load testing. You can see whether a single-threaded speed test can meet your needs, and set a reasonable value to use for now.

Still, I would recommend against using a panel on such a low-memory machine, especially since V2board’s memory usage isn’t low; running bare-metal plus a hand-tuned configuration can free up a large portion of memory.

1 Like

Later I checked and it looks like vendor-provided swap, but the speedtest process dies too quickly—if you don’t need it, it crashes. But in real use it’s fine; I’m not going to bother with it anymore.

2 Likes

Does LXC use v2bx? Can LXC host a proxy service?

No, I bought more than a dozen of these pre-built rigs; manual import is too slow, so I simply used Xboard to pair with V2BX.