Hi all!
I'm building a simple CRUD web application with Jester and Sqlite. Today I looked at top on the server (a very cheap VPS) and saw that memory usage was about 80MB. That sound very strange to me, as this is not my first Jester app. I measured the app on my laptop and it start at 1,9MB and after some page load on the browser it goes about 8/9MB. This is what I expected on the server.
Binary is compiled on my laptop, then rsync'ed on server. Database file is the same, very small, about 400k.
Anyway database isn't the problem, as I tried the simple example:
import htmlgen
import jester
settings:
bindAddr = "127.0.0.1"
routes:
get "/":
resp h1( "Hello world" )
compiled with nim c -d:release and got on my laptop res: 2,7MB, shr: 1,9MB. On the vps res: 62,4MB, shr: 2,0MB.
nim is stable 0.19.4, jester is from nimble, 0.4.1
Other processes on the server like nginx, php-fpm, etc. have reasonable memory usage. Have you got any idea of what's going on?
I also tried asynchttpserver with similar results (~20MB vs ~500kB):
import asynchttpserver, asyncdispatch
var server = newAsyncHttpServer()
proc cb(req: Request) {.async.} =
await req.respond(Http200, "Hello World")
waitFor server.serve(Port(8080), cb)
Lastly I switched to nim devel and everything is okay. Memory usage is same on laptop and server. So imho there's something wrong with 0.19.x and I'd love to help, just don't know how!
If it's fixed on devel, it's possible to do a git bisect to track what fixed the issue.
There are months of commits though and several are a pain during bisections because you need to rebootstrap Nim (not nil changes from August especially) so it might not be worth it.