Replying to Avatar semisol

DMs

i found a solution

#!/usr/bin/env bash

export APP_NAME=realy

export LISTEN=0.0.0.0

export PORT=3334

export PPROF=false

export SUPERUSER=npub1fjqqy4a93z5zsjwsfxqhc2764kvykfdyttvldkkkdera8dr78vhsmmleku

export GOGC=10

export MEMORYLIMIT=1000000

export GOMAXPROCS=1

/home/mleku/.local/bin/realy

now, it can swallow 180mb of events from a backup without blowing out the memory (2gb)

the other thing i did was disable running the database compact/gc cleanup and force it to pause a second every 1000 events, to give the GC more time to throw out the trash

and voila, runs nicely in 2gb of memory with plenty of space for the heap blowing up from normal business and no swap required

swap also fixed the problem, but it didn't really make it much faster, so, GC > swap

Reply to this note

Please Login to reply.

Discussion

i love these types of optimizations. systems world was infected by "servers are cheaper than humans so just throw hardware at it".

increasingly though, feels like this wont be the case in the future. (or even now)