Hopefully a quick support Q: Is there a way to ma...
# community-help
y
Hopefully a quick support Q: Is there a way to make sure a server running Typesense has “enough” memory? Considering typesense has this thing where it wants X% amount of memory on the server. If it doesn’t then it crashes. What is the X? We’ve running a server on EC2 for a couple of months and still can’t figure what is the indicating factor that lets us know “hey if you load any more collections, I’ll crash”
f
👀 1
ó
Add swap to avoid the crash but add monitoring to upgrade as soon as the swap starts being used
1
🧠 2
y
Thanks Fanis, sounds like we have some calculating to do on what we want to store in memory and a great suggestion Óscar
ó
We are doing it that way but in Azure
y
I guess the other part of my Q — is there anything in TS itself that would make it fall over? Not talking about the OS. Anything weird like TS is preemptively doing some check for free memory and if it sees some lower % number, it shuts itself down
ó
When it compacts the database, it will use a lot of disk. Usually in TS cloud if I remember correctly, the disks are 4-5 times the amount of ram to handle compacting and snapshots.
We use 64gb machines and 256gb disks
We had some problems because this
All in all, if it starts TS it's pretty stable. Unless without enough memory ofc
j
There are checks in Typesense the verify that there is enough RAM before let writes come in, but Typesense does not shutdown itself when these checks are triggered. We just return an API response saying out of memory. What is most likely shutting down Typesense is the Operating System's OOM reaper because it wants to preserve the entire OS running out of RAM
y
Ok awesome thanks for that temperature check Óscar and verifying TS behavior Jason!
Wrt to disk, our disks are big enough so that would’t the issue. We have a 384GB RAM and 500GB of disk and I’ve never seen disk go above 200GB of usage. We use that server for testing multiple collections. Each collection is huge, ~20GB. The issue happens when we keep loading collections and forget to delete old ones. I’ll keep monitoring but what I’m seeing is that TS crashes even when memory usage is well below 100%
But having you confirm that TS isn’t shutting itself down in any way makes me doubt myself, Jason. I’ll keep an eye out and will report by findings here.
ó
It's recomended to have disks 5 times the size of the ram usage, it's rare to have issues, but we did in the past and this is what TS suggested
🙏 1
j
You want to look at your syslog for a string called “oom” - that’s the definitive way to tell that it’s the OS OOM reaper stepping in to kill the typesense process because there isn’t enough RAM to hold all the data
🧠 1
🙌 1