tidwall / summitdb

In-memory NoSQL database with ACID transactions, Raft consensus, and Redis API
Other
1.41k stars 78 forks source link

Question: what happened when out of memory? #31

Closed kokizzu closed 4 years ago

kokizzu commented 4 years ago

eg. what happened when VM's RAM only 4GB, but the data stored is 8GB, what would happened?

tidwall commented 4 years ago

The process will probably terminate.

Depends on your operating system, but in most cases, the Go runtime (which runs SummitDB) will request more memory using an mmap syscall and the OS will return an ENOMEM error, at which point the Go runtime will print out an Out of Memory panic along with the call stack to stdout, and abort the process.

Linux may kill other processes first.

There's a lot of resources on the internet about what happens when your computer runs out of memory.

kokizzu commented 4 years ago

Ah i see, same as Redis then, data sets can't be larger than memory size.