Solved Loading website and binaries to RAM.

jomonger

Member

Reaction score: 14
Messages: 41

Hello there,

I realized that backend and frontend is loaded from hard drive every time someone uses website.

I may have on server (2010 yr) like 20 GB free RAM memory while operating. All my frontend and backend have together ~0.5GB and backend can have one instance of every (3) program for all users, so I don't need hard drive for that.

Database is just 100 MB of text. For DB there is something like In-memory DB, and seems to be doable but I can't find any info about rest of stack.

Is there way to load data to RAM, f.e. in late BOOT or even later and put it out? Maybe I'm missing some terms/software?

There is plan to run on Erlang Elixir + c++. I have full access to source code, and I'm developing it so I'm free to choose tools.

I will be gratefull for any info.

Cheers.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 8,932
Messages: 33,331

I realized that backend and frontend is loaded from hard drive every time someone uses website.
You know there's this thing called a filesystem cache, right? And depending on your frontend (Apache, nginx?) they have caches too.

Database is just 100 MB of text. For DB there is something like In-memory DB, and seems to be doable but I can't find any info about rest of stack.
MySQL/MariaDB? Set your innodb_buffer_pool_size to a little over 100MB (allow for some growth but don't overdo it. MySQL will perform very badly if the buffers are too large for their usage). Adjust other buffers accordingly. Then your entire database is served from RAM.
 
OP
jomonger

jomonger

Member

Reaction score: 14
Messages: 41

Apache and Erlang on test, but I will go Erlang (it has httpd in it) for dev and production.
I had postgreSQL, but it doesn't support in-memory db, so I'm going SQLite.

Well I missed term cache :p. Quite nooby, ok, but I'm coming from industry engineering, and sometimes I miss term, when I know there should be something like this. Still learning.

you can use mdconfig(8) to create a filesystem from RAM
Very cool tool, thx for info and hints.

Cheers.
 
Top