Skip to content

docker host with 2GB: how many services?

VPS Hosting by ronwit 27 replies 2.7K views
#11
kasiaxus said:
Postgres tuneable better than MariaDB

Perkele. Postgres still too heavy. SQLite for single-user nextcloud. No daemon. No tcp port. 20MB.

services:
  nextcloud:
    image: nextcloud:apache
    environment:
      SQLITE_DATABASE: nextcloud

Caddy + pihole + nextcloud-sqlite + one static site. 4 containers. 400MB total. Rest of RAM for buffers.

Starter pack should have sqlite tier and postgres tier. Not everyone same needs.

#12

¡the SQLite for Nextcloud! I dont know this possible, caramba~

But the Nextcloud official, it says "SQLite only for minimal testing" no? Vos think is safe for the real use?

My homelab in Buenos Aires, I have the MariaDB in separate Pi4, but the Pi4 also has the heatstroke in summer (´・ω・`) this face is mine now, the heatstroke face

Maybe for the tiny VPS, the SQLite okay if no many users. One person, two person, no problem. Three person, maybe the lock contention? I dont know the technical word in english, "contención de bloqueos"~

hot air, steady hand, magic smoke
#13
Hel said:
SQLite for single-user nextcloud

Non. Nextcloud with SQLite, the performance degrades with files app, with sync client, with anything concurrent. I tested this. The lock waits, the timeouts, the despair.

Better: separate the database to a cheap second VPS. Contabo has 1GB for 4 EUR in Nuremberg — https://contabo.com/en/vps/. Or use Hetzner CX11, 4.51 EUR, Falkenstein, close to Contabo.

Two VPS: one for apps, one for database. Network between them is fast if same region. This is how we do in Lyon, we separate concerns.

But starter pack for single VPS, I agree: postgres tuned, or mariadb with my.cnf limits. Not SQLite for production.

#14
blogfranck said:
Separate the database to a cheap second VPS

Nossa, now we buy TWO vps? The budget king ronwit will cry (´・ω・`)

I am generous with myself at RackNerd, but two VPS is not "tiny vps" anymore, is "tiny cluster" xd

My real advice for starter pack: categorize by RAM tier.

  • 512MB: static sites only, caddy + one app
  • 1GB: caddy + pihole + sqlite nextcloud (single user, be humble)
  • 2GB: caddy + pihole + postgres nextcloud + one more app
  • 4GB: now we talk jellyfin, now we talk transcoding

The transcoding, it needs the RAM or the GPU. No magic.

#15
ronwit said:
How you know this?

`uname -r` will tell you kernel version. `systemd-detect-virt` or `dmidecode` for hypervisor info. Some kernels have memory ballooning, some reserve more for virtio.

I mostly lurk but I check these things when debugging OOM on my own box.

...
#16

nginx OOM twice a day was a question, not my experience. But @ronwit you answered: 90% cpu from jellyfin. That's the real bottleneck hiding.

Drop jellyfin, your RAM breathing room improves, but also CPU. Transcode is CPU murder on cheap VPS.

#17

Okay okay, the starter pack by RAM tier is actually genius @beto60

I made my compose with jellyfin because "why not, I have the space" but I dont have the space, I have the lie of space xd

Current status after dropping jellyfin and adding memory limits:

services:
  npm:
    deploy:
      resources:
        limits:
          memory: 128M
  pihole:
    deploy:
      resources:
        limits:
          memory: 128M
  nextcloud:
    deploy:
      resources:
        limits:
          memory: 256M
  db:
    deploy:
      resources:
        limits:
          memory: 256M

`docker stats` shows 850MB used total. Still 7 more containers to limit, but already better. Maybe I contribute the "lessons learned" to starter pack: start with limits, add services one by one, watch `docker stats` like hawk.

instant noodles, instant deploys
#18
ronwit said:
Watch `docker stats` like hawk

Better: prometheus + node_exporter + cadvisor. But on 2GB? No. Use `ctop` or simple script.

I run 20 containers on 4GB in Singapore, latency to Tokyo Contabo is 70ms. Not great, not terrible. For your use case, local monitoring only.

My script for quick check:

#!/bin/sh
docker ps --format "{{.Names}}" | while read c; do
  echo -n "$c: "
  docker stats --no-stream --format "{{.MemUsage}}" "$c"
done

No overhead. Run from cron, log to file, check when slow.

8 #19

Speaking of overhead, has anyone tried running inference on these tiny boxes? I know, wrong thread, but the RAM math is similar.

Llama.cpp with 7B q4_0 needs 4GB+ just for weights. Not happening on 2GB. But smaller models, phi-2 or tinyllama, maybe 1.5GB with careful limits. I squeeze tokens on GTX 1060 at home, not VPS, but the principle of memory limits applies.

Not suggesting ronwit add AI to his compose. Please don't. Just noting the discipline of limits is universal.

CUDA cores are my love language
6 #20
singapore said:
Prometheus + node_exporter + cadvisor

Beautiful tools, but on 2GB this is like bringing orchestra to bus stop. Overkill.

@ronwit your 850MB with 4 containers limited, good start. But npm still 128M? Caddy is 64M as @Hel said. Npm is nginx + nodejs + database inside, very heavy. If you only need reverse proxy, caddy simpler.

If you need npm features (lists, graphs, users), okay keep it. But know the cost.

POLISH SERVERS. LOUD FANS. GOOD PRICE.

Post a reply

You need an account to reply. Log in or register to join the conversation.

Post reply Preview Save draft