Should I manage pages or just rely on virtual memory?

I am writing a database-style thing in C (i.e., about 500,000 records will be stored and run). I'm going to run it in a memory-limited environment (VPS), so I don't want to use balloon memory. I'm not going to process huge amounts of data - maybe up to 200 MB, but I want the amount of memory to remain in the 30 MB area (pulling these numbers out of the air).

My instinct does my own page processing (real databases do this), but I got advice saying that I should just highlight all this and let the OS do the VM swap for me. My numbers will never grow above this order. What is the best choice in this case?

Assuming a second choice, at what point would it be wise for the program to execute its own paging? Obviously, RDBMsses that can handle gigabytes should do this, but there should be a point on the scale on which the question stands.

Thank!

+5
source share
2 answers

Use mallocuntil it starts. Then and only then start profiling. If you run into the same performance issues as the proprietary and core “real databases”, you will naturally start optimizing your cache / page / alignment. After that, you have a working database, and they are orthogonal to having a working database.

+9

, , , , . , .

, , .

, , ( -) ( -).

, - , , , , .

+3

All Articles